From: Michael Gernoth Date: Sun, 13 Jan 2008 19:42:15 +0000 (+0100) Subject: search for available audioplayer X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/micropolis/commitdiff_plain/e4270049e4e0cefa1d3784d4215a23e53fe5e929?ds=sidebyside search for available audioplayer --- diff --git a/res/micropolis.tcl b/res/micropolis.tcl index ff1ad9b..7b65a4c 100644 --- a/res/micropolis.tcl +++ b/res/micropolis.tcl @@ -942,7 +942,7 @@ proc EchoPlaySound {soundspec} { if {$Sound} { echo PlaySound [lindex $soundspec 0] signal ignore SIGCHLD - exec play res/sounds/[string tolower [lindex $soundspec 0]].wav & + exec res/sounds/player res/sounds/[string tolower [lindex $soundspec 0]].wav & } } diff --git a/res/sounds/player b/res/sounds/player new file mode 100755 index 0000000..7784940 --- /dev/null +++ b/res/sounds/player @@ -0,0 +1,13 @@ +#!/bin/sh + +PLAYER=true + +if [ -x "`which aplay`" ]; then + PLAYER=aplay +elif [ -x "`which play`" ]; then + PLAYER=play +elif [ -x "`which mplayer`" ]; then + PLAYER="mplayer -nogui -nocache" +fi + +exec ${PLAYER} "$@" >/dev/null 2>&1