mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-06 03:21:49 +00:00
fix audio input device settings
This commit is contained in:
parent
f30b5f84d0
commit
a99c6aa8e0
4 changed files with 21 additions and 4 deletions
|
|
@ -31,6 +31,14 @@ function update_checkbox_setting(id, value)
|
|||
document.input_device_select.enabled = recording_enabled
|
||||
document.input_volume_inner.enabled = recording_enabled
|
||||
document.input_volume_outer.enabled = recording_enabled
|
||||
|
||||
local selectbox = document.input_device_select
|
||||
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
|
||||
end
|
||||
|
||||
function create_checkbox(id, name, tooltip)
|
||||
|
|
@ -84,6 +92,7 @@ function on_open()
|
|||
table.insert(devices, {value=name, text=name})
|
||||
end
|
||||
selectbox.options = devices
|
||||
|
||||
local info = audio.input.get_input_info()
|
||||
if info then
|
||||
selectbox.value = info.device_specifier
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include "debug/Logger.hpp"
|
||||
#include "alutil.hpp"
|
||||
#include "util/stringutil.hpp"
|
||||
#include "../MemoryPCMStream.hpp"
|
||||
|
||||
static debug::Logger logger("al-audio");
|
||||
|
|
@ -99,6 +100,8 @@ ALInputDevice::ALInputDevice(
|
|||
|
||||
if (deviceName) {
|
||||
deviceSpecifier = std::string(deviceName);
|
||||
logger.info() << "created input device with specifier "
|
||||
<< util::quote(deviceSpecifier);
|
||||
} else {
|
||||
logger.warning() << "could not retrieve input device specifier";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -205,12 +205,17 @@ void audio::initialize(
|
|||
return;
|
||||
}
|
||||
if (enabled) {
|
||||
logger.info() << "recording enabled; input device is "
|
||||
<< settings.inputDevice.get();
|
||||
const auto& targetDevice = settings.inputDevice.get();
|
||||
logger.info() << "recording enabled; target input device is "
|
||||
<< (targetDevice.empty() ? "not specified"
|
||||
: targetDevice);
|
||||
::input_device = backend->openInputDevice(
|
||||
settings.inputDevice.get(), 44100, 1, 16
|
||||
);
|
||||
::input_device->startCapture();
|
||||
if (::input_device != nullptr) {
|
||||
logger.error() << "could not create input device";
|
||||
::input_device->startCapture();
|
||||
}
|
||||
} else {
|
||||
if (::input_device) {
|
||||
::input_device->stopCapture();
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ struct AudioSettings {
|
|||
NumberSetting volumeAmbient {1.0f, 0.0f, 1.0f, setting_format::percent};
|
||||
NumberSetting volumeMusic {1.0f, 0.0f, 1.0f, setting_format::percent};
|
||||
|
||||
StringSetting inputDevice {"auto"};
|
||||
StringSetting inputDevice {""};
|
||||
|
||||
FlagSetting acousticEffects {true};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue