aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordvs12024-10-31 16:03:33 +1000
committerdvs12024-10-31 16:03:33 +1000
commit6090a26f174a0380450884496a5463171600d25a (patch)
tree94766d56dadabf5a8caa4f2a2a18dc80203cb2e9
parentLanguage cleanup. (diff)
downloadJackOnAllDevices-6090a26f174a0380450884496a5463171600d25a.zip
JackOnAllDevices-6090a26f174a0380450884496a5463171600d25a.tar.gz
JackOnAllDevices-6090a26f174a0380450884496a5463171600d25a.tar.bz2
JackOnAllDevices-6090a26f174a0380450884496a5463171600d25a.tar.xz
Filter out non audio devices and Loopback type things.
Diffstat (limited to '')
-rwxr-xr-xaataaj.lua48
1 files changed, 26 insertions, 22 deletions
diff --git a/aataaj.lua b/aataaj.lua
index 99cf9ff..5f043a7 100755
--- a/aataaj.lua
+++ b/aataaj.lua
@@ -147,29 +147,33 @@ print('Scanning for audio devices.')
147local cards = __'ls -d1 /proc/asound/card[0-9]*':noErr():Do() 147local cards = __'ls -d1 /proc/asound/card[0-9]*':noErr():Do()
148for i,l in ipairs(cards.lines) do 148for i,l in ipairs(cards.lines) do
149 local f, e = io.open(l .. '/id', 'r') 149 local f, e = io.open(l .. '/id', 'r')
150 local g, h = io.open(l .. '/codec#0', 'r') -- Test to see if it's a real audio device. I think this is a real test. lol
151 local a, b = io.open(l .. '/stream0', 'r') -- Test to see if it's a real audio device. I think this is a real test. lol
150 if nil == f then print('Could not open ' .. l .. '/id - ' .. e) else 152 if nil == f then print('Could not open ' .. l .. '/id - ' .. e) else
151 local n = f:read('*a'):sub(1, -2) 153 if (nil ~= g) or (nil ~= a) then
152 Cards[n] = {path = l, name = n, devs = {}, captureDevs = {}, playbackDevs = {}, card=i} 154 local n = f:read('*a'):sub(1, -2)
153 cnt = cnt + 1 155 Cards[n] = {path = l, name = n, devs = {}, captureDevs = {}, playbackDevs = {}, card=i}
154 if 'Loopback' ~= Cards[n]['name'] then 156 cnt = cnt + 1
155 Cards[n]['capture'] = __('ls -d1 ' .. l .. '/pcm[0-9]*c*'):noErr():Do() 157 if 'Loopback' ~= Cards[n]['name'] then
156 for j,c in ipairs(Cards[n]['capture'].lines) do 158 Cards[n]['capture'] = __('ls -d1 ' .. l .. '/pcm[0-9]*c*'):noErr():Do()
157 local m = c:match('.*pcm(%d+).*') 159 for j,c in ipairs(Cards[n]['capture'].lines) do
158 Cards[n]['captureDevs'][j] = m 160 local m = c:match('.*pcm(%d+).*')
159 Cards[n]['devs'][m] = m 161 Cards[n]['captureDevs'][j] = m
160 print('\tFound capture device: ' .. Cards[n]['name'] .. '\tDEVICE: ' .. Cards[n]['captureDevs'][j] .. ' ' .. m) 162 Cards[n]['devs'][m] = m
161 io.flush() 163 print('\tFound capture device: ' .. Cards[n]['name'] .. '\tDEVICE: ' .. Cards[n]['captureDevs'][j] .. ' ' .. m)
162 end 164-- io.flush()
163 Cards[n]['playback'] = __('ls -d1 ' .. l .. '/pcm[0-9]*p*'):noErr():Do() 165 end
164 for j,p in ipairs(Cards[n]['playback'].lines) do 166 Cards[n]['playback'] = __('ls -d1 ' .. l .. '/pcm[0-9]*p*'):noErr():Do()
165 local m = p:match('.*pcm(%d+).*') 167 for j,p in ipairs(Cards[n]['playback'].lines) do
166 Cards[n]['playbackDevs'][j] = m 168 local m = p:match('.*pcm(%d+).*')
167 Cards[n]['devs'][m] = m 169 Cards[n]['playbackDevs'][j] = m
168 print('\tFound playback device ' .. Cards[n].card - 1 .. ' : ' .. Cards[n]['name'] .. '\tDEVICE: ' .. Cards[n]['playbackDevs'][j] .. ' ' .. m) 170 Cards[n]['devs'][m] = m
169 io.flush() 171 print('\tFound playback device ' .. Cards[n].card - 1 .. ' : ' .. Cards[n]['name'] .. '\tDEVICE: ' .. Cards[n]['playbackDevs'][j] .. ' ' .. m)
170 if 'JACK' ~= arg[1] then 172-- io.flush()
171 print('\t\tALSA_CARD=' .. Cards[n].card - 1 .. ' ' .. speaker .. ' "Found playback device ' .. Cards[n].card - 1 .. ' : ' .. Cards[n]['name'] .. ' DEVICE: ' .. Cards[n]['playbackDevs'][j] .. ' ' .. m .. '"') 173 if 'JACK' ~= arg[1] then
172 io.flush() 174-- print('\t\tALSA_CARD=' .. Cards[n].card - 1 .. ' ' .. speaker .. ' "Found playback device ' .. Cards[n].card - 1 .. ' : ' .. Cards[n]['name'] .. ' DEVICE: ' .. Cards[n]['playbackDevs'][j] .. ' ' .. m .. '"')
175-- io.flush()
176 end
173 end 177 end
174 end 178 end
175 end 179 end