aboutsummaryrefslogtreecommitdiffstats
path: root/aataaj.lua
diff options
context:
space:
mode:
authordvs12024-10-28 23:46:41 +1000
committerdvs12024-10-28 23:46:41 +1000
commitfe9ce9b699f1e1ffc6b7fd77b5d2d462b70b1b14 (patch)
tree077c59cc596088d61ee52690d938b28f79831e12 /aataaj.lua
parentLet the user pick the best sound device. (diff)
downloadJackOnAllDevices-fe9ce9b699f1e1ffc6b7fd77b5d2d462b70b1b14.zip
JackOnAllDevices-fe9ce9b699f1e1ffc6b7fd77b5d2d462b70b1b14.tar.gz
JackOnAllDevices-fe9ce9b699f1e1ffc6b7fd77b5d2d462b70b1b14.tar.bz2
JackOnAllDevices-fe9ce9b699f1e1ffc6b7fd77b5d2d462b70b1b14.tar.xz
Move the "decide which card" bit to "start".
Diffstat (limited to '')
-rwxr-xr-xaataaj.lua61
1 files changed, 30 insertions, 31 deletions
diff --git a/aataaj.lua b/aataaj.lua
index 9acea95..9df7635 100755
--- a/aataaj.lua
+++ b/aataaj.lua
@@ -180,42 +180,41 @@ print('')
180io.flush() 180io.flush()
181 181
182 182
183print('Your ' .. cnt .. ' audio devices are ') 183if 'start' == arg[1] then
184for k,C in pairs(Cards) do 184 print('Your ' .. cnt .. ' audio devices are ')
185 print('' .. C.card - 1 .. ' : ' .. C.name) 185 for k,C in pairs(Cards) do
186 __('ALSA_CARD=' .. C.card - 1 .. ' ' .. speaker .. ' "Your ' .. cnt .. ' audio devices are "'):log():noErr():noOut():fork() 186 print('' .. C.card - 1 .. ' : ' .. C.name)
187end 187 __ ('ALSA_CARD=' .. C.card - 1 .. ' ' .. speaker .. ' "Your ' .. cnt .. ' audio devices are "'):log():noErr():noOut():fork()
188-- TODO - should do a proper "wait for speakers to finish" here. Have fork(write a file), think that's what :wait(file) does. 188 end
189__'sleep 6':Do() 189 -- TODO - should do a proper "wait for speakers to finish" here. Have fork(write a file), think that's what :wait(file) does.
190print('') 190 __'sleep 6':Do()
191io.flush() 191 print('')
192for k,C in pairs(Cards) do 192 io.flush()
193 print('' .. C.card - 1 .. ' : ' .. C.name) 193 for k,C in pairs(Cards) do
194 __('echo "' .. C.card - 1 .. ' : ' .. C.name .. '"') 194 print('' .. C.card - 1 .. ' : ' .. C.name)
195 __('ALSA_CARD=' .. C.card - 1 .. ' ' .. speaker .. ' "Device number ' .. C.card - 1 .. ' ' .. C.name .. '"'):log():noErr():noOut():Do() 195 __('echo "' .. C.card - 1 .. ' : ' .. C.name .. '"')
196 __('ALSA_CARD=' .. C.card - 1 .. ' ' .. speaker .. ' "Device number ' .. C.card - 1 .. ' ' .. C.name .. '"'):log():noErr():noOut():Do()
197 io.flush()
198 __'sleep 1':Do()
199 end
200 print('')
196 io.flush() 201 io.flush()
197 __'sleep 1':Do()
198end
199print('')
200io.flush()
201 202
202for k,C in pairs(Cards) do 203 for k,C in pairs(Cards) do
203 print('' .. C.card - 1 .. ' : ' .. C.name) 204 print('' .. C.card - 1 .. ' : ' .. C.name)
204 __('ALSA_CARD=' .. C.card - 1 .. ' ' .. speaker .. ' "Please type the device number you heard best."'):log():noErr():noOut():fork() 205 __('ALSA_CARD=' .. C.card - 1 .. ' ' .. speaker .. ' "Please type the device number you heard best."'):log():noErr():noOut():fork()
205end
206io.write('Please type the device number you heard best - ')
207local 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".
208local ourCard = ''
209
210for k,C in pairs(Cards) do
211 if (C.card - 1) == choice then
212 print('You choose ' .. choice .. ' ' .. C.name)
213 ourCard = C.name
214 end 206 end
215end 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".
209 local ourCard = ''
216 210
211 for k,C in pairs(Cards) do
212 if (C.card - 1) == choice then
213 print('You choose ' .. choice .. ' ' .. C.name)
214 ourCard = C.name
215 end
216 end
217 217
218if 'start' == arg[1] then
219 __('mkdir -p ' .. options.asoundrcPath.value):Do() 218 __('mkdir -p ' .. options.asoundrcPath.value):Do()
220 local a, e = io.open(options.asoundrcPath.value .. '/jack-plumbing', 'w') 219 local a, e = io.open(options.asoundrcPath.value .. '/jack-plumbing', 'w')
221 if nil == a then print('Could not open ' .. options.asoundrcPath.value .. '/jack-plumbing - ' .. e) else 220 if nil == a then print('Could not open ' .. options.asoundrcPath.value .. '/jack-plumbing - ' .. e) else