cadence-session-start: Remove all qt stuff appart QSettings
[cadence-nykeej.git] / pulse2jack / pulse2jack
blobfa2681ae05e8ad37e8d03fa2c2b0898f75647210
1 #!/bin/bash
2 # Script to stop current pulseaudio and restart it in Jack mode
4 IsPulseAudioRunning()
6 PROCESS=`ps -e | grep pulseaudio`
7 if [ "$PROCESS" == "" ]; then
8 false
9 else
10 true
14 if [ ! -d ~/.pulse ]; then
15 mkdir -p ~/.pulse
18 if [ ! -f ~/.pulse/client.conf ]; then
19 echo "autospawn = no" > ~/.pulse/client.conf
20 else
21 if (! cat ~/.pulse/client.conf | grep "autospawn = no" > /dev/null); then
22 sed -i '/autospawn =/d' ~/.pulse/client.conf
23 echo "autospawn = no" >> ~/.pulse/client.conf
27 if [ ! -f ~/.pulse/daemon.conf ]; then
28 echo "rlimit-rttime = -1" > ~/.pulse/daemon.conf
29 else
30 if (! cat ~/.pulse/daemon.conf | grep "rlimit-rttime = -1" > /dev/null); then
31 sed -i '/rlimit-rttime =/d' ~/.pulse/daemon.conf
32 echo "rlimit-rttime = -1" >> ~/.pulse/daemon.conf
36 case $1 in
37 -h|--h|--help)
38 echo "usage: $0 [command]
40 -p, --play Playback mode only
42 -h, --help Show this help menu
45 NOTE:
46 When runned with no arguments, pulse2jack will
47 activate PulseAudio with both playback and record modes.
49 exit
52 -p|--p|--play)
53 FILE=/usr/share/cadence/pulse2jack/play.pa
57 FILE=/usr/share/cadence/pulse2jack/play+rec.pa
59 esac
61 if (IsPulseAudioRunning); then
63 echo "PulseAudio is running, stopping it..."
64 killall pulseaudio
65 sleep 0.2
67 if (IsPulseAudioRunning); then
69 echo "Failed, force kill..."
70 pkill -KILL pulseaudio
71 sleep 0.2
73 else
74 echo "Success!"
79 if (`pulseaudio --daemonize --high-priority --realtime --disallow-module-loading --exit-idle-time=-1 --file=$FILE -n`); then
80 echo "Initiated PulseAudio successfully!"
81 else
82 echo "Failed to initialize PulseAudio!"