all repos — mgba @ b0662fe76625ba45ebdf5bf387e1673c030fe5b0

mGBA Game Boy Advance Emulator

Run audio pausing in the right thread
Jeffrey Pfau jeffrey@endrift.com
Tue, 22 Jul 2014 01:13:27 -0700
commit

b0662fe76625ba45ebdf5bf387e1673c030fe5b0

parent

fe7deb0aabdcbc039a3981956b1421b317429b3e

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

jump to
M src/platform/qt/GameController.cppsrc/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.hsrc/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);