From b0662fe76625ba45ebdf5bf387e1673c030fe5b0 Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Tue, 22 Jul 2014 01:13:27 -0700 Subject: [PATCH] Run audio pausing in the right thread --- src/platform/qt/GameController.cpp | 8 +++++--- src/platform/qt/GameController.h | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/platform/qt/GameController.cpp b/src/platform/qt/GameController.cpp index 9b903cbfd..1b1a8e6f3 100644 --- a/src/platform/qt/GameController.cpp +++ b/src/platform/qt/GameController.cpp @@ -64,6 +64,9 @@ GameController::GameController(QObject* parent) 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 @@ GameController::GameController(QObject* parent) } GameController::~GameController() { - m_audioProcessor->pause(); m_audioThread->quit(); if (GBAThreadIsPaused(&m_threadContext)) { GBAThreadUnpause(&m_threadContext); @@ -140,10 +142,10 @@ void GameController::setPaused(bool paused) { } if (paused) { GBAThreadPause(&m_threadContext); - m_audioProcessor->pause(); + emit gamePaused(&m_threadContext); } else { - m_audioProcessor->start(); GBAThreadUnpause(&m_threadContext); + emit gameUnpaused(&m_threadContext); } } diff --git a/src/platform/qt/GameController.h b/src/platform/qt/GameController.h index 2e04e1762..251d00d40 100644 --- a/src/platform/qt/GameController.h +++ b/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);