Run audio pausing in the right thread
Jeffrey Pfau jeffrey@endrift.com
Tue, 22 Jul 2014 01:13:27 -0700
2 files changed,
7 insertions(+),
3 deletions(-)
M
src/platform/qt/GameController.cpp
→
src/platform/qt/GameController.cpp
@@ -64,6 +64,9 @@
m_audioThread->start(); m_audioProcessor->moveToThread(m_audioThread); connect(this, SIGNAL(gameStarted(GBAThread*)), m_audioProcessor, SLOT(start())); + connect(this, SIGNAL(gameStopped(GBAThread*)), m_audioProcessor, SLOT(pause())); + connect(this, SIGNAL(gamePaused(GBAThread*)), m_audioProcessor, SLOT(pause())); + connect(this, SIGNAL(gameUnpaused(GBAThread*)), m_audioProcessor, SLOT(start())); #ifdef BUILD_SDL connect(this, SIGNAL(frameAvailable(const uint32_t*)), this, SLOT(testSDLEvents()));@@ -71,7 +74,6 @@ #endif
} GameController::~GameController() { - m_audioProcessor->pause(); m_audioThread->quit(); if (GBAThreadIsPaused(&m_threadContext)) { GBAThreadUnpause(&m_threadContext);@@ -140,10 +142,10 @@ return;
} if (paused) { GBAThreadPause(&m_threadContext); - m_audioProcessor->pause(); + emit gamePaused(&m_threadContext); } else { - m_audioProcessor->start(); GBAThreadUnpause(&m_threadContext); + emit gameUnpaused(&m_threadContext); } }
M
src/platform/qt/GameController.h
→
src/platform/qt/GameController.h
@@ -43,6 +43,8 @@ signals:
void frameAvailable(const uint32_t*); void gameStarted(GBAThread*); void gameStopped(GBAThread*); + void gamePaused(GBAThread*); + void gameUnpaused(GBAThread*); public slots: void loadGame(const QString& path);