mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-11 05:51:51 +00:00
add audio.recording-enabled setting
This commit is contained in:
parent
c4bddba6b7
commit
eb453d8170
9 changed files with 71 additions and 37 deletions
|
|
@ -1,4 +1,4 @@
|
|||
function create_setting(id, name, step, postfix)
|
||||
function create_trackbar_setting(id, name, step, postfix)
|
||||
local info = app.get_setting_info(id)
|
||||
postfix = postfix or ""
|
||||
document.root:add(gui.template("track_setting", {
|
||||
|
|
@ -10,10 +10,10 @@ function create_setting(id, name, step, postfix)
|
|||
step=step,
|
||||
postfix=postfix
|
||||
}))
|
||||
update_setting(app.get_setting(id), id, name, postfix)
|
||||
update_trackbar_label(app.get_setting(id), id, name, postfix)
|
||||
end
|
||||
|
||||
function update_setting(x, id, name, postfix)
|
||||
function update_trackbar_label(x, id, name, postfix)
|
||||
app.set_setting(id, x)
|
||||
-- updating label
|
||||
document[id..".L"].text = string.format(
|
||||
|
|
@ -24,12 +24,22 @@ function update_setting(x, id, name, postfix)
|
|||
)
|
||||
end
|
||||
|
||||
function update_checkbox_setting(id, value)
|
||||
app.set_setting(id, value)
|
||||
|
||||
local recording_enabled = app.get_setting("audio.recording-enabled")
|
||||
document.input_device_select.enabled = recording_enabled
|
||||
document.input_volume_inner.enabled = recording_enabled
|
||||
document.input_volume_outer.enabled = recording_enabled
|
||||
end
|
||||
|
||||
function create_checkbox(id, name, tooltip)
|
||||
tooltip = tooltip or ''
|
||||
document.root:add(string.format(
|
||||
"<checkbox consumer='function(x) app.set_setting(\"%s\", x) end' checked='%s' tooltip='%s'>%s</checkbox>",
|
||||
"<checkbox consumer='function(x) update_checkbox_setting(\"%s\", x) end' checked='%s' tooltip='%s'>%s</checkbox>",
|
||||
id, app.str_setting(id), gui.str(tooltip, "settings"), gui.str(name, "settings")
|
||||
))
|
||||
update_checkbox_setting(id, app.get_setting(id))
|
||||
end
|
||||
|
||||
local initialized = false
|
||||
|
|
@ -55,11 +65,12 @@ function on_open()
|
|||
prev_amplitude = amplitude
|
||||
end)
|
||||
end
|
||||
create_setting("audio.volume-master", "Master Volume", 0.01)
|
||||
create_setting("audio.volume-regular", "Regular Sounds", 0.01)
|
||||
create_setting("audio.volume-ui", "UI Sounds", 0.01)
|
||||
create_setting("audio.volume-ambient", "Ambient", 0.01)
|
||||
create_setting("audio.volume-music", "Music", 0.01)
|
||||
create_trackbar_setting("audio.volume-master", "Master Volume", 0.01)
|
||||
create_trackbar_setting("audio.volume-regular", "Regular Sounds", 0.01)
|
||||
create_trackbar_setting("audio.volume-ui", "UI Sounds", 0.01)
|
||||
create_trackbar_setting("audio.volume-ambient", "Ambient", 0.01)
|
||||
create_trackbar_setting("audio.volume-music", "Music", 0.01)
|
||||
|
||||
document.root:add("<label context='settings'>@Microphone</label>")
|
||||
document.root:add("<select id='input_device_select' "..
|
||||
"onselect='function(opt) app.set_setting(\"audio.input-device\", opt) end'/>")
|
||||
|
|
@ -67,9 +78,7 @@ function on_open()
|
|||
.."<container id='input_volume_inner' color='#00FF00FF' pos='1' size='2'/>"
|
||||
.."</container>")
|
||||
local selectbox = document.input_device_select
|
||||
local devices = {
|
||||
{value="none", text=gui.str("None", "settings.microphone")},
|
||||
}
|
||||
local devices = {}
|
||||
local names = audio.__get_input_devices_names()
|
||||
for i, name in ipairs(names) do
|
||||
table.insert(devices, {value=name, text=name})
|
||||
|
|
@ -78,7 +87,10 @@ function on_open()
|
|||
local info = audio.input.get_input_info()
|
||||
if info then
|
||||
selectbox.value = info.device_specifier
|
||||
else
|
||||
selectbox.value = app.get_setting("audio.input-device")
|
||||
end
|
||||
|
||||
create_checkbox("audio.recording-enabled", "Enable microphone", "audio.recording-enabled.tooltip")
|
||||
create_checkbox("audio.acoustic-effects", "Acoustic effects", "audio.acoustic-effects.tooltip")
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue