aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordvs12024-10-26 21:36:27 +1000
committerdvs12024-10-26 21:36:27 +1000
commitc93e075ef2c477b902b2d0cb55ca7c342655f2c1 (patch)
tree67746dbe30e6b8263f8de4378d397d446e10bb16
parentAdded the rest of the logging and debug level stuff from apt-panopticon, exce... (diff)
downloadJackOnAllDevices-c93e075ef2c477b902b2d0cb55ca7c342655f2c1.zip
JackOnAllDevices-c93e075ef2c477b902b2d0cb55ca7c342655f2c1.tar.gz
JackOnAllDevices-c93e075ef2c477b902b2d0cb55ca7c342655f2c1.tar.bz2
JackOnAllDevices-c93e075ef2c477b902b2d0cb55ca7c342655f2c1.tar.xz
Move aataaj.lua configuration options to a conf file.
Diffstat (limited to '')
-rw-r--r--.aataaj.conf.lua12
-rwxr-xr-xaataaj.lua44
2 files changed, 28 insertions, 28 deletions
diff --git a/.aataaj.conf.lua b/.aataaj.conf.lua
new file mode 100644
index 0000000..642d24c
--- /dev/null
+++ b/.aataaj.conf.lua
@@ -0,0 +1,12 @@
1-- This works coz LuaJIT automatically loads the jit module.
2if type(jit) == 'table' then
3 io.write(arg[0] .. ' is being run by ' .. jit.version .. ' under ' .. jit.os .. ' on a ' .. jit.arch .. '\n')
4else
5 io.write(arg[0] .. ' is being run by Lua version ' .. _VERSION .. '\n')
6end
7
8return {
9 ['aliases'] = {
10 {name='Screen', dev='HDMI9'},
11 };
12}
diff --git a/aataaj.lua b/aataaj.lua
index 6f840f3..eaa0fef 100755
--- a/aataaj.lua
+++ b/aataaj.lua
@@ -86,24 +86,12 @@ Version = '0.0 crap'
86 86
87local options = 87local options =
88{ 88{
89 start = 89 start = {help = 'Command to start the scanning process, for Sys V init.', },
90 {
91 help = 'Command to start the scanning process, for Sys V init.',
92 },
93 restart = {start}, 90 restart = {start},
94 ['force-reload'] = {start}, 91 ['force-reload'] = {start},
95 status = 92 status = {help = 'Command to check the status of the scanning process, for Sys V init.', },
96 { 93 stop = {help = 'Command to stop the scanning process, for Sys V init.', },
97 help = 'Command to check the status of the scanning process, for Sys V init.', 94 JACK = {help = 'Command to start the JACK stuff, for users.', },
98 },
99 stop =
100 {
101 help = 'Command to stop the scanning process, for Sys V init.',
102 },
103 JACK =
104 {
105 help = 'Command to start the JACK stuff, for users.',
106 },
107 STOP = 95 STOP =
108 { 96 {
109 help = 'Command to stop the JACK stuff, for users.', 97 help = 'Command to stop the JACK stuff, for users.',
@@ -132,24 +120,24 @@ local options =
132 os.exit(0) 120 os.exit(0)
133 end 121 end
134 }, 122 },
123 asoundrcPath = {help = 'Path to our config files and stuff.', value = '/var/lib/aataaj', },
124 asoundrc = {help = 'Name of asoundrc file.', value = 'asoundrc', },
125 aliases = {help = 'Aliases for audio devices.', value = {}, },
135} 126}
136 127
137_.parse(arg, options) 128_.parse(arg, options, 'aataaj')
138 129
139 130
140 131
141-- CHANGE these to suit. 132-- CHANGE these to suit.
142local asoundrcPath = '/var/lib/aataaj'
143local asoundrc = 'asoundrc'
144local GUI = 'qjackctl' 133local GUI = 'qjackctl'
145if _.runnable('catia') then GUI = 'catia' end 134if _.runnable('catia') then GUI = 'catia' end
146local alias = {
147-- {name='Screen', dev='HDMI9'},
148 }
149 135
150local speaker = 'espeak' 136local speaker = 'espeak'
151if _.runnable('espeak-ng') then speaker = 'espeak-ng' end 137if _.runnable('espeak-ng') then speaker = 'espeak-ng' end
152 138
139
140
153local Cards = {} 141local Cards = {}
154 142
155print('Scanning for audio devices.') 143print('Scanning for audio devices.')
@@ -212,9 +200,9 @@ io.flush()
212 200
213 201
214if 'start' == arg[1] then 202if 'start' == arg[1] then
215 __('mkdir -p ' .. asoundrcPath):Do() 203 __('mkdir -p ' .. options.asoundrcPath.value):Do()
216 local a, e = io.open(asoundrcPath .. '/jack-plumbing', "w") 204 local a, e = io.open(options.asoundrcPath.value .. '/jack-plumbing', "w")
217 if nil == a then print("Could not open " .. asoundrcPath .. '/jack-plumbing') else 205 if nil == a then print("Could not open " .. options.asoundrcPath.value .. '/jack-plumbing') else
218 a:write([[ 206 a:write([[
219(connect "system:capture_1" "ploop:playback_1") 207(connect "system:capture_1" "ploop:playback_1")
220(connect "system:capture_2" "ploop:playback_2") 208(connect "system:capture_2" "ploop:playback_2")
@@ -228,8 +216,8 @@ if 'start' == arg[1] then
228 ]]) 216 ]])
229 a:close() 217 a:close()
230 end 218 end
231 local a, e = io.open(asoundrcPath .. '/' .. asoundrc, "w") 219 local a, e = io.open(options.asoundrcPath.value .. '/' .. options.asoundrc.value, "w")
232 if nil == a then print("Could not open " .. asoundrcPath .. '/' .. asoundrc) else 220 if nil == a then print("Could not open " .. options.asoundrcPath.value .. '/' .. options.asoundrc.value) else
233 for i,C in pairs(Cards) do 221 for i,C in pairs(Cards) do
234 for j,c in pairs(C['devs']) do 222 for j,c in pairs(C['devs']) do
235 a:write("pcm." .. C['name'] .. j .. " {\n") 223 a:write("pcm." .. C['name'] .. j .. " {\n")
@@ -420,7 +408,7 @@ elseif 'JACK' == arg[1] then
420 if _.runnable'zita-j2a' then AOUT = 'zita-j2a' end 408 if _.runnable'zita-j2a' then AOUT = 'zita-j2a' end
421 409
422 print("Basic ALSA sound devices converted to JACK.") 410 print("Basic ALSA sound devices converted to JACK.")
423 for i,C in pairs(alias) do 411 for i,C in pairs(options.aliases.value) do
424 print('HW playback: ' .. C['name'] .. '\tDEVICE: ' .. C['dev']) 412 print('HW playback: ' .. C['name'] .. '\tDEVICE: ' .. C['dev'])
425 __(AOUT .. ' -j ' .. C['name'] .. ' -d ' .. C['dev']):fork() 413 __(AOUT .. ' -j ' .. C['name'] .. ' -d ' .. C['dev']):fork()
426 end 414 end