diff --git a/src/wx/audio/internal/faudio.cpp b/src/wx/audio/internal/faudio.cpp index f896f9b5..17d0dfc5 100644 --- a/src/wx/audio/internal/faudio.cpp +++ b/src/wx/audio/internal/faudio.cpp @@ -59,6 +59,17 @@ int FAGetDev(FAudio* fa) { class FAudio_BufferNotify : public FAudioVoiceCallback { public: + FAudio_BufferNotify() { + OnBufferEnd = &FAudio_BufferNotify::StaticOnBufferEnd; + OnVoiceProcessingPassStart = &FAudio_BufferNotify::StaticOnVoiceProcessingPassStart; + OnVoiceProcessingPassEnd = &FAudio_BufferNotify::StaticOnVoiceProcessingPassEnd; + OnStreamEnd = &FAudio_BufferNotify::StaticOnStreamEnd; + OnBufferStart = &FAudio_BufferNotify::StaticOnBufferStart; + OnLoopEnd = &FAudio_BufferNotify::StaticOnLoopEnd; + OnVoiceError = &FAudio_BufferNotify::StaticOnVoiceError; + } + ~FAudio_BufferNotify() = default; + // Waits for the buffer end event to be signaled for 10 seconds. // Returns true if the buffer end event was signaled, false if the wait timed out. bool WaitForSignal() { @@ -71,17 +82,6 @@ public: return was_signaled; } - FAudio_BufferNotify() { - OnBufferEnd = &FAudio_BufferNotify::StaticOnBufferEnd; - OnVoiceProcessingPassStart = &FAudio_BufferNotify::StaticOnVoiceProcessingPassStart; - OnVoiceProcessingPassEnd = &FAudio_BufferNotify::StaticOnVoiceProcessingPassEnd; - OnStreamEnd = &FAudio_BufferNotify::StaticOnStreamEnd; - OnBufferStart = &FAudio_BufferNotify::StaticOnBufferStart; - OnLoopEnd = &FAudio_BufferNotify::StaticOnLoopEnd; - OnVoiceError = &FAudio_BufferNotify::StaticOnVoiceError; - } - ~FAudio_BufferNotify() = default; - private: // Signals that the buffer end event has occurred. void SignalBufferEnd() { @@ -391,7 +391,7 @@ void FAudio_Output::write(uint16_t* finalWave, int) { // the maximum number of buffers is currently queued if (!coreOptions.speedup && coreOptions.throttle && !gba_joybus_active) { // wait for one buffer to finish playing - if (notify.WaitForSignal()) { + if (!notify.WaitForSignal()) { device_changed = true; } } else { @@ -511,4 +511,4 @@ std::unique_ptr CreateFAudioDriver() { } } // namespace internal -} // namespace audio \ No newline at end of file +} // namespace audio