From 959f12c0e7cc5b0a9efc2bd80e38ce09347ce517 Mon Sep 17 00:00:00 2001 From: dvs1 Date: Mon, 14 Oct 2024 22:55:03 +1000 Subject: Rearrange code. --- aataaj.lua | 158 ++++++++++++++++++++++++++++++------------------------------- 1 file changed, 79 insertions(+), 79 deletions(-) diff --git a/aataaj.lua b/aataaj.lua index 511491a..5a20a53 100755 --- a/aataaj.lua +++ b/aataaj.lua @@ -82,85 +82,6 @@ NOTE - Seems both ALSA and JACK are per user. So you need to run ]] -local args = {...} -if 0 ~= #args then --- for i,a in pairs(args) do --- print('Argument ' .. i .. ' = ' .. a) --- end - - if 'start' == args[1] then - elseif 'stop' == args[1] then - APT.exe("killall -TERM qsynth"):Do() - APT.exe("a2j_control --stop"):Do() - APT.exe("sleep 2"):Do() - APT.exe("a2j_control --exit"):Do() - APT.exe("sleep 2"):Do() - APT.exe("killall -TERM alsa_out"):Do() - APT.exe("killall -TERM alsa_in"):Do() - APT.exe("killall -TERM zita-a2j"):Do() - APT.exe("killall -TERM zita-j2a"):Do() - APT.exe("killall -TERM aseqjoy"):Do() - APT.exe("killall -TERM jack-plumbing"):Do() - APT.exe("sleep 2"):Do() - APT.exe("jack_control stop"):Do() - APT.exe("sleep 2"):Do() - APT.exe("jack_control exit"):Do() - APT.exe("sleep 2"):Do() - --APT.exe("a2j_control --stop; a2j_control --exit"):Do() - --APT.exe("sleep 2"):Do() - APT.exe("killall -TERM jmcore"):Do() - APT.exe("pkill -TERM jackdbus; pkill -TERM a2jmidid"):Do() - APT.exe("killall -TERM a2jmidid"):Do() - APT.exe("killall -KILL jackdbus"):Do() - APT.exe("sleep 2"):Do() - APT.exe("killall -KILL a2jmidid"):Do() - APT.exe("pkill -KILL jackdbus; pkill -KILL a2jmidid"):Do() - APT.exe("sleep 2"):Do() - APT.exe("killall -KILL a2jmidid"):Do() - APT.exe("killall -KILL jackdbus"):Do() - APT.exe("sleep 2"):Do() - APT.exe("killall -KILL a2jmidid"):Do() - APT.exe("killall -KILL jackdbus"):Do() - APT.exe("sleep 2"):Do() - APT.exe("pkill -KILL jackdbus; pkill -KILL a2jmidid"):Do() - APT.exe("killall -TERM qjackctl"):Do() - - -- Catia is python, and no easy way to kill it. - APT.exe("ps auxw | grep python"):Do() - return(0) - elseif 'JACK' == args[1] then - elseif 'restart' == args[1] then args[1] = 'start' - elseif 'force-reload' == args[1] then args[1] = 'start' - elseif 'status' == args[1] then - return(0) - elseif 'help' == args[1] then - print(Help) - return(0) - elseif '--help' == args[1] then - print(Help) - return(0) - else - print("Usage: /etc/init.d/aataaj.lua {start|stop|restart|force-reload|status}") - return(1) - end -else - print("Usage: /etc/init.d/aataaj.lua {help|start|stop|restart|force-reload|status|JACK}") - return(1) -end - - - --- CHANGE these to suit. -local asoundrcPath = '/var/lib/aataaj' -local asoundrc = 'asoundrc' -local GUI = 'qjackctl' ---local GUI = 'catia' -local alias = { --- {name='Screen', dev='HDMI9'}, - } - - - -- This APT stuff was copied from apt-panopticon. local APT = {} @@ -271,6 +192,85 @@ end +local args = {...} +if 0 ~= #args then +-- for i,a in pairs(args) do +-- print('Argument ' .. i .. ' = ' .. a) +-- end + + if 'start' == args[1] then + elseif 'stop' == args[1] then + APT.exe("killall -TERM qsynth"):Do() + APT.exe("a2j_control --stop"):Do() + APT.exe("sleep 2"):Do() + APT.exe("a2j_control --exit"):Do() + APT.exe("sleep 2"):Do() + APT.exe("killall -TERM alsa_out"):Do() + APT.exe("killall -TERM alsa_in"):Do() + APT.exe("killall -TERM zita-a2j"):Do() + APT.exe("killall -TERM zita-j2a"):Do() + APT.exe("killall -TERM aseqjoy"):Do() + APT.exe("killall -TERM jack-plumbing"):Do() + APT.exe("sleep 2"):Do() + APT.exe("jack_control stop"):Do() + APT.exe("sleep 2"):Do() + APT.exe("jack_control exit"):Do() + APT.exe("sleep 2"):Do() + --APT.exe("a2j_control --stop; a2j_control --exit"):Do() + --APT.exe("sleep 2"):Do() + APT.exe("killall -TERM jmcore"):Do() + APT.exe("pkill -TERM jackdbus; pkill -TERM a2jmidid"):Do() + APT.exe("killall -TERM a2jmidid"):Do() + APT.exe("killall -KILL jackdbus"):Do() + APT.exe("sleep 2"):Do() + APT.exe("killall -KILL a2jmidid"):Do() + APT.exe("pkill -KILL jackdbus; pkill -KILL a2jmidid"):Do() + APT.exe("sleep 2"):Do() + APT.exe("killall -KILL a2jmidid"):Do() + APT.exe("killall -KILL jackdbus"):Do() + APT.exe("sleep 2"):Do() + APT.exe("killall -KILL a2jmidid"):Do() + APT.exe("killall -KILL jackdbus"):Do() + APT.exe("sleep 2"):Do() + APT.exe("pkill -KILL jackdbus; pkill -KILL a2jmidid"):Do() + APT.exe("killall -TERM qjackctl"):Do() + + -- Catia is python, and no easy way to kill it. + APT.exe("ps auxw | grep python"):Do() + return(0) + elseif 'JACK' == args[1] then + elseif 'restart' == args[1] then args[1] = 'start' + elseif 'force-reload' == args[1] then args[1] = 'start' + elseif 'status' == args[1] then + return(0) + elseif 'help' == args[1] then + print(Help) + return(0) + elseif '--help' == args[1] then + print(Help) + return(0) + else + print("Usage: /etc/init.d/aataaj.lua {start|stop|restart|force-reload|status}") + return(1) + end +else + print("Usage: /etc/init.d/aataaj.lua {help|start|stop|restart|force-reload|status|JACK}") + return(1) +end + + + + +-- CHANGE these to suit. +local asoundrcPath = '/var/lib/aataaj' +local asoundrc = 'asoundrc' +--local GUI = 'qjackctl' +local GUI = 'catia' +local alias = { + {name='Screen', dev='HDMI9'}, + } + + local Cards = {} print('Scanning for audio devices.') -- cgit v1.1