diff options
author | dvs1 | 2024-10-28 10:30:16 +1000 |
---|---|---|
committer | dvs1 | 2024-10-28 10:30:16 +1000 |
commit | 4edd85aa8156150f1fa7a3026a922b49366b642d (patch) | |
tree | b2beaa4eb8a4396a9688d33ebed744b01145ca02 | |
parent | Allow -abc style, expand to -a -b -c, and can put -- in front of any option. (diff) | |
download | JackOnAllDevices-4edd85aa8156150f1fa7a3026a922b49366b642d.zip JackOnAllDevices-4edd85aa8156150f1fa7a3026a922b49366b642d.tar.gz JackOnAllDevices-4edd85aa8156150f1fa7a3026a922b49366b642d.tar.bz2 JackOnAllDevices-4edd85aa8156150f1fa7a3026a922b49366b642d.tar.xz |
Consistantly use single quotes for Lua strings, unless otherwise needed.
Old habits die hard. lol
-rwxr-xr-x | PolygLua.lua | 38 | ||||
-rwxr-xr-x | aataaj.lua | 92 | ||||
-rwxr-xr-x | test_.lua | 12 |
3 files changed, 71 insertions, 71 deletions
diff --git a/PolygLua.lua b/PolygLua.lua index ed14fc5..ee775eb 100755 --- a/PolygLua.lua +++ b/PolygLua.lua | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | --[[ PolygLua. Gluing things onto Lua, making it a polyglot language. | 3 | --[[ PolygLua. Gluing things onto Lua, making it a polyglot language. |
4 | 4 | ||
5 | TODO - Make the parsing recursive. So the command "--fancy" could have it's own options table. | 5 | TODO - Make the parsing recursive. So the command '--fancy' could have it's own options table. |
6 | --fancy option0 opt1=foo 'Random string!' --somethingElse | 6 | --fancy option0 opt1=foo 'Random string!' --somethingElse |
7 | When to stop and hand back? First time we see a ' -bar' or ' --foo'? | 7 | When to stop and hand back? First time we see a ' -bar' or ' --foo'? |
8 | 8 | ||
@@ -23,8 +23,8 @@ _.version = '0.0 crap' | |||
23 | _.verbosity = 2 | 23 | _.verbosity = 2 |
24 | local log = function(v, t, s) | 24 | local log = function(v, t, s) |
25 | if v <= _.verbosity then | 25 | if v <= _.verbosity then |
26 | if 3 <= _.verbosity then t = os.date('!%F %T') .. " " .. t end | 26 | if 3 <= _.verbosity then t = os.date('!%F %T') .. ' ' .. t end |
27 | print(t .. ": " .. s) | 27 | print(t .. ': ' .. s) |
28 | end | 28 | end |
29 | io.flush() | 29 | io.flush() |
30 | end | 30 | end |
@@ -106,7 +106,7 @@ _.parse = function(args, options, confFile) | |||
106 | if nil ~= confFile then | 106 | if nil ~= confFile then |
107 | for i,v in ipairs{'/etc/', '~/.', './.'} do | 107 | for i,v in ipairs{'/etc/', '~/.', './.'} do |
108 | local p = v .. confFile .. '.conf.lua' | 108 | local p = v .. confFile .. '.conf.lua' |
109 | local h, e = io.open(p, "r") | 109 | local h, e = io.open(p, 'r') |
110 | if nil ~= h then | 110 | if nil ~= h then |
111 | D('Found configuration file '.. p) | 111 | D('Found configuration file '.. p) |
112 | h:close() | 112 | h:close() |
@@ -124,7 +124,7 @@ _.parse = function(args, options, confFile) | |||
124 | local ds = 0 | 124 | local ds = 0 |
125 | if ('-' == a:sub(1, 1)) and ('-' ~= a:sub(2, 2)) then ds = 1 end | 125 | if ('-' == a:sub(1, 1)) and ('-' ~= a:sub(2, 2)) then ds = 1 end |
126 | if '--' == a:sub(1, 2) then ds = 2; a = a:sub(3, -1) end | 126 | if '--' == a:sub(1, 2) then ds = 2; a = a:sub(3, -1) end |
127 | local s, e = a:find("=") | 127 | local s, e = a:find('=') |
128 | local k , v | 128 | local k , v |
129 | if nil == s then | 129 | if nil == s then |
130 | e = 0 | 130 | e = 0 |
@@ -154,11 +154,11 @@ _.runnable = function(c) | |||
154 | end | 154 | end |
155 | 155 | ||
156 | _.running = function(c) | 156 | _.running = function(c) |
157 | return ( 1 ~= tonumber(__("pgrep -u $USER -cf " .. c):Do().lines[1]) ) | 157 | return ( 1 ~= tonumber(__('pgrep -u $USER -cf ' .. c):Do().lines[1]) ) |
158 | end | 158 | end |
159 | 159 | ||
160 | _.exists = function(f) | 160 | _.exists = function(f) |
161 | local h, e = io.open(f, "r") | 161 | local h, e = io.open(f, 'r') |
162 | if nil == h then return false else h:close(); return true end | 162 | if nil == h then return false else h:close(); return true end |
163 | end | 163 | end |
164 | 164 | ||
@@ -166,10 +166,10 @@ end | |||
166 | _.killEmAll = function(all) | 166 | _.killEmAll = function(all) |
167 | for i,l in ipairs(all) do | 167 | for i,l in ipairs(all) do |
168 | local c = 0 | 168 | local c = 0 |
169 | while 0 ~= tonumber(__("pgrep -u $USER -xc " .. l):Do().lines[1]) do | 169 | while 0 ~= tonumber(__('pgrep -u $USER -xc ' .. l):Do().lines[1]) do |
170 | local s = 'TERM' | 170 | local s = 'TERM' |
171 | if c > 1 then s = 'KILL'; __("sleep " .. c):Do() end | 171 | if c > 1 then s = 'KILL'; __('sleep ' .. c):Do() end |
172 | __("pkill -" .. s .. " -u $USER -x " .. l):log():Do() | 172 | __('pkill -' .. s .. ' -u $USER -x ' .. l):log():Do() |
173 | c = c + 1 | 173 | c = c + 1 |
174 | end | 174 | end |
175 | end | 175 | end |
@@ -202,7 +202,7 @@ __ = function(c) | |||
202 | end | 202 | end |
203 | elseif 'string' == type(c) then | 203 | elseif 'string' == type(c) then |
204 | exe.isScript = ('#!' == c:sub(1,2)) and (n == 0) | 204 | exe.isScript = ('#!' == c:sub(1,2)) and (n == 0) |
205 | for l in string.gmatch(c, "\n*([^\n]+)\n*") do | 205 | for l in string.gmatch(c, '\n*([^\n]+)\n*') do |
206 | if '' ~= l then | 206 | if '' ~= l then |
207 | if exe.isScript then | 207 | if exe.isScript then |
208 | if '' == exe.script then | 208 | if '' == exe.script then |
@@ -219,8 +219,8 @@ __ = function(c) | |||
219 | end | 219 | end |
220 | end | 220 | end |
221 | if exe.isScript then | 221 | if exe.isScript then |
222 | local a, e = io.open(exe.scriptFile, "w") | 222 | local a, e = io.open(exe.scriptFile, 'w') |
223 | if nil == a then E("Could not open " .. exe.scriptFile) else | 223 | if nil == a then E('Could not open ' .. exe.scriptFile) else |
224 | a:write(exe.script) | 224 | a:write(exe.script) |
225 | a:close() | 225 | a:close() |
226 | end | 226 | end |
@@ -241,7 +241,7 @@ __ = function(c) | |||
241 | 241 | ||
242 | function exe:timeout(c) | 242 | function exe:timeout(c) |
243 | -- timeout returns a status of - command status if --preserve-status; "128+9" (actually 137) if --kill-after ends up being done; 124 if it had to TERM; command status if all went well. | 243 | -- timeout returns a status of - command status if --preserve-status; "128+9" (actually 137) if --kill-after ends up being done; 124 if it had to TERM; command status if all went well. |
244 | -- --kill-after means "send KILL after TERM fails. | 244 | -- --kill-after means "send KILL after TERM fails". |
245 | if nil == c then | 245 | if nil == c then |
246 | self.cmd = 'timeout --kill-after=10.0 --foreground 42.0s ' .. self.cmd | 246 | self.cmd = 'timeout --kill-after=10.0 --foreground 42.0s ' .. self.cmd |
247 | else | 247 | else |
@@ -266,7 +266,7 @@ __ = function(c) | |||
266 | from nil and false are considered true (in particular, the number 0 | 266 | from nil and false are considered true (in particular, the number 0 |
267 | and the empty string are also true)." | 267 | and the empty string are also true)." |
268 | says the docs, I beg to differ.]] | 268 | says the docs, I beg to differ.]] |
269 | if true == self.logging then D(" executing - " .. self.cmd) end | 269 | if true == self.logging then D(' executing - ' .. self.cmd) end |
270 | --[[ Damn os.execute() | 270 | --[[ Damn os.execute() |
271 | Lua 5.1 says it returns "a status code, which is system-dependent" | 271 | Lua 5.1 says it returns "a status code, which is system-dependent" |
272 | Lua 5.2 says it returns true/nil, "exit"/"signal", the status code. | 272 | Lua 5.2 says it returns true/nil, "exit"/"signal", the status code. |
@@ -279,9 +279,9 @@ __ = function(c) | |||
279 | self.lines[#self.lines] = nil | 279 | self.lines[#self.lines] = nil |
280 | if true == self.showing then for i, l in ipairs(self.lines) do I(l) end end | 280 | if true == self.showing then for i, l in ipairs(self.lines) do I(l) end end |
281 | 281 | ||
282 | if (nil == self.status) then D("STATUS |" .. "NIL" .. '| ' .. self.command) | 282 | if (nil == self.status) then D('STATUS |' .. 'NIL' .. '| ' .. self.command) |
283 | elseif (137 == self.status) or (124 == self.status) then T("timeout killed " .. self.status .. ' ' .. self.command) | 283 | elseif (137 == self.status) or (124 == self.status) then T('timeout killed ' .. self.status .. ' ' .. self.command) |
284 | elseif (0 ~= self.status) then D("STATUS |" .. self.status .. '| ' .. self.command) | 284 | elseif (0 ~= self.status) then D('STATUS |' .. self.status .. '| ' .. self.command) |
285 | end | 285 | end |
286 | 286 | ||
287 | return self | 287 | return self |
@@ -293,7 +293,7 @@ __ = function(c) | |||
293 | if nil == after then after = '' end | 293 | if nil == after then after = '' end |
294 | if '' ~= after then after = ' ; ' .. after end | 294 | if '' ~= after then after = ' ; ' .. after end |
295 | self.cmd = '{ ' .. self.cmd .. after .. ' ; } & ' | 295 | self.cmd = '{ ' .. self.cmd .. after .. ' ; } & ' |
296 | if true == self.logging then D(" forking - " .. self.cmd) end | 296 | if true == self.logging then D(' forking - ' .. self.cmd) end |
297 | os.execute(self.cmd) | 297 | os.execute(self.cmd) |
298 | return self | 298 | return self |
299 | end | 299 | end |
@@ -116,8 +116,8 @@ local options = | |||
116 | _.killEmAll{'jmcore', 'qjackctl'} | 116 | _.killEmAll{'jmcore', 'qjackctl'} |
117 | -- Catia is python, and no easy way to kill it. | 117 | -- Catia is python, and no easy way to kill it. |
118 | -- Also it keeps jackdbus alive, no matter how hard you kill it. | 118 | -- Also it keeps jackdbus alive, no matter how hard you kill it. |
119 | __"pkill -TERM -u $USER -f catia":Do() | 119 | __'pkill -TERM -u $USER -f catia':Do() |
120 | __"sleep 2":Do() | 120 | __'sleep 2':Do() |
121 | _.killEmAll{'jackdbus', 'a2jmidid'} | 121 | _.killEmAll{'jackdbus', 'a2jmidid'} |
122 | os.exit(0) | 122 | os.exit(0) |
123 | end | 123 | end |
@@ -145,24 +145,24 @@ local Cards = {} | |||
145 | print('Scanning for audio devices.') | 145 | print('Scanning for audio devices.') |
146 | local cards = __'ls -d1 /proc/asound/card[0-9]*':noErr():Do() | 146 | local cards = __'ls -d1 /proc/asound/card[0-9]*':noErr():Do() |
147 | for i,l in ipairs(cards.lines) do | 147 | for i,l in ipairs(cards.lines) do |
148 | local f, e = io.open(l .. '/id', "r") | 148 | local f, e = io.open(l .. '/id', 'r') |
149 | if nil == f then print("Could not open " .. l .. '/id') else | 149 | if nil == f then print('Could not open ' .. l .. '/id') else |
150 | Cards[l] = {path = l, name = f:read("*a"):sub(1, -2), devs = {}, captureDevs = {}, playbackDevs = {}, card=i} | 150 | Cards[l] = {path = l, name = f:read('*a'):sub(1, -2), devs = {}, captureDevs = {}, playbackDevs = {}, card=i} |
151 | if "Loopback" ~= Cards[l]['name'] then | 151 | if 'Loopback' ~= Cards[l]['name'] then |
152 | Cards[l]['capture'] = __('ls -d1 ' .. l .. '/pcm[0-9]*c*'):noErr():Do() | 152 | Cards[l]['capture'] = __('ls -d1 ' .. l .. '/pcm[0-9]*c*'):noErr():Do() |
153 | for j,c in ipairs(Cards[l]['capture'].lines) do | 153 | for j,c in ipairs(Cards[l]['capture'].lines) do |
154 | local n = c:match(".*pcm(%d+).*") | 154 | local n = c:match('.*pcm(%d+).*') |
155 | Cards[l]['captureDevs'][j] = n | 155 | Cards[l]['captureDevs'][j] = n |
156 | Cards[l]['devs'][n] = n | 156 | Cards[l]['devs'][n] = n |
157 | print("\tFound capture device: " .. Cards[l]['name'] .. "\tDEVICE: " .. Cards[l]['captureDevs'][j] .. ' ' .. n) | 157 | print('\tFound capture device: ' .. Cards[l]['name'] .. '\tDEVICE: ' .. Cards[l]['captureDevs'][j] .. ' ' .. n) |
158 | io.flush() | 158 | io.flush() |
159 | end | 159 | end |
160 | Cards[l]['playback'] = __('ls -d1 ' .. l .. '/pcm[0-9]*p*'):noErr():Do() | 160 | Cards[l]['playback'] = __('ls -d1 ' .. l .. '/pcm[0-9]*p*'):noErr():Do() |
161 | for j,p in ipairs(Cards[l]['playback'].lines) do | 161 | for j,p in ipairs(Cards[l]['playback'].lines) do |
162 | local n = p:match(".*pcm(%d+).*") | 162 | local n = p:match('.*pcm(%d+).*') |
163 | Cards[l]['playbackDevs'][j] = n | 163 | Cards[l]['playbackDevs'][j] = n |
164 | Cards[l]['devs'][n] = n | 164 | Cards[l]['devs'][n] = n |
165 | print("\tFound playback device " .. Cards[l].card - 1 .. " : " .. Cards[l]['name'] .. "\tDEVICE: " .. Cards[l]['playbackDevs'][j] .. ' ' .. n) | 165 | print('\tFound playback device ' .. Cards[l].card - 1 .. ' : ' .. Cards[l]['name'] .. '\tDEVICE: ' .. Cards[l]['playbackDevs'][j] .. ' ' .. n) |
166 | io.flush() | 166 | io.flush() |
167 | if 'JACK' ~= arg[1] then | 167 | if 'JACK' ~= arg[1] then |
168 | print('\t\tALSA_CARD=' .. Cards[l].card - 1 .. ' ' .. speaker .. ' "Found playback device ' .. Cards[l].card - 1 .. ' : ' .. Cards[l]['name'] .. ' DEVICE: ' .. Cards[l]['playbackDevs'][j] .. ' ' .. n .. '"') | 168 | print('\t\tALSA_CARD=' .. Cards[l].card - 1 .. ' ' .. speaker .. ' "Found playback device ' .. Cards[l].card - 1 .. ' : ' .. Cards[l]['name'] .. ' DEVICE: ' .. Cards[l]['playbackDevs'][j] .. ' ' .. n .. '"') |
@@ -203,8 +203,8 @@ io.flush() | |||
203 | 203 | ||
204 | if 'start' == arg[1] then | 204 | if 'start' == arg[1] then |
205 | __('mkdir -p ' .. options.asoundrcPath.value):Do() | 205 | __('mkdir -p ' .. options.asoundrcPath.value):Do() |
206 | local a, e = io.open(options.asoundrcPath.value .. '/jack-plumbing', "w") | 206 | local a, e = io.open(options.asoundrcPath.value .. '/jack-plumbing', 'w') |
207 | if nil == a then print("Could not open " .. options.asoundrcPath.value .. '/jack-plumbing') else | 207 | if nil == a then print('Could not open ' .. options.asoundrcPath.value .. '/jack-plumbing') else |
208 | a:write([[ | 208 | a:write([[ |
209 | (connect "system:capture_1" "ploop:playback_1") | 209 | (connect "system:capture_1" "ploop:playback_1") |
210 | (connect "system:capture_2" "ploop:playback_2") | 210 | (connect "system:capture_2" "ploop:playback_2") |
@@ -218,20 +218,20 @@ if 'start' == arg[1] then | |||
218 | ]]) | 218 | ]]) |
219 | a:close() | 219 | a:close() |
220 | end | 220 | end |
221 | local a, e = io.open(options.asoundrcPath.value .. '/' .. options.asoundrc.value, "w") | 221 | local a, e = io.open(options.asoundrcPath.value .. '/' .. options.asoundrc.value, 'w') |
222 | if nil == a then print("Could not open " .. options.asoundrcPath.value .. '/' .. options.asoundrc.value) else | 222 | if nil == a then print('Could not open ' .. options.asoundrcPath.value .. '/' .. options.asoundrc.value) else |
223 | for i,C in pairs(Cards) do | 223 | for i,C in pairs(Cards) do |
224 | for j,c in pairs(C['devs']) do | 224 | for j,c in pairs(C['devs']) do |
225 | a:write("pcm." .. C['name'] .. j .. " {\n") | 225 | a:write('pcm.' .. C['name'] .. j .. ' {\n') |
226 | a:write(" type hw\n") | 226 | a:write(' type hw\n') |
227 | a:write(" card " .. C['name'] .. "\n") | 227 | a:write(' card ' .. C['name'] .. '\n') |
228 | a:write(" device " .. C['devs'][j] .. "\n") | 228 | a:write(' device ' .. C['devs'][j] .. '\n') |
229 | a:write("}\n") | 229 | a:write('}\n') |
230 | a:write("ctl." .. C['name'] .. j .. " {\n") | 230 | a:write('ctl.' .. C['name'] .. j .. ' {\n') |
231 | a:write(" type hw\n") | 231 | a:write(' type hw\n') |
232 | a:write(" card " .. C['name'] .. "\n") | 232 | a:write(' card ' .. C['name'] .. '\n') |
233 | a:write(" device " .. C['devs'][j] .. "\n") | 233 | a:write(' device ' .. C['devs'][j] .. '\n') |
234 | a:write("}\n\n") | 234 | a:write('}\n\n') |
235 | end | 235 | end |
236 | end | 236 | end |
237 | a:write([[ | 237 | a:write([[ |
@@ -373,13 +373,13 @@ pcm.!default { | |||
373 | end | 373 | end |
374 | elseif 'JACK' == arg[1] then | 374 | elseif 'JACK' == arg[1] then |
375 | print('') | 375 | print('') |
376 | print("Start up JACK and friends.") | 376 | print('Start up JACK and friends.') |
377 | print("jack_control") | 377 | print('jack_control') |
378 | __[[jack_control start | 378 | __[[jack_control start |
379 | jack_control ds alsa]]:Do() | 379 | jack_control ds alsa]]:Do() |
380 | --jack_control dps device hw:RIG,0 | 380 | --jack_control dps device hw:RIG,0 |
381 | while 0 ~= __'jack_control status':Do().status do | 381 | while 0 ~= __'jack_control status':Do().status do |
382 | print("Waiting for JACK") | 382 | print('Waiting for JACK') |
383 | __'sleep 1':Do() | 383 | __'sleep 1':Do() |
384 | end | 384 | end |
385 | if nil ~= GUI then | 385 | if nil ~= GUI then |
@@ -387,7 +387,7 @@ elseif 'JACK' == arg[1] then | |||
387 | __(GUI):forkOnce() | 387 | __(GUI):forkOnce() |
388 | end | 388 | end |
389 | if _.runnable'jack-plumbing' then | 389 | if _.runnable'jack-plumbing' then |
390 | print("jack-plumbing") | 390 | print('jack-plumbing') |
391 | __'jack-plumbing -o /var/lib/aataaj/jack-plumbing 2>/dev/null':fork() | 391 | __'jack-plumbing -o /var/lib/aataaj/jack-plumbing 2>/dev/null':fork() |
392 | end | 392 | end |
393 | if _.runnable'a2j_control' then | 393 | if _.runnable'a2j_control' then |
@@ -396,72 +396,72 @@ elseif 'JACK' == arg[1] then | |||
396 | --a2j_control actually starts a2jmidid. | 396 | --a2j_control actually starts a2jmidid. |
397 | ----a2jmidid -e -u & | 397 | ----a2jmidid -e -u & |
398 | -- I think the jack_control start and my current alsa config means a2jmidid gets started anyway. But seem to need this bit to get the joystick covered. | 398 | -- I think the jack_control start and my current alsa config means a2jmidid gets started anyway. But seem to need this bit to get the joystick covered. |
399 | print("a2j_control") | 399 | print('a2j_control') |
400 | __'a2j_control --ehw && a2j_control --start':Do() | 400 | __'a2j_control --ehw && a2j_control --start':Do() |
401 | -- print("sleep 2") | 401 | -- print('sleep 2') |
402 | -- __('sleep 2'):Do() | 402 | -- __('sleep 2'):Do() |
403 | print("") | 403 | print("") |
404 | end | 404 | end |
405 | 405 | ||
406 | 406 | ||
407 | local AIN = "alsa_in" | 407 | local AIN = 'alsa_in' |
408 | if _.runnable'zita-a2j' then AIN = 'zita-a2j' end | 408 | if _.runnable'zita-a2j' then AIN = 'zita-a2j' end |
409 | local AOUT = "alsa_out" | 409 | local AOUT = 'alsa_out' |
410 | if _.runnable'zita-j2a' then AOUT = 'zita-j2a' end | 410 | if _.runnable'zita-j2a' then AOUT = 'zita-j2a' end |
411 | 411 | ||
412 | print("Basic ALSA sound devices converted to JACK.") | 412 | print('Basic ALSA sound devices converted to JACK.') |
413 | for i,C in pairs(options.aliases.value) do | 413 | for i,C in pairs(options.aliases.value) do |
414 | print('HW playback: ' .. C['name'] .. '\tDEVICE: ' .. C['dev']) | 414 | print('HW playback: ' .. C['name'] .. '\tDEVICE: ' .. C['dev']) |
415 | __(AOUT .. ' -j ' .. C['name'] .. ' -d ' .. C['dev']):fork() | 415 | __(AOUT .. ' -j ' .. C['name'] .. ' -d ' .. C['dev']):fork() |
416 | end | 416 | end |
417 | print("HW playback: cloop\tDEVICE: cloop") | 417 | print('HW playback: cloop\tDEVICE: cloop') |
418 | -- No idea why, cloop wont work with zita-a2j. | 418 | -- No idea why, cloop wont work with zita-a2j. |
419 | __'alsa_in -j cloop -d cloop':fork() | 419 | __'alsa_in -j cloop -d cloop':fork() |
420 | --__[[sleep 1 | 420 | --__[[sleep 1 |
421 | -- jack_connect cloop:capture_1 system:playback_1o() | 421 | -- jack_connect cloop:capture_1 system:playback_1o() |
422 | -- jack_connect cloop:capture_2 system:playback_2]]:Do() | 422 | -- jack_connect cloop:capture_2 system:playback_2]]:Do() |
423 | print("HW playback: ploop\tDEVICE: ploop") | 423 | print('HW playback: ploop\tDEVICE: ploop') |
424 | __'alsa_out -j ploop -d ploop':fork() | 424 | __'alsa_out -j ploop -d ploop':fork() |
425 | --__[[sleep 1 | 425 | --__[[sleep 1 |
426 | -- jack_connect system:capture_1 ploop:playback_1 | 426 | -- jack_connect system:capture_1 ploop:playback_1 |
427 | -- jack_connect system:capture_2 ploop:playback_2]]:Do() | 427 | -- jack_connect system:capture_2 ploop:playback_2]]:Do() |
428 | 428 | ||
429 | 429 | ||
430 | print("") | 430 | print('') |
431 | 431 | ||
432 | print("Rest of ALSA sound devices converted to JACK.") | 432 | print('Rest of ALSA sound devices converted to JACK.') |
433 | for i,C in pairs(Cards) do | 433 | for i,C in pairs(Cards) do |
434 | for j,c in ipairs(C['playbackDevs']) do | 434 | for j,c in ipairs(C['playbackDevs']) do |
435 | print("HW playback: " .. C['name'] .. "\tDEVICE: " .. C['playbackDevs'][j]) | 435 | print('HW playback: ' .. C['name'] .. '\tDEVICE: ' .. C['playbackDevs'][j]) |
436 | __(AOUT .. ' -j ' .. C['name'] .. "_" .. C['playbackDevs'][j] .. '-in -d ' .. C['name'] .. C['playbackDevs'][j]):fork() | 436 | __(AOUT .. ' -j ' .. C['name'] .. '_' .. C['playbackDevs'][j] .. '-in -d ' .. C['name'] .. C['playbackDevs'][j]):fork() |
437 | -- __'sleep 1':Do() | 437 | -- __'sleep 1':Do() |
438 | -- __('jack_connect cloop:capture_1 ' .. C['name'] .. '_' .. C['playbackDevs'][j] .. '-in' .. ':playback_1'):Do() | 438 | -- __('jack_connect cloop:capture_1 ' .. C['name'] .. '_' .. C['playbackDevs'][j] .. '-in' .. ':playback_1'):Do() |
439 | -- __('jack_connect cloop:capture_2 ' .. C['name'] .. '_' .. C['playbackDevs'][j] .. '-in' .. ':playback_2'):Do() | 439 | -- __('jack_connect cloop:capture_2 ' .. C['name'] .. '_' .. C['playbackDevs'][j] .. '-in' .. ':playback_2'):Do() |
440 | end | 440 | end |
441 | for j,c in ipairs(C['captureDevs']) do | 441 | for j,c in ipairs(C['captureDevs']) do |
442 | print("HW capture: " .. C['name'] .. "\tDEVICE: " .. C['captureDevs'][j]) | 442 | print('HW capture: ' .. C['name'] .. '\tDEVICE: ' .. C['captureDevs'][j]) |
443 | __(AIN .. ' -j ' .. C['name'] .. "_" .. C['captureDevs'][j] .. '-out -d ' .. C['name'] .. C['captureDevs'][j]):fork() | 443 | __(AIN .. ' -j ' .. C['name'] .. '_' .. C['captureDevs'][j] .. '-out -d ' .. C['name'] .. C['captureDevs'][j]):fork() |
444 | end | 444 | end |
445 | end | 445 | end |
446 | print("") | 446 | print('') |
447 | 447 | ||
448 | if _.runnable('aseqjoy') then | 448 | if _.runnable('aseqjoy') then |
449 | print("Scanning for joysticks.") | 449 | print('Scanning for joysticks.') |
450 | local sticks = __'ls -1 /dev/input/js[0-9]*':noErr():Do() | 450 | local sticks = __'ls -1 /dev/input/js[0-9]*':noErr():Do() |
451 | for i,l in ipairs(sticks.lines) do | 451 | for i,l in ipairs(sticks.lines) do |
452 | print("aseqjoy " .. l) | 452 | print('aseqjoy ' .. l) |
453 | -- Buttons switch to that numbered MIDI channel, defaults to 1. | 453 | -- Buttons switch to that numbered MIDI channel, defaults to 1. |
454 | -- Axis are mapped to MIDI controllers 10 - 15 | 454 | -- Axis are mapped to MIDI controllers 10 - 15 |
455 | -- -r means to use high resolution MIDI values. | 455 | -- -r means to use high resolution MIDI values. |
456 | __('aseqjoy -d ' .. l:sub(-1,-1) .. ' -r'):fork() | 456 | __('aseqjoy -d ' .. l:sub(-1,-1) .. ' -r'):fork() |
457 | end | 457 | end |
458 | print("") | 458 | print('') |
459 | end | 459 | end |
460 | 460 | ||
461 | if _.runnable('jack-plumbing') then | 461 | if _.runnable('jack-plumbing') then |
462 | print('Stop our jack-plumbing, eventually.') | 462 | print('Stop our jack-plumbing, eventually.') |
463 | __'sleep 4':Do() | 463 | __'sleep 4':Do() |
464 | _.killEmAll{"jack-plumbing"} | 464 | _.killEmAll{'jack-plumbing'} |
465 | end | 465 | end |
466 | 466 | ||
467 | if _.runnable('~/.aataaj_JACK.lua') then | 467 | if _.runnable('~/.aataaj_JACK.lua') then |
@@ -41,8 +41,8 @@ local options = | |||
41 | _.killEmAll{'jmcore', 'qjackctl'} | 41 | _.killEmAll{'jmcore', 'qjackctl'} |
42 | -- Catia is python, and no easy way to kill it. | 42 | -- Catia is python, and no easy way to kill it. |
43 | -- Also it keeps jackdbus alive, no matter how hard you kill it. | 43 | -- Also it keeps jackdbus alive, no matter how hard you kill it. |
44 | __"pkill -TERM -u $USER -f catia":Do() | 44 | __'pkill -TERM -u $USER -f catia':Do() |
45 | __"sleep 2":Do() | 45 | __'sleep 2':Do() |
46 | _.killEmAll{'jackdbus', 'a2jmidid'} | 46 | _.killEmAll{'jackdbus', 'a2jmidid'} |
47 | ]=] | 47 | ]=] |
48 | end | 48 | end |
@@ -51,10 +51,10 @@ local options = | |||
51 | options['restart'] = options['start'] | 51 | options['restart'] = options['start'] |
52 | options['force-reload'] = options['start'] | 52 | options['force-reload'] = options['start'] |
53 | 53 | ||
54 | print("start = " .. options.start.value) | 54 | print('start = ' .. options.start.value) |
55 | _.parse(arg, options, 'test_') | 55 | _.parse(arg, options, 'test_') |
56 | print("start = " .. options.start.value) | 56 | print('start = ' .. options.start.value) |
57 | print("stop = " .. options.stop.value) | 57 | print('stop = ' .. options.stop.value) |
58 | 58 | ||
59 | 59 | ||
60 | 60 | ||
@@ -112,7 +112,7 @@ print(__[[#!/usr/bin/tcc -run | |||
112 | print('') | 112 | print('') |
113 | 113 | ||
114 | __[[#!/usr/bin/env luajit | 114 | __[[#!/usr/bin/env luajit |
115 | print('Hello ' .. "world " .. [=[from]=] .. " Lua.") | 115 | print('Hello ' .. "world " .. [=[from]=] .. ' Lua.') |
116 | ]]:log():show():Do() | 116 | ]]:log():show():Do() |
117 | print('') | 117 | print('') |
118 | 118 | ||