cleaned up many variable usages, etc.
[feisty_meow.git] / scripts / multimedia / sound_play.sh
1 #!/bin/bash
2
3 # play the sound files specified.
4
5 source "$FEISTY_MEOW_SCRIPTS/core/functions.sh"  # provides psfind.
6
7 if [ $# -lt 1 ]; then
8   #echo no sound file specified.
9   exit 0;
10 fi
11
12 export PLAYCMD=/usr/bin/play
13 if [ ! -f "$PLAYCMD" ]; then
14   PLAYCMD=echo
15 fi
16
17 if [ ! -z "$(psfind artsd)" ]; then
18   # we see artsd running...
19   PLAYCMD=artsplay
20 elif [ ! -z "$(psfind esd)" ]; then
21   # we see esd running...
22   PLAYCMD=esdplay
23 elif [ ! -z "$WINDIR" ]; then
24   # kludge for win32; we provide our own sound player.
25   PLAYCMD=playsound
26 fi
27
28 # play the sounds individually; playsound can handle multiple files, but
29 # "play" doesn't want to on some systems.
30 for i in $*; do $PLAYCMD $i >/dev/null 2>&1; done
31
32 exit 0