all repos — mgba @ 4449361f5c61f6c13829bb1f37a706f652592f03

mGBA Game Boy Advance Emulator

Qt: Fix setting audio and video sync without reloading the game
Vicki Pfau vi@endrift.com
Sat, 01 Apr 2017 14:08:19 -0700
commit

4449361f5c61f6c13829bb1f37a706f652592f03

parent

40f87518be2d84bcfa650d55568ee39c2ac6294d

3 files changed, 17 insertions(+), 2 deletions(-)

jump to
M src/platform/qt/GameController.cppsrc/platform/qt/GameController.cpp

@@ -345,6 +345,8 @@ m_config = config;

if (isLoaded()) { Interrupter interrupter(this); mCoreLoadForeignConfig(m_threadContext.core, config); + m_audioSync = m_threadContext.sync.audioWait; + m_videoSync = m_threadContext.sync.videoFrameWait; m_audioProcessor->setInput(&m_threadContext); } }

@@ -1098,6 +1100,17 @@ m_threadContext.sync.videoFrameWait = m_videoSync;

} m_sync = enable; } + +void GameController::setAudioSync(bool enable) { + m_audioSync = enable; + m_threadContext.sync.audioWait = enable; +} + +void GameController::setVideoSync(bool enable) { + m_videoSync = enable; + m_threadContext.sync.videoFrameWait = enable; +} + void GameController::setAVStream(mAVStream* stream) { Interrupter interrupter(this); m_stream = stream;
M src/platform/qt/GameController.hsrc/platform/qt/GameController.h

@@ -147,6 +147,8 @@ void saveBackupState();

void setTurbo(bool, bool forced = true); void setTurboSpeed(float ratio); void setSync(bool); + void setAudioSync(bool); + void setVideoSync(bool); void setAVStream(mAVStream*); void clearAVStream(); void reloadAudioDriver();
M src/platform/qt/Window.cppsrc/platform/qt/Window.cpp

@@ -1157,14 +1157,14 @@

ConfigOption* videoSync = m_config->addOption("videoSync"); videoSync->addBoolean(tr("Sync to &video"), emulationMenu); videoSync->connect([this](const QVariant& value) { - reloadConfig(); + m_controller->setVideoSync(value.toBool()); }, this); m_config->updateOption("videoSync"); ConfigOption* audioSync = m_config->addOption("audioSync"); audioSync->addBoolean(tr("Sync to &audio"), emulationMenu); audioSync->connect([this](const QVariant& value) { - reloadConfig(); + m_controller->setAudioSync(value.toBool()); }, this); m_config->updateOption("audioSync");