mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 11:01: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
|
|
@ -190,18 +190,34 @@ void audio::initialize(
|
|||
audio::get_channel(channel.name)->setVolume(value * value);
|
||||
}, true));
|
||||
}
|
||||
objects_keeper.keepAlive(settings.acousticEffects.observe([=](auto value) {
|
||||
objects_keeper.keepAlive(settings.acousticEffects.observe([=](bool value) {
|
||||
if (value) return;
|
||||
backend->setAcoustics(audio::Acoustics {});
|
||||
}, true));
|
||||
|
||||
if (inputEnabled) {
|
||||
::input_device = backend->openInputDevice("", 44100, 1, 16);
|
||||
::input_enabled = true;
|
||||
}
|
||||
if (::input_device) {
|
||||
::input_device->startCapture();
|
||||
}
|
||||
::input_enabled = inputEnabled;
|
||||
|
||||
objects_keeper.keepAlive(settings.recordingEnabled.observe([&settings](bool enabled) {
|
||||
if (!::input_enabled) {
|
||||
return;
|
||||
}
|
||||
if (!enabled && ::input_device == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (enabled) {
|
||||
logger.info() << "recording enabled; input device is "
|
||||
<< settings.inputDevice.get();
|
||||
::input_device = backend->openInputDevice(
|
||||
settings.inputDevice.get(), 44100, 1, 16
|
||||
);
|
||||
::input_device->startCapture();
|
||||
} else {
|
||||
if (::input_device) {
|
||||
::input_device->stopCapture();
|
||||
}
|
||||
::input_device = nullptr;
|
||||
}
|
||||
}, true));
|
||||
}
|
||||
|
||||
InputDevice* audio::get_input_device() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue