-
Notifications
You must be signed in to change notification settings - Fork 18
/
start_puredata.sh
executable file
·65 lines (54 loc) · 1.59 KB
/
start_puredata.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
#!/bin/sh
# pisound-btn daemon for the Pisound button.
# Copyright (C) 2017 Vilniaus Blokas UAB, https://blokas.io/pisound
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; version 2 of the
# License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
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_puredata()
{
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 -send ";pd dsp 1" "$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
}