aboutsummaryrefslogtreecommitdiffstats
path: root/aataaj.lua
diff options
context:
space:
mode:
authordvs12025-11-21 16:18:22 +1000
committerdvs12025-11-21 16:18:22 +1000
commit6df5dcc44a08bea867297ef740b457b99e3ca12e (patch)
treef49b9cc912917a50b3d97914a4e6ab81553d4436 /aataaj.lua
parentTurn on all devices and set volume to max. (diff)
downloadJackOnAllDevices-6df5dcc44a08bea867297ef740b457b99e3ca12e.zip
JackOnAllDevices-6df5dcc44a08bea867297ef740b457b99e3ca12e.tar.gz
JackOnAllDevices-6df5dcc44a08bea867297ef740b457b99e3ca12e.tar.bz2
JackOnAllDevices-6df5dcc44a08bea867297ef740b457b99e3ca12e.tar.xz
Properly sort them.
Diffstat (limited to '')
-rwxr-xr-xaataaj.lua7
1 files 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
162local numbers = {[0]='zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen'} 162local numbers = {[0]='zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen'}
163 163
164 164
165local Names = {}
165local Cards = {} 166local Cards = {}
166local cnt = 0 167local cnt = 0
167 168
@@ -176,6 +177,7 @@ for i,l in ipairs(cards.lines) do
176 local n = f:read('*a'):sub(1, -2) 177 local n = f:read('*a'):sub(1, -2)
177 Cards[n] = {path = l, name = n, devs = {}, captureDevs = {}, playbackDevs = {}, card=i} 178 Cards[n] = {path = l, name = n, devs = {}, captureDevs = {}, playbackDevs = {}, card=i}
178 cnt = cnt + 1 179 cnt = cnt + 1
180 Names[cnt] = n
179 if 'Loopback' ~= Cards[n]['name'] then 181 if 'Loopback' ~= Cards[n]['name'] then
180 Cards[n]['capture'] = __('ls -d1 ' .. l .. '/pcm[0-9]*c*'):noErr():Do() 182 Cards[n]['capture'] = __('ls -d1 ' .. l .. '/pcm[0-9]*c*'):noErr():Do()
181 for j,c in ipairs(Cards[n]['capture'].lines) do 183 for j,c in ipairs(Cards[n]['capture'].lines) do
@@ -213,7 +215,7 @@ for i,l in ipairs(cards.lines) do
213 end 215 end
214 end 216 end
215end 217end
216table.sort(Cards, function(a, b) return a.card < b.card end) 218--table.sort(Cards, function(a, b) return a.card < b.card end)
217print('') 219print('')
218io.flush() 220io.flush()
219 221
@@ -268,8 +270,9 @@ print(' being spoken through all at once - ')
268 end 270 end
269 -- TODO - should do a proper "wait for speakers to finish" here. Have fork(write a file), think that's what :wait(file) does. 271 -- TODO - should do a proper "wait for speakers to finish" here. Have fork(write a file), think that's what :wait(file) does.
270 __'sleep 6':Do() 272 __'sleep 6':Do()
271 for k,C in pairs(Cards) do
272print(' being spoken through one at a time - ') 273print(' being spoken through one at a time - ')
274 for k,n in ipairs(Names) do
275 C = Cards[n]
273 for j,c in ipairs(C['playbackDevs']) do 276 for j,c in ipairs(C['playbackDevs']) do
274---- 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])]) 277---- 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])])
275 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])]) 278 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])])