Qt: Copy state from old audio processor to new

This commit is contained in:
Jeffrey Pfau 2015-02-22 21:17:41 -08:00
parent 27c4308ef5
commit afbadf242b
1 changed files with 2 additions and 0 deletions

View File

@ -464,8 +464,10 @@ void GameController::clearAVStream() {
void GameController::reloadAudioDriver() { void GameController::reloadAudioDriver() {
QMetaObject::invokeMethod(m_audioProcessor, "pause", Qt::BlockingQueuedConnection); QMetaObject::invokeMethod(m_audioProcessor, "pause", Qt::BlockingQueuedConnection);
int samples = m_audioProcessor->getBufferSamples();
delete m_audioProcessor; delete m_audioProcessor;
m_audioProcessor = AudioProcessor::create(); m_audioProcessor = AudioProcessor::create();
m_audioProcessor->setBufferSamples(samples);
m_audioProcessor->moveToThread(m_audioThread); m_audioProcessor->moveToThread(m_audioThread);
connect(this, SIGNAL(gameStarted(GBAThread*)), m_audioProcessor, SLOT(start())); connect(this, SIGNAL(gameStarted(GBAThread*)), m_audioProcessor, SLOT(start()));
connect(this, SIGNAL(gameStopped(GBAThread*)), m_audioProcessor, SLOT(pause())); connect(this, SIGNAL(gameStopped(GBAThread*)), m_audioProcessor, SLOT(pause()));