Qt: Fix thread sync issues with QtMultimedia audio driver
Jeffrey Pfau jeffrey@endrift.com
Sat, 21 Feb 2015 02:44:59 -0800
2 files changed,
3 insertions(+),
1 deletions(-)
M
src/platform/qt/AudioDevice.cpp
→
src/platform/qt/AudioDevice.cpp
@@ -34,6 +34,7 @@ double fauxClock = GBAAudioCalculateRatio(1, m_context->fpsTarget, 1);
GBASyncLockAudio(&m_context->sync); blip_set_rates(m_context->gba->audio.left, GBA_ARM7TDMI_FREQUENCY, format.sampleRate() * fauxClock); blip_set_rates(m_context->gba->audio.right, GBA_ARM7TDMI_FREQUENCY, format.sampleRate() * fauxClock); + GBASyncUnlockAudio(&m_context->sync); #endif }@@ -53,6 +54,7 @@
#if RESAMPLE_LIBRARY == RESAMPLE_NN return GBAAudioResampleNN(&m_context->gba->audio, m_ratio, &m_drift, reinterpret_cast<GBAStereoSample*>(data), maxSize / sizeof(GBAStereoSample)) * sizeof(GBAStereoSample); #elif RESAMPLE_LIBRARY == RESAMPLE_BLIP_BUF + GBASyncLockAudio(&m_context->sync); int available = blip_samples_avail(m_context->gba->audio.left); if (available > maxSize / sizeof(GBAStereoSample)) { available = maxSize / sizeof(GBAStereoSample);
M
src/platform/qt/GameController.cpp
→
src/platform/qt/GameController.cpp
@@ -461,7 +461,7 @@ threadContinue();
} void GameController::reloadAudioDriver() { - m_audioProcessor->pause(); + QMetaObject::invokeMethod(m_audioProcessor, "pause", Qt::BlockingQueuedConnection); delete m_audioProcessor; m_audioProcessor = AudioProcessor::create(); m_audioProcessor->moveToThread(m_audioThread);