mirror of https://github.com/mgba-emu/mgba.git
Qt: Fix setting audio and video sync without reloading the game
This commit is contained in:
parent
40f87518be
commit
4449361f5c
|
@ -345,6 +345,8 @@ void GameController::setConfig(const mCoreConfig* config) {
|
||||||
if (isLoaded()) {
|
if (isLoaded()) {
|
||||||
Interrupter interrupter(this);
|
Interrupter interrupter(this);
|
||||||
mCoreLoadForeignConfig(m_threadContext.core, config);
|
mCoreLoadForeignConfig(m_threadContext.core, config);
|
||||||
|
m_audioSync = m_threadContext.sync.audioWait;
|
||||||
|
m_videoSync = m_threadContext.sync.videoFrameWait;
|
||||||
m_audioProcessor->setInput(&m_threadContext);
|
m_audioProcessor->setInput(&m_threadContext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1098,6 +1100,17 @@ void GameController::setSync(bool enable) {
|
||||||
}
|
}
|
||||||
m_sync = enable;
|
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) {
|
void GameController::setAVStream(mAVStream* stream) {
|
||||||
Interrupter interrupter(this);
|
Interrupter interrupter(this);
|
||||||
m_stream = stream;
|
m_stream = stream;
|
||||||
|
|
|
@ -147,6 +147,8 @@ public slots:
|
||||||
void setTurbo(bool, bool forced = true);
|
void setTurbo(bool, bool forced = true);
|
||||||
void setTurboSpeed(float ratio);
|
void setTurboSpeed(float ratio);
|
||||||
void setSync(bool);
|
void setSync(bool);
|
||||||
|
void setAudioSync(bool);
|
||||||
|
void setVideoSync(bool);
|
||||||
void setAVStream(mAVStream*);
|
void setAVStream(mAVStream*);
|
||||||
void clearAVStream();
|
void clearAVStream();
|
||||||
void reloadAudioDriver();
|
void reloadAudioDriver();
|
||||||
|
|
|
@ -1157,14 +1157,14 @@ void Window::setupMenu(QMenuBar* menubar) {
|
||||||
ConfigOption* videoSync = m_config->addOption("videoSync");
|
ConfigOption* videoSync = m_config->addOption("videoSync");
|
||||||
videoSync->addBoolean(tr("Sync to &video"), emulationMenu);
|
videoSync->addBoolean(tr("Sync to &video"), emulationMenu);
|
||||||
videoSync->connect([this](const QVariant& value) {
|
videoSync->connect([this](const QVariant& value) {
|
||||||
reloadConfig();
|
m_controller->setVideoSync(value.toBool());
|
||||||
}, this);
|
}, this);
|
||||||
m_config->updateOption("videoSync");
|
m_config->updateOption("videoSync");
|
||||||
|
|
||||||
ConfigOption* audioSync = m_config->addOption("audioSync");
|
ConfigOption* audioSync = m_config->addOption("audioSync");
|
||||||
audioSync->addBoolean(tr("Sync to &audio"), emulationMenu);
|
audioSync->addBoolean(tr("Sync to &audio"), emulationMenu);
|
||||||
audioSync->connect([this](const QVariant& value) {
|
audioSync->connect([this](const QVariant& value) {
|
||||||
reloadConfig();
|
m_controller->setAudioSync(value.toBool());
|
||||||
}, this);
|
}, this);
|
||||||
m_config->updateOption("audioSync");
|
m_config->updateOption("audioSync");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue