diff options
author | dvs1 | 2024-10-31 16:02:35 +1000 |
---|---|---|
committer | dvs1 | 2024-10-31 16:02:35 +1000 |
commit | 9074acbb4f6e40638416f4561ab61fb187145243 (patch) | |
tree | 5c760437086847e07a4f24d5c3f287b2a1a56a62 /aataaj.lua | |
parent | Start up jack-plumbing in the example. (diff) | |
download | JackOnAllDevices-9074acbb4f6e40638416f4561ab61fb187145243.zip JackOnAllDevices-9074acbb4f6e40638416f4561ab61fb187145243.tar.gz JackOnAllDevices-9074acbb4f6e40638416f4561ab61fb187145243.tar.bz2 JackOnAllDevices-9074acbb4f6e40638416f4561ab61fb187145243.tar.xz |
Move the espeak stuff into it's own function, might help get it to behave.
So far, got partial behaviour, seems to have stopped pausing rest of
scripts text output until script end.
Diffstat (limited to 'aataaj.lua')
-rwxr-xr-x | aataaj.lua | 32 |
1 files changed, 20 insertions, 12 deletions
@@ -180,31 +180,39 @@ print('') | |||
180 | io.flush() | 180 | io.flush() |
181 | 181 | ||
182 | 182 | ||
183 | local speak = function(card, subdevice, device, words, printIt, forkIt) | ||
184 | if printIt then print(words) end | ||
185 | if forkIt then | ||
186 | __('#!/bin/bash\necho "' .. words .. '" | ' .. speaker .. ' -d ' .. card .. subdevice):noErr():noOut():fork() | ||
187 | else | ||
188 | __('#!/bin/bash\necho "' .. words .. '" | ' .. speaker .. ' -d ' .. card .. subdevice):noErr():noOut():Do() | ||
189 | end | ||
190 | -- io.flush() | ||
191 | end | ||
192 | |||
183 | if 'start' == arg[1] then | 193 | if 'start' == arg[1] then |
184 | print('Your ' .. cnt .. ' audio devices are ') | 194 | print('Your ' .. cnt .. ' audio devices are ') |
185 | for k,C in pairs(Cards) do | 195 | for k,C in pairs(Cards) do |
186 | print('' .. C.card - 1 .. ' : ' .. C.name) | 196 | for j,c in ipairs(C['playbackDevs']) do |
187 | __ ('ALSA_CARD=' .. C.card - 1 .. ' ' .. speaker .. ' "Your ' .. cnt .. ' audio devices are "'):log():noErr():noOut():fork() | 197 | speak(C.name, C['playbackDevs'][j], C.card - 1, 'Your ' .. cnt .. ' audio devices are - ', false, true) |
198 | end | ||
188 | end | 199 | end |
189 | -- TODO - should do a proper "wait for speakers to finish" here. Have fork(write a file), think that's what :wait(file) does. | 200 | -- TODO - should do a proper "wait for speakers to finish" here. Have fork(write a file), think that's what :wait(file) does. |
190 | __'sleep 6':Do() | 201 | __'sleep 6':Do() |
191 | print('') | ||
192 | io.flush() | ||
193 | for k,C in pairs(Cards) do | 202 | for k,C in pairs(Cards) do |
194 | print('' .. C.card - 1 .. ' : ' .. C.name) | 203 | for j,c in ipairs(C['playbackDevs']) do |
195 | __('echo "' .. C.card - 1 .. ' : ' .. C.name .. '"') | 204 | speak(C.name, C['playbackDevs'][j], C.card - 1, 'Device number ' .. C.card - 1 .. ', ' .. C['playbackDevs'][j] .. ' : ' .. C.name, true, false) |
196 | __('ALSA_CARD=' .. C.card - 1 .. ' ' .. speaker .. ' "Device number ' .. C.card - 1 .. ' ' .. C.name .. '"'):log():noErr():noOut():Do() | 205 | end |
197 | io.flush() | ||
198 | __'sleep 1':Do() | 206 | __'sleep 1':Do() |
199 | end | 207 | end |
200 | print('') | ||
201 | io.flush() | 208 | io.flush() |
202 | 209 | ||
210 | print('Please type the device number you heard best - ') | ||
203 | for k,C in pairs(Cards) do | 211 | for k,C in pairs(Cards) do |
204 | print('' .. C.card - 1 .. ' : ' .. C.name) | 212 | for j,c in ipairs(C['playbackDevs']) do |
205 | __('ALSA_CARD=' .. C.card - 1 .. ' ' .. speaker .. ' "Please type the device number you heard best."'):log():noErr():noOut():fork() | 213 | speak(C.name, C['playbackDevs'][j], C.card - 1, 'Please type the device number you heard best - ', false, true) |
214 | end | ||
206 | end | 215 | end |
207 | io.write('Please type the device number you heard best - ') | ||
208 | local choice = tonumber(io.read()) -- Lua has no way of just checking IF there is ANY input, so can't do "check if there was a keypress, continue if not". | 216 | local choice = tonumber(io.read()) -- Lua has no way of just checking IF there is ANY input, so can't do "check if there was a keypress, continue if not". |
209 | local ourCard = '' | 217 | local ourCard = '' |
210 | 218 | ||