From 6df5dcc44a08bea867297ef740b457b99e3ca12e Mon Sep 17 00:00:00 2001 From: dvs1 Date: Fri, 21 Nov 2025 16:18:22 +1000 Subject: Properly sort them. --- aataaj.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/aataaj.lua b/aataaj.lua index b2ea50c..2c6058d 100755 --- a/aataaj.lua +++ b/aataaj.lua @@ -162,6 +162,7 @@ if _.runnable('espeak-ng') then speaker = 'espeak-ng' end local numbers = {[0]='zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen'} +local Names = {} local Cards = {} local cnt = 0 @@ -176,6 +177,7 @@ for i,l in ipairs(cards.lines) do local n = f:read('*a'):sub(1, -2) Cards[n] = {path = l, name = n, devs = {}, captureDevs = {}, playbackDevs = {}, card=i} cnt = cnt + 1 + Names[cnt] = n if 'Loopback' ~= Cards[n]['name'] then Cards[n]['capture'] = __('ls -d1 ' .. l .. '/pcm[0-9]*c*'):noErr():Do() for j,c in ipairs(Cards[n]['capture'].lines) do @@ -213,7 +215,7 @@ for i,l in ipairs(cards.lines) do end end end -table.sort(Cards, function(a, b) return a.card < b.card end) +--table.sort(Cards, function(a, b) return a.card < b.card end) print('') io.flush() @@ -268,8 +270,9 @@ print(' being spoken through all at once - ') 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() - for k,C in pairs(Cards) 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, nil, 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])]) 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])]) -- cgit v1.1