aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordvs12024-10-19 15:37:35 +1000
committerdvs12024-10-19 15:37:35 +1000
commita5895a0696855c946025e156a392fba5898b8778 (patch)
tree340bb36c1ad7a74f0ca5c97a549f528d9cb9b824
parentIf it doesn't want to TERM, wait an ever increasing time before escelating. (diff)
downloadJackOnAllDevices-a5895a0696855c946025e156a392fba5898b8778.zip
JackOnAllDevices-a5895a0696855c946025e156a392fba5898b8778.tar.gz
JackOnAllDevices-a5895a0696855c946025e156a392fba5898b8778.tar.bz2
JackOnAllDevices-a5895a0696855c946025e156a392fba5898b8778.tar.xz
Use the new exists function to decide what to do, and how.
-rwxr-xr-xaataaj.lua71
1 files changed, 41 insertions, 30 deletions
diff --git a/aataaj.lua b/aataaj.lua
index 83f870b..90749e2 100755
--- a/aataaj.lua
+++ b/aataaj.lua
@@ -265,11 +265,13 @@ end
265local asoundrcPath = '/var/lib/aataaj' 265local asoundrcPath = '/var/lib/aataaj'
266local asoundrc = 'asoundrc' 266local asoundrc = 'asoundrc'
267local GUI = 'qjackctl' 267local GUI = 'qjackctl'
268--local GUI = 'catia' 268if APT.exists('catia') then GUI = 'catia' end
269local alias = { 269local alias = {
270-- {name='Screen', dev='HDMI9'}, 270-- {name='Screen', dev='HDMI9'},
271 } 271 }
272 272
273local speaker = 'espeak'
274if APT.exists('espeak-ng') then speaker = 'espeak-ng' end
273 275
274local Cards = {} 276local Cards = {}
275 277
@@ -294,8 +296,8 @@ for i,l in ipairs(cards.lines) do
294 Cards[l]['devs'][n] = n 296 Cards[l]['devs'][n] = n
295 print("\tFound playback device " .. i - 1 .. " : " .. Cards[l]['name'] .. "\tDEVICE: " .. Cards[l]['playbackDevs'][j] .. ' ' .. n) 297 print("\tFound playback device " .. i - 1 .. " : " .. Cards[l]['name'] .. "\tDEVICE: " .. Cards[l]['playbackDevs'][j] .. ' ' .. n)
296 if 'JACK' ~= args[1] then 298 if 'JACK' ~= args[1] then
297-- print('\t\tALSA_CARD=' .. i - 1 .. ' espeak "Found playback device ' .. i - 1 .. ' : ' .. Cards[l]['name'] .. ' DEVICE: ' .. Cards[l]['playbackDevs'][j] .. ' ' .. n .. '"') 299 print('\t\tALSA_CARD=' .. i - 1 .. ' ' .. speaker .. ' "Found playback device ' .. i - 1 .. ' : ' .. Cards[l]['name'] .. ' DEVICE: ' .. Cards[l]['playbackDevs'][j] .. ' ' .. n .. '"')
298 APT.exe('ALSA_CARD=' .. i - 1 .. ' espeak "Found playback device ' .. i - 1 .. ' : ' .. Cards[l]['name'] .. ' DEVICE: ' .. Cards[l]['playbackDevs'][j] .. ' ' .. n .. '"'):noErr():Do() 300 APT.exe('ALSA_CARD=' .. i - 1 .. ' ' .. speaker .. ' "Found playback device ' .. i - 1 .. ' : ' .. Cards[l]['name'] .. ' DEVICE: ' .. Cards[l]['playbackDevs'][j] .. ' ' .. n .. '"'):noErr():Do()
299 APT.exe('sleep 1') 301 APT.exe('sleep 1')
300 end 302 end
301 end 303 end
@@ -492,24 +494,28 @@ elseif 'JACK' == args[1] then
492 print(GUI) 494 print(GUI)
493 APT.exe(GUI):fork() 495 APT.exe(GUI):fork()
494 end 496 end
495 print("jack-plumbing") 497 if APT.exists('jack-plumbing') then
496 APT.exe('jack-plumbing -o /var/lib/aataaj/jack-plumbing 2>/dev/null'):fork() 498 print("jack-plumbing")
497 -- Bridge ALSA ports to JACK ports. Only handles MIDI. 499 APT.exe('jack-plumbing -o /var/lib/aataaj/jack-plumbing 2>/dev/null'):fork()
498 -- MIDI via a2jmidid. The --ehw enables hardware ports as well, equal to using the seq MIDI drivare according to https://freeshell.de/~murks/posts/ALSA_and_JACK_MIDI_explained_(by_a_dummy_for_dummies)/ 500 end
499 --a2j_control actually starts a2jmidid. 501 if APT.exists('a2j_control') then
500 ----a2jmidid -e -u & 502 -- Bridge ALSA ports to JACK ports. Only handles MIDI.
501 -- I think the jack_control start and my current alsa config means a2jmidid gets started anyway. But seem to need this bit to get the joystick covered. 503 -- MIDI via a2jmidid. The --ehw enables hardware ports as well, equal to using the seq MIDI drivare according to https://freeshell.de/~murks/posts/ALSA_and_JACK_MIDI_explained_(by_a_dummy_for_dummies)/
502 print("a2j_control") 504 --a2j_control actually starts a2jmidid.
503 APT.exe('a2j_control --ehw && a2j_control --start'):Do() 505 ----a2jmidid -e -u &
504 print("sleep 2") 506 -- I think the jack_control start and my current alsa config means a2jmidid gets started anyway. But seem to need this bit to get the joystick covered.
505 APT.exe('sleep 2'):Do() 507 print("a2j_control")
506 print("") 508 APT.exe('a2j_control --ehw && a2j_control --start'):Do()
509-- print("sleep 2")
510-- APT.exe('sleep 2'):Do()
511 print("")
512 end
507 513
508 514
509 --local AIN = "alsa_in" 515 local AIN = "alsa_in"
510 local AIN = "zita-a2j" 516 if APT.exists('zita-a2j') then AIN = 'zita-a2j' end
511 --local AOUT = "alsa_out" 517 local AOUT = "alsa_out"
512 local AOUT = "zita-j2a" 518 if APT.exists('zita-j2a') then AOUT = 'zita-j2a' end
513 519
514 print("Basic ALSA sound devices converted to JACK.") 520 print("Basic ALSA sound devices converted to JACK.")
515 for i,C in pairs(alias) do 521 for i,C in pairs(alias) do
@@ -547,14 +553,17 @@ elseif 'JACK' == args[1] then
547 end 553 end
548 print("") 554 print("")
549 555
550 print("Scanning for joysticks.") 556 if APT.exists('aseqjoy') then
551 local sticks = APT.exe('ls -1 /dev/input/js[0-9]*'):noErr():Do() 557 print("Scanning for joysticks.")
552 for i,l in ipairs(sticks.lines) do 558 local sticks = APT.exe('ls -1 /dev/input/js[0-9]*'):noErr():Do()
553 print("aseqjoy " .. l) 559 for i,l in ipairs(sticks.lines) do
554 -- Buttons switch to that numbered MIDI channel, defaults to 1. 560 print("aseqjoy " .. l)
555 -- Axis are mapped to MIDI controllers 10 - 15 561 -- Buttons switch to that numbered MIDI channel, defaults to 1.
556 -- -r means to use high resolution MIDI values. 562 -- Axis are mapped to MIDI controllers 10 - 15
557 APT.exe('aseqjoy -d ' .. l:sub(-1,-1) .. ' -r'):fork() 563 -- -r means to use high resolution MIDI values.
564 APT.exe('aseqjoy -d ' .. l:sub(-1,-1) .. ' -r'):fork()
565 end
566 print("")
558 end 567 end
559 568
560 print('qsynth') 569 print('qsynth')
@@ -562,7 +571,9 @@ elseif 'JACK' == args[1] then
562 571
563 print("") 572 print("")
564 573
565 print('Stop our jack-plumbing, eventually.') 574 if APT.exists('jack-plumbing') then
566 APT.exe('sleep 4'):Do() 575 print('Stop our jack-plumbing, eventually.')
567 APT.killEmAll("jack-plumbing"):Do() 576 APT.exe('sleep 4'):Do()
577 APT.killEmAll{"jack-plumbing"}
578 end
568end 579end