Add ability to unregister audio callback

This commit is contained in:
Jack Andersen 2017-01-22 21:20:40 -10:00
parent d6b54a3718
commit 7bf2ad48a7
3 changed files with 9 additions and 0 deletions

View File

@ -38,6 +38,9 @@ struct IAudioVoiceEngine
/** Client may optionally register a 200-virtual-updates each second callback for the stream */
virtual void register5MsCallback(std::function<void(double dt)>&& callback)=0;
/** Unregister callback for stable cleanup */
virtual void unregister5MsCallback()=0;
/** Client may use this to determine current speaker-setup */
virtual AudioChannelSet getAvailableSet()=0;

View File

@ -202,6 +202,11 @@ void BaseAudioVoiceEngine::register5MsCallback(std::function<void(double dt)>&&
m_5msCallback = std::move(callback);
}
void BaseAudioVoiceEngine::unregister5MsCallback()
{
m_5msCallback = {};
}
void BaseAudioVoiceEngine::setVolume(float vol)
{
m_totalVol = vol;

View File

@ -69,6 +69,7 @@ public:
std::unique_ptr<IAudioSubmix> allocateNewSubmix(bool mainOut, IAudioSubmixCallback* cb, int busId);
void register5MsCallback(std::function<void(double dt)>&& callback);
void unregister5MsCallback();
void setVolume(float vol);
const AudioVoiceEngineMixInfo& mixInfo() const;