Submix hierarchy deallocation fixes

This commit is contained in:
Jack Andersen 2016-05-16 12:14:07 -10:00
parent 80026d7fe6
commit eea45ebcbe
3 changed files with 13 additions and 0 deletions

View File

@ -15,6 +15,10 @@ AudioSubmix::AudioSubmix(BaseAudioVoiceEngine& root, IAudioMix& parent, IAudioSu
AudioSubmix::~AudioSubmix() AudioSubmix::~AudioSubmix()
{ {
while (m_activeVoices.size())
m_activeVoices.front()->unbindVoice();
while (m_activeSubmixes.size())
m_activeSubmixes.front()->unbindSubmix();
unbindSubmix(); unbindSubmix();
} }

View File

@ -4,6 +4,14 @@
namespace boo 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) void BaseAudioVoiceEngine::_pumpAndMixVoices(size_t frames, int16_t* dataOut)
{ {
memset(dataOut, 0, sizeof(int16_t) * frames * m_mixInfo.m_channelMap.m_channelCount); memset(dataOut, 0, sizeof(int16_t) * frames * m_mixInfo.m_channelMap.m_channelCount);

View File

@ -46,6 +46,7 @@ protected:
void _unbindFrom(std::list<AudioSubmix*>::iterator it); void _unbindFrom(std::list<AudioSubmix*>::iterator it);
public: public:
~BaseAudioVoiceEngine();
std::unique_ptr<IAudioVoice> allocateNewMonoVoice(double sampleRate, std::unique_ptr<IAudioVoice> allocateNewMonoVoice(double sampleRate,
IAudioVoiceCallback* cb, IAudioVoiceCallback* cb,
bool dynamicPitch=false); bool dynamicPitch=false);