From e516143e8bcd0132e30f99a18bb0f50541402507 Mon Sep 17 00:00:00 2001 From: onefang Date: Wed, 13 May 2026 08:53:23 +1000 Subject: Attempts to get it working on boot. --- aataaj.lua | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'aataaj.lua') diff --git a/aataaj.lua b/aataaj.lua index 9542fa6..3518871 100755 --- a/aataaj.lua +++ b/aataaj.lua @@ -191,7 +191,7 @@ for i,l in ipairs(cards.lines) do local m = p:match('.*pcm(%d+).*') Cards[n]['playbackDevs'][j] = m Cards[n]['devs'][m] = m - print('Found playback DEVICE: ' .. Cards[n].card - 1 .. '\tSUB: ' .. m .. ' \t' .. Cards[n]['name']) + print('Found playback DEVICE number: ' .. Cards[n].card - 1 .. '\tSUB: ' .. m .. ' \t' .. Cards[n]['name']) if 'JACK' ~= cmd then -- print('\t\tALSA_CARD=' .. Cards[n].card - 1 .. ' ' .. speaker .. ' "Found playback device ' .. Cards[n].card - 1 .. ' : ' .. Cards[n]['name'] .. ' DEVICE: ' .. Cards[n]['playbackDevs'][j] .. ' ' .. m .. '"') -- io.flush() @@ -202,12 +202,12 @@ for i,l in ipairs(cards.lines) do for k, m in ipairs(__("amixer -c " .. Cards[n].card - 1 .. " scontrols | grep 'IEC958' | cut -d ',' -f 2"):noErr():Do().lines) do iec = iec .. 'IEC958,' .. m .. ' ' end - if '' ~= iec then print('\t\t\t\t' .. iec) end +-- if '' ~= iec then print('\t\t\t\t' .. iec) end iec = '' for k, m in ipairs(__("amixer -c " .. Cards[n].card - 1 .. " controls | grep ' Playback Volume' | cut -d ',' -f 1"):noErr():Do().lines) do iec = iec .. 'PCM Playback Volume,' .. m .. ' ' end - if '' ~= iec then print('\t\t\t\t' .. iec) end +-- if '' ~= iec then print('\t\t\t\t' .. iec) end end end @@ -217,6 +217,7 @@ print('') io.flush() +print('Your ' .. cnt .. ' audio devices are - ') local speak = function(card, subdevice, device, words, printIt, forkIt, ...) local files = {...} @@ -230,9 +231,9 @@ local speak = function(card, subdevice, device, words, printIt, forkIt, ...) s = 'aplay -q --device=hw:' .. device .. subdevice for i, v in ipairs(files) do s = s .. ' /usr/local/share/doc/aataaj/' .. v .. '.wav' end end - if printIt then print(words .. '\t' .. card) end + if printIt then print(words .. '\t' .. card) ; io.flush() end if forkIt then - __(s):fork() + __(s):noErr():noOut():fork() else __(s):Do() end @@ -241,7 +242,6 @@ end -- TODO - Start with the device, then go through the sub devices. Coz at boot time subs don't seem to work. -- Likely that'll lock things up at "all speak at once" time. if 'start' == cmd then - print('Your ' .. cnt .. ' audio devices are - ') print(' being turned on and volume maxed - ') for k = 0, cnt do -- Turn on IEC958 for everything, they seem to default to off, so can't hear them. @@ -254,7 +254,8 @@ if 'start' == cmd then end end - print(' being spoken through all at once - ') + print(' being spoken through all at once, then one at a time - ') + print('Please type the device number you hear best - ') for k,C in pairs(Cards) do for j,c in ipairs(C['playbackDevs']) do speak(C.name, C['playbackDevs'][j], C.card - 1, 'Your ' .. cnt .. ' audio devices are - ', false, true, 'your', numbers[cnt], 'devices') @@ -262,17 +263,15 @@ if 'start' == cmd then end -- TODO - should do a proper "wait for speakers to finish" here. Have fork(write a file), think that's what :wait(file) does. __'sleep 6':Do() - print(' being spoken through one at a time - ') for k,n in ipairs(Names) do C = Cards[n] for j,c in ipairs(C['playbackDevs']) do - speak(C.name, C['playbackDevs'][j], C.card - 1, 'Device number ' .. C.card - 1 .. ', sub device ' .. C['playbackDevs'][j], true, false, 'device', numbers[C.card - 1], 'sub', numbers[tonumber(C['playbackDevs'][j])]) + speak(C.name, C['playbackDevs'][j], C.card - 1, 'Device number ' .. C.card - 1 .. ', sub device ' .. C['playbackDevs'][j], false, false, 'device', numbers[C.card - 1], 'sub', numbers[tonumber(C['playbackDevs'][j])]) end __'sleep 1':Do() end io.flush() - print('Please type the device number you heard best - ') for k,C in pairs(Cards) do for j,c in ipairs(C['playbackDevs']) do speak(C.name, C['playbackDevs'][j], C.card - 1, 'Please type the device number you heard best - ', false, true, 'best') @@ -512,16 +511,16 @@ elseif 'JACK' == cmd then print('Basic ALSA sound devices converted to JACK.') for k,C in pairs(options.aliases.value) do print('HW playback: ' .. C['name'] .. '\tDEVICE: ' .. C['dev']) - __(AOUT .. ' -j ' .. C['name'] .. ' -d ' .. C['dev']):fork() + __(AOUT .. ' -j ' .. C['name'] .. ' -d ' .. C['dev']):noOut():noErr():fork() end print('HW playback: cloop\tDEVICE: cloop') -- No idea why, cloop wont work with zita-a2j. - __'alsa_in -j cloop -d cloop':fork() + __'alsa_in -j cloop -d cloop':noOut():noErr():fork() --__[[sleep 1 -- jack_connect cloop:capture_1 system:playback_1o() -- jack_connect cloop:capture_2 system:playback_2]]:Do() print('HW playback: ploop\tDEVICE: ploop') - __'alsa_out -j ploop -d ploop':fork() + __'alsa_out -j ploop -d ploop':noOut():noErr():fork() --__[[sleep 1 -- jack_connect system:capture_1 ploop:playback_1 -- jack_connect system:capture_2 ploop:playback_2]]:Do() -- cgit v1.1