From eea45ebcbe889a167490124c4ece218d38276e72 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Mon, 16 May 2016 12:14:07 -1000 Subject: [PATCH] Submix hierarchy deallocation fixes --- lib/audiodev/AudioSubmix.cpp | 4 ++++ lib/audiodev/AudioVoiceEngine.cpp | 8 ++++++++ lib/audiodev/AudioVoiceEngine.hpp | 1 + 3 files changed, 13 insertions(+) diff --git a/lib/audiodev/AudioSubmix.cpp b/lib/audiodev/AudioSubmix.cpp index 0efbb26..f409818 100644 --- a/lib/audiodev/AudioSubmix.cpp +++ b/lib/audiodev/AudioSubmix.cpp @@ -15,6 +15,10 @@ AudioSubmix::AudioSubmix(BaseAudioVoiceEngine& root, IAudioMix& parent, IAudioSu AudioSubmix::~AudioSubmix() { + while (m_activeVoices.size()) + m_activeVoices.front()->unbindVoice(); + while (m_activeSubmixes.size()) + m_activeSubmixes.front()->unbindSubmix(); unbindSubmix(); } diff --git a/lib/audiodev/AudioVoiceEngine.cpp b/lib/audiodev/AudioVoiceEngine.cpp index 3766379..e5482c9 100644 --- a/lib/audiodev/AudioVoiceEngine.cpp +++ b/lib/audiodev/AudioVoiceEngine.cpp @@ -4,6 +4,14 @@ namespace boo { +BaseAudioVoiceEngine::~BaseAudioVoiceEngine() +{ + while (m_activeVoices.size()) + m_activeVoices.front()->unbindVoice(); + while (m_activeSubmixes.size()) + m_activeSubmixes.front()->unbindSubmix(); +} + void BaseAudioVoiceEngine::_pumpAndMixVoices(size_t frames, int16_t* dataOut) { memset(dataOut, 0, sizeof(int16_t) * frames * m_mixInfo.m_channelMap.m_channelCount); diff --git a/lib/audiodev/AudioVoiceEngine.hpp b/lib/audiodev/AudioVoiceEngine.hpp index 6bce139..e29b9e7 100644 --- a/lib/audiodev/AudioVoiceEngine.hpp +++ b/lib/audiodev/AudioVoiceEngine.hpp @@ -46,6 +46,7 @@ protected: void _unbindFrom(std::list::iterator it); public: + ~BaseAudioVoiceEngine(); std::unique_ptr allocateNewMonoVoice(double sampleRate, IAudioVoiceCallback* cb, bool dynamicPitch=false);