mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
add test audio input fetch function
This commit is contained in:
parent
cc8e763f97
commit
7dca9255df
6 changed files with 107 additions and 25 deletions
|
|
@ -151,6 +151,8 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
static std::unique_ptr<InputDevice> input_device = nullptr;
|
||||
|
||||
void audio::initialize(bool enabled, AudioSettings& settings) {
|
||||
enabled = enabled && settings.enabled.get();
|
||||
if (enabled) {
|
||||
|
|
@ -180,6 +182,13 @@ void audio::initialize(bool enabled, AudioSettings& settings) {
|
|||
audio::get_channel(channel.name)->setVolume(value * value);
|
||||
}, true));
|
||||
}
|
||||
|
||||
input_device = backend->openInputDevice(44100, 1, 16);
|
||||
input_device->startCapture();
|
||||
}
|
||||
|
||||
InputDevice* audio::get_input_device() {
|
||||
return input_device.get();
|
||||
}
|
||||
|
||||
std::unique_ptr<PCM> audio::load_PCM(const io::path& file, bool headerOnly) {
|
||||
|
|
@ -458,6 +467,7 @@ void audio::reset_channel(int index) {
|
|||
}
|
||||
|
||||
void audio::close() {
|
||||
input_device->stopCapture();
|
||||
speakers.clear();
|
||||
delete backend;
|
||||
backend = nullptr;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue