From 851812f3fc226d30b4dc26ba147977e9511a82ee Mon Sep 17 00:00:00 2001 From: Michael Gernoth Date: Mon, 14 Jan 2008 00:01:03 +0100 Subject: [PATCH] inform user, when no audio player is found do not print all played files to the console --- res/micropolis.tcl | 2 +- res/sounds/player | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/res/micropolis.tcl b/res/micropolis.tcl index 7b65a4c..dac3517 100644 --- a/res/micropolis.tcl +++ b/res/micropolis.tcl @@ -940,7 +940,7 @@ proc EchoPlaySound {soundspec} { # Temporary workaround to tell Python Sugar app to play sound. global Sound if {$Sound} { - echo PlaySound [lindex $soundspec 0] + #echo PlaySound [lindex $soundspec 0] signal ignore SIGCHLD exec res/sounds/player res/sounds/[string tolower [lindex $soundspec 0]].wav & } diff --git a/res/sounds/player b/res/sounds/player index 7784940..af26836 100755 --- a/res/sounds/player +++ b/res/sounds/player @@ -1,6 +1,6 @@ -#!/bin/sh +#!/bin/bash -PLAYER=true +PLAYER= if [ -x "`which aplay`" ]; then PLAYER=aplay @@ -10,4 +10,13 @@ elif [ -x "`which mplayer`" ]; then PLAYER="mplayer -nogui -nocache" fi -exec ${PLAYER} "$@" >/dev/null 2>&1 +if [ "x${PLAYER}" = "x" ]; then + echo "Can't find audio player!" + echo "Please make sure you have aplay, play or mplayer in your path." + if [ "`uname`" = "Darwin" ]; then + echo "A working play for OS X is available from:" + echo "http://www.hieper.nl/html/play.html" + fi +else + exec ${PLAYER} "$@" >/dev/null 2>&1 +fi -- 2.39.5