update audio lib

This commit is contained in:
MihailRis 2025-11-21 20:34:33 +03:00
parent 4f96ec47cd
commit 96bc395561
3 changed files with 9 additions and 8 deletions

View File

@ -29,7 +29,7 @@ local initialized = false
function on_open()
if not initialized then
initialized = true
local token = audio.input.__get_core_token()
local token = core.get_core_token()
document.root:add("<container id='tm' />")
local prev_amplitude = 0.0
document.tm:setInterval(16, function()
@ -54,16 +54,16 @@ function on_open()
create_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) audio.set_input_device(opt) end'/>")
"onselect='function(opt) audio.__set_input_device(opt) end'/>")
document.root:add("<container id='input_volume_outer' color='#000000' size='4'>"
.."<container id='input_volume_inner' color='#00FF00FF' pos='1' size='2'/>"
.."</container>")
local selectbox = document.input_device_select
local devices = {}
local names = audio.get_input_devices_names()
local names = audio.__get_input_devices_names()
for i, name in ipairs(names) do
table.insert(devices, {value=name, text=name})
end
selectbox.options = devices
selectbox.value = audio.get_input_info().device_specifier
selectbox.value = audio.__get_input_info().device_specifier
end

View File

@ -445,6 +445,7 @@ local __post_runnables = {}
local fn_audio_reset_fetch_buffer = audio.__reset_fetch_buffer
audio.__reset_fetch_buffer = nil
core.get_core_token = audio.input.__get_core_token
function __process_post_runnables()
if #__post_runnables then

View File

@ -480,9 +480,9 @@ const luaL_Reg audiolib[] = {
{"count_speakers", lua::wrap<l_audio_count_speakers>},
{"count_streams", lua::wrap<l_audio_count_streams>},
{"__fetch_input", lua::wrap<l_audio_fetch_input>},
{"get_input_devices_names", lua::wrap<l_audio_get_input_devices_names>},
{"get_output_devices_names", lua::wrap<l_audio_get_output_devices_names>},
{"set_input_device", lua::wrap<l_audio_set_input_device>},
{"get_input_info", lua::wrap<l_audio_get_input_info>},
{"__get_input_devices_names", lua::wrap<l_audio_get_input_devices_names>},
{"__get_output_devices_names", lua::wrap<l_audio_get_output_devices_names>},
{"__set_input_device", lua::wrap<l_audio_set_input_device>},
{"__get_input_info", lua::wrap<l_audio_get_input_info>},
{nullptr, nullptr}
};