version 1.40.130 release
[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/launch_feisty_meow.sh"
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 Unknown sound player...'
15 fi
16
17 if [ ! -z "$(which afplay)" ]; then
18 #echo we see afplay available...
19   PLAYCMD=afplay
20 elif [ ! -z "$(psfind artsd)" ]; then
21 #echo we see artsd running...
22   PLAYCMD=artsplay
23 elif [ ! -z "$(psfind esd)" ]; then
24 #echo  we see esd running...
25   PLAYCMD=esdplay
26 elif [ ! -z "$(psfind pulseaudio)" ]; then
27 #echo we see pulse running...
28   PLAYCMD="padsp aplay"
29 elif [ ! -z "$WINDIR" ]; then
30 #echo kludge for win32; we provide our own sound player.
31   PLAYCMD=playsound
32 else
33   echo "I don't know how to play sounds for this OS and sound system."
34 fi
35
36 # play the sounds individually; playsound can handle multiple files, but
37 # "play" doesn't want to on some systems.
38 for i in $*; do $PLAYCMD $i >/dev/null 2>&1; done
39
40 exit 0
41