-
Notifications
You must be signed in to change notification settings - Fork 0
/
controller
executable file
·41 lines (31 loc) · 1.24 KB
/
controller
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/tcsh
set PIPE = "/tmp/fluidsynthfifo"
# kill any existing aplaymidi processes
killall -s KILL aplaymidi >& /dev/null
# Delete any FIFO files
rm -f /tmp/churchplayer* >& /dev/null
# In case the server process fails to start before this script, loop round
# waiting one second on each loop.
set found = 0
while( $found == 0 )
# Get the port on which the fluidsynth server is listening. The server
# process should have been started before running this script.
set a = `/usr/bin/aplaymidi -l | grep FLUID`
# If the server was found, start aplaymidi in real-time server mode. It
# loop continuously, waiting for commands to be sent to it by a FIFO pipe
# at "/tmp/churchplayerfifo".
if( $status == 0 ) then
echo "controller script found a running server process" > /dev/stderr
set found = 1
/usr/bin/aplaymidi -p $a[1] -r -v -y $1
# If no server was found, send a harmless command to fluidsynth (if the pipe
# exists) to kick it into life.
else
if( -e $PIPE ) then
echo "fonts" > $PIPE
endif
# Echo a message to standard error and then sleep for one second before trying again.
echo "controller is waiting for the server process to start..." > /dev/stderr
sleep 1
endif
end