diff --git a/src/player.cpp b/src/player.cpp index eb98d7b..346894b 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -885,9 +885,10 @@ bool ConsolePlayer::open (void) int delay = isNTSC ? 16 : 20; m_thread = new std::thread([this](int delay) { - while (m_state == playerRunning) + while (m_state != playerStopped) { - updateDisplay(); + if (m_state == playerRunning) + updateDisplay(); std::this_thread::sleep_for(std::chrono::milliseconds(delay)); } }, delay); @@ -897,7 +898,7 @@ bool ConsolePlayer::open (void) void ConsolePlayer::close () { - m_engine.stop(); + stop(); if (m_state == playerExit) { // Natural finish emuflush (); diff --git a/src/player.h b/src/player.h index 3532c0c..d5416ee 100644 --- a/src/player.h +++ b/src/player.h @@ -148,7 +148,9 @@ class ConsolePlayer sidplayfp m_engine; SidConfig m_engCfg; SidTune m_tune; - player_state_t m_state; + + std::atomic m_state; + const char* m_outfile; std::string m_filename;