forked from redraw/puredata-oled-module
-
Notifications
You must be signed in to change notification settings - Fork 0
/
launch.sh
executable file
·68 lines (53 loc) · 1.29 KB
/
launch.sh
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/sh
# Based on Blokas puredata module.
PURE_DATA_STARTUP_SLEEP=3
. /usr/local/pisound/scripts/common/common.sh
# If there's X server running
if DISPLAY=$(find_display); then
export XAUTHORITY=/home/pi/.Xauthority
export DISPLAY
echo Using display $DISPLAY
unset NO_GUI
else
echo No display found, specifying -nogui
NO_GUI=-nogui
fi
start_mother_and_puredata()
{
MOTHER_PATCH="/home/patch/Pd/patches/organelle/mother.pd"
EXTERNALS="/home/patch/Pd/externals"
flash_leds 1
if [ -z `which puredata` ]; then
log "Pure Data was not found! Install by running: sudo apt-get install puredata"
flash_leds 100
exit 1
fi
log "Killing all Pure Data instances!"
killall puredata 2> /dev/null
PATCH="$1"
PATCH_DIR=$(dirname "$PATCH")
shift
log "Launching Pure Data."
cd "$PATCH_DIR" && puredata -stderr $NO_GUI -path "$EXTERNALS" "$MOTHER_PATCH" "$PATCH" $@ &
PD_PID=$!
log "Pure Data started!"
flash_leds 1
sleep 0.3
flash_leds 1
sleep 0.3
flash_leds 1
wait_process $PD_PID
}
PATCH="$1"
shift
echo
echo "$PATCH"
echo "$@"
(
# Connect the osc2midi bridge to the MIDI Inputs and to Pure Data.
sleep 4
/usr/local/pisound-ctl/connect_osc2midi.sh "pisound-ctl"
aconnect "pisound-ctl" "Pure Data";
aconnect -d "Pure Data:1" "pisound-ctl"
) &
start_mother_and_puredata "$PATCH" $@