aboutsummaryrefslogtreecommitdiffstats
path: root/aataaj.lua
diff options
context:
space:
mode:
authordvs12024-10-22 13:51:59 +1000
committerdvs12024-10-22 13:51:59 +1000
commite4d51e4c5904895dd599d099e857ccebdf1714fc (patch)
treefeffbbef3f4eed362eeb347f31dd769ba85e3cb2 /aataaj.lua
parentConvert example user script to new exe stuff. (diff)
downloadJackOnAllDevices-e4d51e4c5904895dd599d099e857ccebdf1714fc.zip
JackOnAllDevices-e4d51e4c5904895dd599d099e857ccebdf1714fc.tar.gz
JackOnAllDevices-e4d51e4c5904895dd599d099e857ccebdf1714fc.tar.bz2
JackOnAllDevices-e4d51e4c5904895dd599d099e857ccebdf1714fc.tar.xz
Lots of little tweaks about how _ works.
Diffstat (limited to 'aataaj.lua')
-rwxr-xr-xaataaj.lua68
1 files changed, 33 insertions, 35 deletions
diff --git a/aataaj.lua b/aataaj.lua
index a92e0fb..26db4d2 100755
--- a/aataaj.lua
+++ b/aataaj.lua
@@ -118,8 +118,8 @@ if 0 ~= #args then
118 _.killEmAll{'jmcore', 'qjackctl'} 118 _.killEmAll{'jmcore', 'qjackctl'}
119 -- Catia is python, and no easy way to kill it. 119 -- Catia is python, and no easy way to kill it.
120 -- Also it keeps jackdbus alive, no matter how hard you kill it. 120 -- Also it keeps jackdbus alive, no matter how hard you kill it.
121 __("pkill -TERM -u $USER -f catia"):Do() 121 __"pkill -TERM -u $USER -f catia":Do()
122 __("sleep 2"):Do() 122 __"sleep 2":Do()
123 _.killEmAll{'jackdbus', 'a2jmidid'} 123 _.killEmAll{'jackdbus', 'a2jmidid'}
124 return(0) 124 return(0)
125 elseif 'JACK' == args[1] then 125 elseif 'JACK' == args[1] then
@@ -149,18 +149,18 @@ end
149local asoundrcPath = '/var/lib/aataaj' 149local asoundrcPath = '/var/lib/aataaj'
150local asoundrc = 'asoundrc' 150local asoundrc = 'asoundrc'
151local GUI = 'qjackctl' 151local GUI = 'qjackctl'
152if _.exists('catia') then GUI = 'catia' end 152if _.runnable('catia') then GUI = 'catia' end
153local alias = { 153local alias = {
154-- {name='Screen', dev='HDMI9'}, 154-- {name='Screen', dev='HDMI9'},
155 } 155 }
156 156
157local speaker = 'espeak' 157local speaker = 'espeak'
158if _.exists('espeak-ng') then speaker = 'espeak-ng' end 158if _.runnable('espeak-ng') then speaker = 'espeak-ng' end
159 159
160local Cards = {} 160local Cards = {}
161 161
162print('Scanning for audio devices.') 162print('Scanning for audio devices.')
163local cards = __('ls -d1 /proc/asound/card[0-9]*'):noErr():Do() 163local cards = __'ls -d1 /proc/asound/card[0-9]*':noErr():Do()
164for i,l in ipairs(cards.lines) do 164for i,l in ipairs(cards.lines) do
165 local f, e = io.open(l .. '/id', "r") 165 local f, e = io.open(l .. '/id', "r")
166 if nil == f then print("Could not open " .. l .. '/id') else 166 if nil == f then print("Could not open " .. l .. '/id') else
@@ -182,7 +182,7 @@ for i,l in ipairs(cards.lines) do
182 if 'JACK' ~= args[1] then 182 if 'JACK' ~= args[1] then
183 print('\t\tALSA_CARD=' .. i - 1 .. ' ' .. speaker .. ' "Found playback device ' .. i - 1 .. ' : ' .. Cards[l]['name'] .. ' DEVICE: ' .. Cards[l]['playbackDevs'][j] .. ' ' .. n .. '"') 183 print('\t\tALSA_CARD=' .. i - 1 .. ' ' .. speaker .. ' "Found playback device ' .. i - 1 .. ' : ' .. Cards[l]['name'] .. ' DEVICE: ' .. Cards[l]['playbackDevs'][j] .. ' ' .. n .. '"')
184 __('ALSA_CARD=' .. i - 1 .. ' ' .. speaker .. ' "Found playback device ' .. i - 1 .. ' : ' .. Cards[l]['name'] .. ' DEVICE: ' .. Cards[l]['playbackDevs'][j] .. ' ' .. n .. '"'):noErr():Do() 184 __('ALSA_CARD=' .. i - 1 .. ' ' .. speaker .. ' "Found playback device ' .. i - 1 .. ' : ' .. Cards[l]['name'] .. ' DEVICE: ' .. Cards[l]['playbackDevs'][j] .. ' ' .. n .. '"'):noErr():Do()
185 __('sleep 1'):Do() 185 __'sleep 1':Do()
186 end 186 end
187 end 187 end
188 end 188 end
@@ -363,31 +363,29 @@ elseif 'JACK' == args[1] then
363 print('') 363 print('')
364 print("Start up JACK and friends.") 364 print("Start up JACK and friends.")
365 print("jack_control") 365 print("jack_control")
366 __('jack_control start'):Do() 366 __[[jack_control start
367 __('jack_control ds alsa'):Do() 367 jack_control ds alsa]]:Do()
368 --jack_control dps device hw:RIG,0 368 --jack_control dps device hw:RIG,0
369 local r = __('jack_control status'):Do().status 369 while 0 ~= __'jack_control status':Do().status do
370 while r ~= 0 do 370 print("Waiting for JACK")
371 print("Waiting for JACK - sleep 1") 371 __'sleep 1':Do()
372 __('sleep 1'):Do()
373 r = __('jack_control status'):Do().status
374 end 372 end
375 if nil ~= GUI then 373 if nil ~= GUI then
376 print(GUI) 374 print(GUI)
377 __(GUI):fork() 375 __(GUI):forkOnce()
378 end 376 end
379 if _.exists('jack-plumbing') then 377 if _.runnable'jack-plumbing' then
380 print("jack-plumbing") 378 print("jack-plumbing")
381 __('jack-plumbing -o /var/lib/aataaj/jack-plumbing 2>/dev/null'):fork() 379 __'jack-plumbing -o /var/lib/aataaj/jack-plumbing 2>/dev/null':fork()
382 end 380 end
383 if _.exists('a2j_control') then 381 if _.runnable'a2j_control' then
384 -- Bridge ALSA ports to JACK ports. Only handles MIDI. 382 -- Bridge ALSA ports to JACK ports. Only handles MIDI.
385 -- 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)/ 383 -- 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)/
386 --a2j_control actually starts a2jmidid. 384 --a2j_control actually starts a2jmidid.
387 ----a2jmidid -e -u & 385 ----a2jmidid -e -u &
388 -- 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. 386 -- 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.
389 print("a2j_control") 387 print("a2j_control")
390 __('a2j_control --ehw && a2j_control --start'):Do() 388 __'a2j_control --ehw && a2j_control --start':Do()
391-- print("sleep 2") 389-- print("sleep 2")
392-- __('sleep 2'):Do() 390-- __('sleep 2'):Do()
393 print("") 391 print("")
@@ -395,9 +393,9 @@ elseif 'JACK' == args[1] then
395 393
396 394
397 local AIN = "alsa_in" 395 local AIN = "alsa_in"
398 if _.exists('zita-a2j') then AIN = 'zita-a2j' end 396 if _.runnable'zita-a2j' then AIN = 'zita-a2j' end
399 local AOUT = "alsa_out" 397 local AOUT = "alsa_out"
400 if _.exists('zita-j2a') then AOUT = 'zita-j2a' end 398 if _.runnable'zita-j2a' then AOUT = 'zita-j2a' end
401 399
402 print("Basic ALSA sound devices converted to JACK.") 400 print("Basic ALSA sound devices converted to JACK.")
403 for i,C in pairs(alias) do 401 for i,C in pairs(alias) do
@@ -406,15 +404,15 @@ elseif 'JACK' == args[1] then
406 end 404 end
407 print("HW playback: cloop\tDEVICE: cloop") 405 print("HW playback: cloop\tDEVICE: cloop")
408 -- No idea why, cloop wont work with zita-a2j. 406 -- No idea why, cloop wont work with zita-a2j.
409 __('alsa_in -j cloop -d cloop'):fork() 407 __'alsa_in -j cloop -d cloop':fork()
410 --__('sleep 1'):Do() 408 --__[[sleep 1
411 --__('jack_connect cloop:capture_1 system:playback_1'):Do() 409 -- jack_connect cloop:capture_1 system:playback_1o()
412 --__('jack_connect cloop:capture_2 system:playback_2'):Do() 410 -- jack_connect cloop:capture_2 system:playback_2]]:Do()
413 print("HW playback: ploop\tDEVICE: ploop") 411 print("HW playback: ploop\tDEVICE: ploop")
414 __('alsa_out -j ploop -d ploop'):fork() 412 __'alsa_out -j ploop -d ploop':fork()
415 --__('sleep 1'):Do() 413 --__[[sleep 1
416 --__('jack_connect system:capture_1 ploop:playback_1'):Do() 414 -- jack_connect system:capture_1 ploop:playback_1
417 --__('jack_connect system:capture_2 ploop:playback_2'):Do() 415 -- jack_connect system:capture_2 ploop:playback_2]]:Do()
418 416
419 417
420 print("") 418 print("")
@@ -424,7 +422,7 @@ elseif 'JACK' == args[1] then
424 for j,c in ipairs(C['playbackDevs']) do 422 for j,c in ipairs(C['playbackDevs']) do
425 print("HW playback: " .. C['name'] .. "\tDEVICE: " .. C['playbackDevs'][j]) 423 print("HW playback: " .. C['name'] .. "\tDEVICE: " .. C['playbackDevs'][j])
426 __(AOUT .. ' -j ' .. C['name'] .. "_" .. C['playbackDevs'][j] .. '-in -d ' .. C['name'] .. C['playbackDevs'][j]):fork() 424 __(AOUT .. ' -j ' .. C['name'] .. "_" .. C['playbackDevs'][j] .. '-in -d ' .. C['name'] .. C['playbackDevs'][j]):fork()
427 -- __('sleep 1'):Do() 425 -- __'sleep 1':Do()
428 -- __('jack_connect cloop:capture_1 ' .. C['name'] .. '_' .. C['playbackDevs'][j] .. '-in' .. ':playback_1'):Do() 426 -- __('jack_connect cloop:capture_1 ' .. C['name'] .. '_' .. C['playbackDevs'][j] .. '-in' .. ':playback_1'):Do()
429 -- __('jack_connect cloop:capture_2 ' .. C['name'] .. '_' .. C['playbackDevs'][j] .. '-in' .. ':playback_2'):Do() 427 -- __('jack_connect cloop:capture_2 ' .. C['name'] .. '_' .. C['playbackDevs'][j] .. '-in' .. ':playback_2'):Do()
430 end 428 end
@@ -435,9 +433,9 @@ elseif 'JACK' == args[1] then
435 end 433 end
436 print("") 434 print("")
437 435
438 if _.exists('aseqjoy') then 436 if _.runnable('aseqjoy') then
439 print("Scanning for joysticks.") 437 print("Scanning for joysticks.")
440 local sticks = __('ls -1 /dev/input/js[0-9]*'):noErr():Do() 438 local sticks = __'ls -1 /dev/input/js[0-9]*':noErr():Do()
441 for i,l in ipairs(sticks.lines) do 439 for i,l in ipairs(sticks.lines) do
442 print("aseqjoy " .. l) 440 print("aseqjoy " .. l)
443 -- Buttons switch to that numbered MIDI channel, defaults to 1. 441 -- Buttons switch to that numbered MIDI channel, defaults to 1.
@@ -448,14 +446,14 @@ elseif 'JACK' == args[1] then
448 print("") 446 print("")
449 end 447 end
450 448
451 if _.exists('jack-plumbing') then 449 if _.runnable('jack-plumbing') then
452 print('Stop our jack-plumbing, eventually.') 450 print('Stop our jack-plumbing, eventually.')
453 __('sleep 4'):Do() 451 __'sleep 4':Do()
454 _.killEmAll{"jack-plumbing"} 452 _.killEmAll{"jack-plumbing"}
455 end 453 end
456 454
457 if _.exists('~/.aataaj_JACK.lua') then 455 if _.runnable('~/.aataaj_JACK.lua') then
458 print('Running users aataaj_JACK.lua') 456 print('Running users aataaj_JACK.lua')
459 __('~/.aataaj_JACK.lua'):Do() 457 __'~/.aataaj_JACK.lua':Do()
460 end 458 end
461end 459end