mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-09 04:51:49 +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
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ tostring_overrides["display.framerate"] = function(x)
|
|||
end
|
||||
end
|
||||
|
||||
function create_setting(id, name, step, postfix, tooltip, changeonrelease)
|
||||
function create_trackbar_setting(id, name, step, postfix, tooltip, changeonrelease)
|
||||
local info = app.get_setting_info(id)
|
||||
postfix = postfix or ""
|
||||
tooltip = tooltip or ""
|
||||
|
|
@ -25,10 +25,10 @@ function create_setting(id, name, step, postfix, tooltip, changeonrelease)
|
|||
tooltip=tooltip,
|
||||
changeonrelease=changeonrelease
|
||||
}))
|
||||
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)
|
||||
local str
|
||||
local func = tostring_overrides[id]
|
||||
if func then
|
||||
|
|
@ -55,8 +55,8 @@ end
|
|||
|
||||
|
||||
function on_open()
|
||||
create_setting("camera.fov", "FOV", 1, "°")
|
||||
create_setting("display.framerate", "Framerate", 1, "", "", true)
|
||||
create_trackbar_setting("camera.fov", "FOV", 1, "°")
|
||||
create_trackbar_setting("display.framerate", "Framerate", 1, "", "", true)
|
||||
|
||||
document.root:add(string.format(
|
||||
"<select context='settings' onselect='function(opt) app.set_setting(\"display.window-mode\", tonumber(opt)) end' selected='%s'>"..
|
||||
|
|
@ -70,5 +70,5 @@ function on_open()
|
|||
create_checkbox("camera.inertia", "Camera Inertia")
|
||||
create_checkbox("camera.fov-effects", "Camera FOV Effects")
|
||||
create_checkbox("display.limit-fps-iconified", "Limit Background FPS")
|
||||
create_setting("graphics.gamma", "Gamma", 0.05, "", "graphics.gamma.tooltip")
|
||||
create_trackbar_setting("graphics.gamma", "Gamma", 0.05, "", "graphics.gamma.tooltip")
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
function create_setting(id, name, step, postfix, tooltip, changeonrelease)
|
||||
function create_trackbar_setting(id, name, step, postfix, tooltip, changeonrelease)
|
||||
local info = app.get_setting_info(id)
|
||||
postfix = postfix or ""
|
||||
tooltip = tooltip or ""
|
||||
|
|
@ -14,10 +14,10 @@ function create_setting(id, name, step, postfix, tooltip, changeonrelease)
|
|||
tooltip=tooltip,
|
||||
changeonrelease=changeonrelease
|
||||
}))
|
||||
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)
|
||||
-- updating label
|
||||
document[id..".L"].text = string.format(
|
||||
"%s: %s%s",
|
||||
|
|
@ -36,15 +36,15 @@ function create_checkbox(id, name, tooltip)
|
|||
end
|
||||
|
||||
function on_open()
|
||||
create_setting("chunks.load-distance", "Load Distance", 1)
|
||||
create_setting("chunks.load-speed", "Load Speed", 1)
|
||||
create_setting("graphics.fog-curve", "Fog Curve", 0.1)
|
||||
create_trackbar_setting("chunks.load-distance", "Load Distance", 1)
|
||||
create_trackbar_setting("chunks.load-speed", "Load Speed", 1)
|
||||
create_trackbar_setting("graphics.fog-curve", "Fog Curve", 0.1)
|
||||
|
||||
create_checkbox("graphics.backlight", "Backlight", "graphics.backlight.tooltip")
|
||||
create_checkbox("graphics.soft-lighting", "Soft lighting", "graphics.soft-lighting.tooltip")
|
||||
create_checkbox("graphics.dense-render", "Dense blocks render", "graphics.dense-render.tooltip")
|
||||
create_checkbox("graphics.advanced-render", "Advanced render", "graphics.advanced-render.tooltip")
|
||||
create_setting("graphics.ssao", "SSAO", 1, "", "graphics.ssao.tooltip")
|
||||
create_setting("graphics.shadows-quality", "Shadows quality", 1)
|
||||
create_setting("graphics.clouds-quality", "Clouds quality", 1)
|
||||
create_trackbar_setting("graphics.ssao", "SSAO", 1, "", "graphics.ssao.tooltip")
|
||||
create_trackbar_setting("graphics.shadows-quality", "Shadows quality", 1)
|
||||
create_trackbar_setting("graphics.clouds-quality", "Clouds quality", 1)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -3,5 +3,5 @@
|
|||
<trackbar
|
||||
value='%{value}' min='%{min}' max='%{max}' step='%{step}' tooltip='%{tooltip}'
|
||||
consumer='function(x) app.set_setting("%{id}", x) end' change-on-release='%{changeonrelease}'
|
||||
sub-consumer='function(x) update_setting(x, "%{id}", "%{name}", "%{postfix}") end'/>
|
||||
sub-consumer='function(x) update_trackbar_label(x, "%{id}", "%{name}", "%{postfix}") end'/>
|
||||
</panel>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue