mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-23 18:19:21 +01:00
audio_core: Dispose of current audio sink before opening new one. (#6567)
This commit is contained in:
parent
72b82ef6ed
commit
848116b5be
@ -17,6 +17,9 @@ DspInterface::DspInterface() = default;
|
|||||||
DspInterface::~DspInterface() = default;
|
DspInterface::~DspInterface() = default;
|
||||||
|
|
||||||
void DspInterface::SetSink(AudioCore::SinkType sink_type, std::string_view audio_device) {
|
void DspInterface::SetSink(AudioCore::SinkType sink_type, std::string_view audio_device) {
|
||||||
|
// Dispose of the current sink first to avoid contention.
|
||||||
|
sink.reset();
|
||||||
|
|
||||||
sink = CreateSinkFromID(sink_type, audio_device);
|
sink = CreateSinkFromID(sink_type, audio_device);
|
||||||
sink->SetCallback(
|
sink->SetCallback(
|
||||||
[this](s16* buffer, std::size_t num_frames) { OutputCallback(buffer, num_frames); });
|
[this](s16* buffer, std::size_t num_frames) { OutputCallback(buffer, num_frames); });
|
||||||
|
Loading…
Reference in New Issue
Block a user