Skip to content

Instantly share code, notes, and snippets.

@fovtran
Created April 3, 2023 11:44
Show Gist options
  • Save fovtran/f0deeea84aed6dc7429ea89971c4d6ed to your computer and use it in GitHub Desktop.
Save fovtran/f0deeea84aed6dc7429ea89971c4d6ed to your computer and use it in GitHub Desktop.
ardour alsa input switcher
-- change alsa input source for hda realtek codec (ALC888)
ardour {
["type"] = "EditorAction",
name = "ALSA Mixer Store",
author = "DMC",
description = [[
ALSA Capture sources
]]
}
function factory() return function()
local invalidate = {}
local dialog_options = {
{ type = "label", colspan = 5, title = "" },
{ type = "radio", col = 1, colspan = 7, key = "select", title = "", values ={ ["LINE-IN"] = "set-line-in", ["FRONT-MIC"] = "set-front-in", ["REAR-MIC"] = "set-rear-in" }, default = "LINE-IN"},
{ type = "label", colspan = 5, title = "" },
}
local rv = LuaDialog.Dialog("ALSA Mixer Store:", dialog_options):run()
if rv then
local choice = rv["select"]
if choice == "set-line-in" then
print("Selected LINE-IN")
os.execute("amixer -c0 cset numid=23 2")
end
if choice == "set-front-in" then
print("Selected FRONT-IN")
os.execute("amixer -c0 cset numid=23 1")
end
if choice == "set-rear-in" then
print("Selected REAR-IN")
os.execute("amixer -c0 cset numid=23 0")
end
end
end end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment