search for available audioplayer
authorMichael Gernoth <michael@gernoth.net>
Sun, 13 Jan 2008 19:42:15 +0000 (20:42 +0100)
committerMichael Gernoth <michael@gernoth.net>
Sun, 13 Jan 2008 19:42:15 +0000 (20:42 +0100)
res/micropolis.tcl
res/sounds/player [new file with mode: 0755]

index ff1ad9b..7b65a4c 100644 (file)
@@ -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 (executable)
index 0000000..7784940
--- /dev/null
@@ -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
Impressum, Datenschutz