#!/bin/csh ############################################################### # This script will pause any playing music, then play the # sound file(s) whose name(s) are passed in (which should be named # starting in the sounds directory), then un-pause any # playing songs. It plays up to four files. # # It returns 0 on success and 1 on failure. ############################################################## # Get the first file name and look it up in the sounds # directory. set sound_directory = `musicbox_sounds_directory.txt` set filename = "$sound_directory"/"$1" if ( ! -f "$filename" ) then echo Cannot find sound $filename exit 1 endif # Pause any playing music and wait a second to make # sure that it has stopped musicbox_pause.txt sleep 1 # Set the volume on the PCM to 100% and the volume on the # main output to 30%. For some reason, the sound card on # my PC would move these settings all over at reboot. musicbox_set_volume.txt # Play the first file. play "$filename" # Play any other files that we find (in case there was more than # one argument). set filename = "$sound_directory"/"$2" if ( -f "$filename" ) then play "$filename" endif set filename = "$sound_directory"/"$3" if ( -f "$filename" ) then play "$filename" endif set filename = "$sound_directory"/"$4" if ( -f "$filename" ) then play "$filename" endif # Let the music resume if it was paused. musicbox_resume.txt exit 0