diff options
| author | dvs1 | 2024-10-28 23:46:41 +1000 |
|---|---|---|
| committer | dvs1 | 2024-10-28 23:46:41 +1000 |
| commit | fe9ce9b699f1e1ffc6b7fd77b5d2d462b70b1b14 (patch) | |
| tree | 077c59cc596088d61ee52690d938b28f79831e12 | |
| parent | Let the user pick the best sound device. (diff) | |
| download | JackOnAllDevices-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-x | aataaj.lua | 61 |
1 files changed, 30 insertions, 31 deletions
| @@ -180,42 +180,41 @@ print('') | |||
| 180 | io.flush() | 180 | io.flush() |
| 181 | 181 | ||
| 182 | 182 | ||
| 183 | print('Your ' .. cnt .. ' audio devices are ') | 183 | if 'start' == arg[1] then |
| 184 | for 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) |
| 187 | end | 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. |
| 190 | print('') | 190 | __'sleep 6':Do() |
| 191 | io.flush() | 191 | print('') |
| 192 | for 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() | ||
| 198 | end | ||
| 199 | print('') | ||
| 200 | io.flush() | ||
| 201 | 202 | ||
| 202 | for 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() |
| 205 | end | ||
| 206 | io.write('Please type the device number you heard best - ') | ||
| 207 | 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". | ||
| 208 | local ourCard = '' | ||
| 209 | |||
| 210 | for 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 |
| 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". | ||
| 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 | ||
| 218 | if '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 |
