diff options
Diffstat (limited to 'aataaj.lua')
-rwxr-xr-x | aataaj.lua | 44 |
1 files changed, 16 insertions, 28 deletions
@@ -86,24 +86,12 @@ Version = '0.0 crap' | |||
86 | 86 | ||
87 | local options = | 87 | local 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. |
142 | local asoundrcPath = '/var/lib/aataaj' | ||
143 | local asoundrc = 'asoundrc' | ||
144 | local GUI = 'qjackctl' | 133 | local GUI = 'qjackctl' |
145 | if _.runnable('catia') then GUI = 'catia' end | 134 | if _.runnable('catia') then GUI = 'catia' end |
146 | local alias = { | ||
147 | -- {name='Screen', dev='HDMI9'}, | ||
148 | } | ||
149 | 135 | ||
150 | local speaker = 'espeak' | 136 | local speaker = 'espeak' |
151 | if _.runnable('espeak-ng') then speaker = 'espeak-ng' end | 137 | if _.runnable('espeak-ng') then speaker = 'espeak-ng' end |
152 | 138 | ||
139 | |||
140 | |||
153 | local Cards = {} | 141 | local Cards = {} |
154 | 142 | ||
155 | print('Scanning for audio devices.') | 143 | print('Scanning for audio devices.') |
@@ -212,9 +200,9 @@ io.flush() | |||
212 | 200 | ||
213 | 201 | ||
214 | if 'start' == arg[1] then | 202 | if '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 |