diff options
author | dvs1 | 2024-11-10 14:27:16 +1000 |
---|---|---|
committer | dvs1 | 2024-11-10 14:27:16 +1000 |
commit | adc24941a191ab266b39aed347c1544d0ce78527 (patch) | |
tree | 4a9debbdbd81b6568c14e4dc85e4fcf6e5092bb5 | |
parent | Shut up some spam. (diff) | |
download | JackOnAllDevices-adc24941a191ab266b39aed347c1544d0ce78527.zip JackOnAllDevices-adc24941a191ab266b39aed347c1544d0ce78527.tar.gz JackOnAllDevices-adc24941a191ab266b39aed347c1544d0ce78527.tar.bz2 JackOnAllDevices-adc24941a191ab266b39aed347c1544d0ce78527.tar.xz |
Yet another failed attempt to get ALSA sub devices to work at boot time.
-rwxr-xr-x | aataaj.lua | 54 |
1 files changed, 43 insertions, 11 deletions
@@ -84,6 +84,30 @@ local options = | |||
84 | update-rc.d aataaj.lua defaults | 84 | update-rc.d aataaj.lua defaults |
85 | mkdir -p /usr/local/share/doc/aataaj | 85 | mkdir -p /usr/local/share/doc/aataaj |
86 | ln -s `pwd`/*.md /usr/local/share/doc/aataaj/ | 86 | ln -s `pwd`/*.md /usr/local/share/doc/aataaj/ |
87 | pushd /usr/local/share/doc/aataaj | ||
88 | espeak-ng -w your.wav "Your " | ||
89 | espeak-ng -w devices.wav " audio devices are - " | ||
90 | espeak-ng -w device.wav "Device number " | ||
91 | espeak-ng -w sub.wav ", sub device " | ||
92 | espeak-ng -w zero.wav "zero" | ||
93 | espeak-ng -w one.wav "one" | ||
94 | espeak-ng -w two.wav "two" | ||
95 | espeak-ng -w three.wav "three" | ||
96 | espeak-ng -w four.wav "four" | ||
97 | espeak-ng -w five.wav "five" | ||
98 | espeak-ng -w six.wav "six" | ||
99 | espeak-ng -w seven.wav "seven" | ||
100 | espeak-ng -w eight.wav "eight" | ||
101 | espeak-ng -w nine.wav "nine" | ||
102 | espeak-ng -w ten.wav "ten" | ||
103 | espeak-ng -w eleven.wav "eleven" | ||
104 | espeak-ng -w twelve.wav "twelve" | ||
105 | espeak-ng -w thirteen.wav "thirteen" | ||
106 | espeak-ng -w fourteen.wav "fourteen" | ||
107 | espeak-ng -w fifteen.wav "fifteen" | ||
108 | espeak-ng -w sixteen.wav "sixteen" | ||
109 | espeak-ng -w best.wav "Please type the device number you heard best - " | ||
110 | popd | ||
87 | ]]:log():show():Do() | 111 | ]]:log():show():Do() |
88 | end | 112 | end |
89 | os.exit(0) | 113 | os.exit(0) |
@@ -130,6 +154,7 @@ if _.runnable('catia') then GUI = 'catia' end | |||
130 | local speaker = 'espeak' | 154 | local speaker = 'espeak' |
131 | if _.runnable('espeak-ng') then speaker = 'espeak-ng' end | 155 | if _.runnable('espeak-ng') then speaker = 'espeak-ng' end |
132 | 156 | ||
157 | local numbers = {[0]='zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen'} | ||
133 | 158 | ||
134 | 159 | ||
135 | local Cards = {} | 160 | local Cards = {} |
@@ -176,14 +201,21 @@ print('') | |||
176 | io.flush() | 201 | io.flush() |
177 | 202 | ||
178 | 203 | ||
179 | local speak = function(card, subdevice, device, words, printIt, forkIt) | 204 | local speak = function(card, subdevice, device, words, printIt, forkIt, ...) |
180 | local file = os.tmpname() .. '.wav' | 205 | local files = {...} |
181 | D('Creating temporary script file at ' .. file) | 206 | local s = '' |
182 | -- local s = '#!/bin/bash\necho "' .. words .. '" | ALSA_CARD=' .. device .. ' ' .. speaker | 207 | if 0 == #files then |
183 | -- local s = '#!/bin/bash\necho "' .. words .. '" | ' .. speaker .. ' -d hw:' .. device .. ',' .. subdevice | 208 | local file = os.tmpname() .. '.wav' |
184 | local s = '#!/bin/bash\n' .. speaker .. ' -d hw:' .. device .. ',' .. subdevice .. ' "' .. words .. '"' | 209 | D('Creating temporary script file at ' .. file) |
185 | -- local s = '#!/bin/bash\necho "' .. words .. '" | ' .. speaker .. ' -w ' .. file .. ' ; aplay --device=hw:' .. device .. ',' .. subdevice .. ' ' .. file | 210 | -- s = '#!/bin/bash\necho "' .. words .. '" | ALSA_CARD=' .. device .. ' ' .. speaker |
186 | -- local s = '#!/bin/bash\n' .. speaker .. ' -w ' .. file .. ' "' .. words .. '" ; aplay --device=hw:' .. device .. ',' .. subdevice .. ' ' .. file | 211 | -- s = '#!/bin/bash\necho "' .. words .. '" | ' .. speaker .. ' -d hw:' .. device .. ',' .. subdevice |
212 | s = '#!/bin/bash\n' .. speaker .. ' -d hw:' .. device .. ',' .. subdevice .. ' "' .. words .. '"' | ||
213 | -- s = '#!/bin/bash\necho "' .. words .. '" | ' .. speaker .. ' -w ' .. file .. ' ; aplay --device=hw:' .. device .. ',' .. subdevice .. ' ' .. file | ||
214 | -- s = '#!/bin/bash\n' .. speaker .. ' -w ' .. file .. ' "' .. words .. '" ; aplay --device=hw:' .. device .. ',' .. subdevice .. ' ' .. file | ||
215 | else | ||
216 | s = 'aplay --device=hw:' .. device .. ',' .. subdevice | ||
217 | for i, v in ipairs(files) do s = s .. ' ' .. v .. '.wav' end | ||
218 | end | ||
187 | print(s) | 219 | print(s) |
188 | if printIt then print(words) end | 220 | if printIt then print(words) end |
189 | if forkIt then | 221 | if forkIt then |
@@ -198,14 +230,14 @@ if 'start' == cmd then | |||
198 | print('Your ' .. cnt .. ' audio devices are - ') | 230 | print('Your ' .. cnt .. ' audio devices are - ') |
199 | for k,C in pairs(Cards) do | 231 | for k,C in pairs(Cards) do |
200 | for j,c in ipairs(C['playbackDevs']) do | 232 | for j,c in ipairs(C['playbackDevs']) do |
201 | speak(C.name, C['playbackDevs'][j], C.card - 1, 'Your ' .. cnt .. ' audio devices are - ', false, true) | 233 | speak(C.name, C['playbackDevs'][j], C.card - 1, 'Your ' .. cnt .. ' audio devices are - ', false, true, 'your', numbers[cnt], 'devices') |
202 | end | 234 | end |
203 | end | 235 | end |
204 | -- TODO - should do a proper "wait for speakers to finish" here. Have fork(write a file), think that's what :wait(file) does. | 236 | -- TODO - should do a proper "wait for speakers to finish" here. Have fork(write a file), think that's what :wait(file) does. |
205 | __'sleep 6':Do() | 237 | __'sleep 6':Do() |
206 | for k,C in pairs(Cards) do | 238 | for k,C in pairs(Cards) do |
207 | for j,c in ipairs(C['playbackDevs']) do | 239 | for j,c in ipairs(C['playbackDevs']) do |
208 | speak(C.name, C['playbackDevs'][j], C.card - 1, 'Device number ' .. C.card - 1 .. ', sub device ' .. C['playbackDevs'][j] .. ' : ' .. C.name, true, false) | 240 | speak(C.name, C['playbackDevs'][j], C.card - 1, 'Device number ' .. C.card - 1 .. ', sub device ' .. C['playbackDevs'][j] .. ' : ' .. C.name, true, false, 'device', numbers[C.card - 1], 'sub', numbers[tonumber(C['playbackDevs'][j])]) |
209 | end | 241 | end |
210 | __'sleep 1':Do() | 242 | __'sleep 1':Do() |
211 | end | 243 | end |
@@ -214,7 +246,7 @@ if 'start' == cmd then | |||
214 | print('Please type the device number you heard best - ') | 246 | print('Please type the device number you heard best - ') |
215 | for k,C in pairs(Cards) do | 247 | for k,C in pairs(Cards) do |
216 | for j,c in ipairs(C['playbackDevs']) do | 248 | for j,c in ipairs(C['playbackDevs']) do |
217 | speak(C.name, C['playbackDevs'][j], C.card - 1, 'Please type the device number you heard best - ', false, true) | 249 | speak(C.name, C['playbackDevs'][j], C.card - 1, 'Please type the device number you heard best - ', false, true, 'best') |
218 | end | 250 | end |
219 | end | 251 | end |
220 | 252 | ||