aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xaataaj.lua25
1 files changed, 12 insertions, 13 deletions
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
191 local m = p:match('.*pcm(%d+).*') 191 local m = p:match('.*pcm(%d+).*')
192 Cards[n]['playbackDevs'][j] = m 192 Cards[n]['playbackDevs'][j] = m
193 Cards[n]['devs'][m] = m 193 Cards[n]['devs'][m] = m
194 print('Found playback DEVICE: ' .. Cards[n].card - 1 .. '\tSUB: ' .. m .. ' \t' .. Cards[n]['name']) 194 print('Found playback DEVICE number: ' .. Cards[n].card - 1 .. '\tSUB: ' .. m .. ' \t' .. Cards[n]['name'])
195 if 'JACK' ~= cmd then 195 if 'JACK' ~= cmd then
196-- 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 .. '"') 196-- 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 .. '"')
197-- io.flush() 197-- io.flush()
@@ -202,12 +202,12 @@ for i,l in ipairs(cards.lines) do
202 for k, m in ipairs(__("amixer -c " .. Cards[n].card - 1 .. " scontrols | grep 'IEC958' | cut -d ',' -f 2"):noErr():Do().lines) do 202 for k, m in ipairs(__("amixer -c " .. Cards[n].card - 1 .. " scontrols | grep 'IEC958' | cut -d ',' -f 2"):noErr():Do().lines) do
203 iec = iec .. 'IEC958,' .. m .. ' ' 203 iec = iec .. 'IEC958,' .. m .. ' '
204 end 204 end
205 if '' ~= iec then print('\t\t\t\t' .. iec) end 205-- if '' ~= iec then print('\t\t\t\t' .. iec) end
206 iec = '' 206 iec = ''
207 for k, m in ipairs(__("amixer -c " .. Cards[n].card - 1 .. " controls | grep ' Playback Volume' | cut -d ',' -f 1"):noErr():Do().lines) do 207 for k, m in ipairs(__("amixer -c " .. Cards[n].card - 1 .. " controls | grep ' Playback Volume' | cut -d ',' -f 1"):noErr():Do().lines) do
208 iec = iec .. 'PCM Playback Volume,' .. m .. ' ' 208 iec = iec .. 'PCM Playback Volume,' .. m .. ' '
209 end 209 end
210 if '' ~= iec then print('\t\t\t\t' .. iec) end 210-- if '' ~= iec then print('\t\t\t\t' .. iec) end
211 211
212 end 212 end
213 end 213 end
@@ -217,6 +217,7 @@ print('')
217io.flush() 217io.flush()
218 218
219 219
220print('Your ' .. cnt .. ' audio devices are - ')
220 221
221local speak = function(card, subdevice, device, words, printIt, forkIt, ...) 222local speak = function(card, subdevice, device, words, printIt, forkIt, ...)
222 local files = {...} 223 local files = {...}
@@ -230,9 +231,9 @@ local speak = function(card, subdevice, device, words, printIt, forkIt, ...)
230 s = 'aplay -q --device=hw:' .. device .. subdevice 231 s = 'aplay -q --device=hw:' .. device .. subdevice
231 for i, v in ipairs(files) do s = s .. ' /usr/local/share/doc/aataaj/' .. v .. '.wav' end 232 for i, v in ipairs(files) do s = s .. ' /usr/local/share/doc/aataaj/' .. v .. '.wav' end
232 end 233 end
233 if printIt then print(words .. '\t' .. card) end 234 if printIt then print(words .. '\t' .. card) ; io.flush() end
234 if forkIt then 235 if forkIt then
235 __(s):fork() 236 __(s):noErr():noOut():fork()
236 else 237 else
237 __(s):Do() 238 __(s):Do()
238 end 239 end
@@ -241,7 +242,6 @@ end
241-- TODO - Start with the device, then go through the sub devices. Coz at boot time subs don't seem to work. 242-- TODO - Start with the device, then go through the sub devices. Coz at boot time subs don't seem to work.
242-- Likely that'll lock things up at "all speak at once" time. 243-- Likely that'll lock things up at "all speak at once" time.
243if 'start' == cmd then 244if 'start' == cmd then
244 print('Your ' .. cnt .. ' audio devices are - ')
245 print(' being turned on and volume maxed - ') 245 print(' being turned on and volume maxed - ')
246 for k = 0, cnt do 246 for k = 0, cnt do
247 -- Turn on IEC958 for everything, they seem to default to off, so can't hear them. 247 -- Turn on IEC958 for everything, they seem to default to off, so can't hear them.
@@ -254,7 +254,8 @@ if 'start' == cmd then
254 end 254 end
255 end 255 end
256 256
257 print(' being spoken through all at once - ') 257 print(' being spoken through all at once, then one at a time - ')
258 print('Please type the device number you hear best - ')
258 for k,C in pairs(Cards) do 259 for k,C in pairs(Cards) do
259 for j,c in ipairs(C['playbackDevs']) do 260 for j,c in ipairs(C['playbackDevs']) do
260 speak(C.name, C['playbackDevs'][j], C.card - 1, 'Your ' .. cnt .. ' audio devices are - ', false, true, 'your', numbers[cnt], 'devices') 261 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
262 end 263 end
263 -- TODO - should do a proper "wait for speakers to finish" here. Have fork(write a file), think that's what :wait(file) does. 264 -- TODO - should do a proper "wait for speakers to finish" here. Have fork(write a file), think that's what :wait(file) does.
264 __'sleep 6':Do() 265 __'sleep 6':Do()
265 print(' being spoken through one at a time - ')
266 for k,n in ipairs(Names) do 266 for k,n in ipairs(Names) do
267 C = Cards[n] 267 C = Cards[n]
268 for j,c in ipairs(C['playbackDevs']) do 268 for j,c in ipairs(C['playbackDevs']) do
269 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])]) 269 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])])
270 end 270 end
271 __'sleep 1':Do() 271 __'sleep 1':Do()
272 end 272 end
273 io.flush() 273 io.flush()
274 274
275 print('Please type the device number you heard best - ')
276 for k,C in pairs(Cards) do 275 for k,C in pairs(Cards) do
277 for j,c in ipairs(C['playbackDevs']) do 276 for j,c in ipairs(C['playbackDevs']) do
278 speak(C.name, C['playbackDevs'][j], C.card - 1, 'Please type the device number you heard best - ', false, true, 'best') 277 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
512 print('Basic ALSA sound devices converted to JACK.') 511 print('Basic ALSA sound devices converted to JACK.')
513 for k,C in pairs(options.aliases.value) do 512 for k,C in pairs(options.aliases.value) do
514 print('HW playback: ' .. C['name'] .. '\tDEVICE: ' .. C['dev']) 513 print('HW playback: ' .. C['name'] .. '\tDEVICE: ' .. C['dev'])
515 __(AOUT .. ' -j ' .. C['name'] .. ' -d ' .. C['dev']):fork() 514 __(AOUT .. ' -j ' .. C['name'] .. ' -d ' .. C['dev']):noOut():noErr():fork()
516 end 515 end
517 print('HW playback: cloop\tDEVICE: cloop') 516 print('HW playback: cloop\tDEVICE: cloop')
518 -- No idea why, cloop wont work with zita-a2j. 517 -- No idea why, cloop wont work with zita-a2j.
519 __'alsa_in -j cloop -d cloop':fork() 518 __'alsa_in -j cloop -d cloop':noOut():noErr():fork()
520 --__[[sleep 1 519 --__[[sleep 1
521 -- jack_connect cloop:capture_1 system:playback_1o() 520 -- jack_connect cloop:capture_1 system:playback_1o()
522 -- jack_connect cloop:capture_2 system:playback_2]]:Do() 521 -- jack_connect cloop:capture_2 system:playback_2]]:Do()
523 print('HW playback: ploop\tDEVICE: ploop') 522 print('HW playback: ploop\tDEVICE: ploop')
524 __'alsa_out -j ploop -d ploop':fork() 523 __'alsa_out -j ploop -d ploop':noOut():noErr():fork()
525 --__[[sleep 1 524 --__[[sleep 1
526 -- jack_connect system:capture_1 ploop:playback_1 525 -- jack_connect system:capture_1 ploop:playback_1
527 -- jack_connect system:capture_2 ploop:playback_2]]:Do() 526 -- jack_connect system:capture_2 ploop:playback_2]]:Do()