3 VERBOSITY=${VERBOSITY:--vvv}
4 PLUGINDIR=${PLUGINDIR:-$(pwd)/src/.libs}
5 CONFIGFILE=${CONFIGFILE:-$(pwd)/speech-recognition.conf}
7 plugins="simple-disambiguator sphinx-speech simple-voice"
8 clients="search-client mpris2-client bluetooth-client"
11 select_input_device () {
12 local _pcidev _usbdev _dev _cnt _i _def _choice=""
14 _pcidev=`pactl list sources | grep Name: | tr -s '\t' ' ' |
15 sed 's/^ *Name: //g' | grep -v monitor | grep pci`
16 _usbdev=`pactl list sources | grep Name: | tr -s '\t' ' ' |
17 sed 's/^ *Name: //g' | grep -v monitor | grep usb`
19 _cnt=$((`echo $_pcidev | wc -l` + `echo $_usbdev | wc -l`))
21 while [ -z "$_choice" ]; do
22 echo "Please select an available input device:"
25 if [ -n "$_usbdev" ]; then
26 echo " * USB devices:"
27 for _dev in $_usbdev; do
28 [ "$_i" = "1" ] && _def="(default)" || _def=""
29 echo " $_i: $_dev $_def"
34 if [ -n "$_pcidev" ]; then
35 echo " * PCI devices:"
36 for _dev in $_pcidev; do
37 [ "$_i" = "1" ] && _def="(default)" || _def=""
38 echo " $_i: $_dev $_def"
43 echo " * Preconfigured device:"
44 echo " $_i: from the config file"
46 read -p "Please select 1 - $_cnt (default: 1): " _choice
47 [ -z "$_choice" ] && _choice=1
49 if [ "$_choice" -lt 1 -o "$_choice" -gt $(($_cnt + 1)) ]; then
54 if [ "$_choice" = "$(($_cnt + 1))" ]; then
57 [ -n "$_usbdev" ] && _t=" " || _t=""
58 _dev=`echo "$_usbdev${_t}$_pcidev" | tr ' ' '\n' |
59 head -$_choice | tail -1`
66 if [ -n "$PULSESRC" ]; then
67 PULSESRC="-s sphinx.pulsesrc=$PULSESRC"
71 for i in $plugins $clients; do
72 LOAD_OPTIONS="$LOAD_OPTIONS -L $i"
79 export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PUGINDIR"
80 opts="${1#--valgrind}"
82 =*) xeq="valgrind ${opts#=}";;
83 *) xeq="valgrind --leak-check=full";;
87 EXTRA_OPTIONS="$EXTRA_OPTIONS $1"
93 $xeq ./src/srs-daemon -f $VERBOSITY -P $PLUGINDIR -c $CONFIGFILE \
94 $LOAD_OPTIONS $PULSESRC $EXTRA_OPTIONS