Run script when stopping Jack within Cadence ?
Moderators: MattKingUSA, khz
Run script when stopping Jack within Cadence ?
Hi,
Is there a way to run a script when stopping Jack server?
I need to resume Networg-Manager and pulseaudio.
Is there a way to run a script when stopping Jack server?
I need to resume Networg-Manager and pulseaudio.
-
- Established Member
- Posts: 2072
- Joined: Mon Sep 28, 2015 8:06 pm
- Location: Here, of course!
- Has thanked: 224 times
- Been thanked: 400 times
- Contact:
Re: Run script when stopping Jack within Cadence ?
If you run qjackctl that is a built-in option in 'Setup'
The Yoshimi guy {apparently now an 'elderly'}
Re: Run script when stopping Jack within Cadence ?
Ok, but I want to use Cadence if possible . Unless qjackctl starts automatically when Cadence starts and you propose a nice workaround.
Re: Run script when stopping Jack within Cadence ?
I control a lot of things - including JACK - from keyboard shortcuts. These shortcuts run shell scripts which do the job.
I can share my entire approach with you, but this kind of setup is very dependent on the desktop manager (for the shortcuts) and I use fish for scripting, which you probably will have to port to bash. I haven't been fluent in bash for years.
I can share my entire approach with you, but this kind of setup is very dependent on the desktop manager (for the shortcuts) and I use fish for scripting, which you probably will have to port to bash. I haven't been fluent in bash for years.
Re: Run script when stopping Jack within Cadence ?
Well, I definitely need running some scripts when starting / closing Cadence.
The major issue is wpa_supplicant process , scanning for networks every ~2 minutes. I get ~20 xruns at once ,every 2 minutes!
I manually pause the process and after jamming I continue (it keeps wifi connection on)
Any suggestions (besides closing network) ?
The major issue is wpa_supplicant process , scanning for networks every ~2 minutes. I get ~20 xruns at once ,every 2 minutes!
I manually pause the process and after jamming I continue (it keeps wifi connection on)
Any suggestions (besides closing network) ?
-
- Established Member
- Posts: 2335
- Joined: Mon Jul 01, 2013 8:13 am
- Has thanked: 9 times
- Been thanked: 454 times
Re: Run script when stopping Jack within Cadence ?
You can setup a shortcut menu entry or desktop starter comandline like this:
run/pre/script && cadence && run/post/script
give it a meaningful name and done.
run/pre/script && cadence && run/post/script
give it a meaningful name and done.
On the road again.
Re: Run script when stopping Jack within Cadence ?
Maybe you can try adding/changing this line in your wpa_supplicant.conf file:korakios wrote:Well, I definitely need running some scripts when starting / closing Cadence.
The major issue is wpa_supplicant process , scanning for networks every ~2 minutes. I get ~20 xruns at once ,every 2 minutes!
I manually pause the process and after jamming I continue (it keeps wifi connection on)
Any suggestions (besides closing network) ?
ap_scan=0
Re: Run script when stopping Jack within Cadence ?
Thanks I'll try ittramp wrote:You can setup a shortcut menu entry or desktop starter comandline like this:
run/pre/script && cadence && run/post/script
give it a meaningful name and done.
I am afraid ,the network manager will no longer see any new wireless networks , but I'll give it a try.Luc wrote: Maybe you can try adding/changing this line in your wpa_supplicant.conf file:
ap_scan=0
Re: Run script when stopping Jack within Cadence ?
The only way for wpa to stop is actually stopping the process. It totally ignores whatever command I give on wpa_cli
ap_scan 0
scan_interval 0
suspend
The run/pre/script && cadence && run/post/script method is not good since I want to interact when jack starts or stops with Cadence and not when exiting Cadence application.
It's not big deal ,I can always use qjacktrl instead but I like Cadence much better.
ap_scan 0
scan_interval 0
suspend
The run/pre/script && cadence && run/post/script method is not good since I want to interact when jack starts or stops with Cadence and not when exiting Cadence application.
It's not big deal ,I can always use qjacktrl instead but I like Cadence much better.
-
- Established Member
- Posts: 2335
- Joined: Mon Jul 01, 2013 8:13 am
- Has thanked: 9 times
- Been thanked: 454 times
Re: Run script when stopping Jack within Cadence ?
If you would do that with cadence, you may use a launcher script like this:
Note that the echo's here are only for control, to see what's going up, you'll better remove them or comment them out when you use it in practise. You may also adjust the sleep times to your needs.
Code: Select all
#!/bin/bash
# monitor jackd script
just_started="YES"
just_stoped="YES"
# start jackd launcher, replace with cadence
qjackctl &
sleep 5
# replace qjackctl with cadence
while [ "$(pidof qjackctl)" ]; do
while [ "$(pidof jackd)" ]; do
if [ $just_started == "YES" ]
then
just_started="NO"
just_stoped="YES"
echo 'jackd is started.'
# execute your pre script here
else
echo 'jackd is running.'
fi
sleep 5
done
if [ $just_stoped == "YES" ]
then
just_started="YES"
just_stoped="NO"
echo 'jackd is stoped.'
# execute your post script here
else
echo 'only qjackctl run.'
fi
sleep 5
done
echo "session quit"
exit 0
On the road again.
Re: Run script when stopping Jack within Cadence ?
Thanks @Tramp !Your script became the base for making a Template
Now I have to think a way to run
and
UPDATE:
seems to do the trick. It requires the root password but only once.
In few words I start Cadence, kill pulse, start Jack , pause wpa (and audio glitches) in one click!
Code: Select all
#!/bin/bash
# Do some extra things if needed before Starting Cadence
# PreUpCadence Scripts ,here:
# We can also run scripts depending on JackServer status
# but we want only once!
JackUpScript="notRunning"
JackDownScript="notRunning"
# Start Cadence!
cadence &
# Stop PulseAudio ,you can always start it in Cadence ,or in a Session
pulseaudio -k &
# Start Jack
echo 'Starting Jack'
jack_control start &
sleep 1
# While Cadence is running
while [ "$(pgrep -f cadence.py)" ]; do
# Check if Jack is running
status=$(jack_control status |grep -v status)
# If Jack is NOT Running
if [ $status == stopped ]
then
# Run a script ,but only once. So we check
if [ $JackDownScript == "notRunning" ]
then
JackUpScript="notRunning"
echo "Jack is stopped ,running PostDown Script"
JackDownScript="Running"
# Run Something!
fi
else
if [ $JackUpScript == "notRunning" ]
then
JackDownScript="notRunning"
echo "Jack is started ,running PostUp Script"
JackUpScript="Running"
# Run Something else!
fi
fi
# Checking every n seconds
sleep 1
done
# Exciting Cadence, no need for Low Latency Audio, stopping Jack
echo 'Stopping Jack'
jack_control stop &
# But we need some audio!
echo 'Restoring PulseAudio'
pulseaudio --start &
# Put any other PostDownCadence scripts here
exit 0
Code: Select all
kill -STOP $(pidof wpa_supplicant)
Code: Select all
kill -CONT $(pidof wpa_supplicant)
UPDATE:
Code: Select all
kdesudo "kill -CONT $(pidof wpa_supplicant)"
kdesudo "kill -STOP $(pidof wpa_supplicant)"
In few words I start Cadence, kill pulse, start Jack , pause wpa (and audio glitches) in one click!