diff --git a/Source/Core/AudioCommon/WASAPIStream.cpp b/Source/Core/AudioCommon/WASAPIStream.cpp index 2abebd0e97..2d502c3f7c 100644 --- a/Source/Core/AudioCommon/WASAPIStream.cpp +++ b/Source/Core/AudioCommon/WASAPIStream.cpp @@ -45,12 +45,9 @@ WASAPIStream::WASAPIStream() WASAPIStream::~WASAPIStream() { - if (m_running) - { - m_running = false; - if (m_thread.joinable()) - m_thread.join(); - } + m_running = false; + if (m_thread.joinable()) + m_thread.join(); } bool WASAPIStream::isValid() @@ -332,7 +329,6 @@ bool WASAPIStream::SetRunning(bool running) m_running = true; m_thread = std::thread([this] { SoundLoop(); }); - m_thread.detach(); } else { @@ -341,10 +337,6 @@ bool WASAPIStream::SetRunning(bool running) if (m_thread.joinable()) m_thread.join(); - while (!m_stopped) - { - } - m_need_data_event.reset(); m_audio_renderer.Reset(); m_audio_client.Reset(); @@ -364,8 +356,6 @@ void WASAPIStream::SoundLoop() m_audio_renderer->ReleaseBuffer(m_frames_in_buffer, AUDCLNT_BUFFERFLAGS_SILENT); } - m_stopped = false; - while (m_running) { if (!m_audio_renderer) @@ -383,8 +373,6 @@ void WASAPIStream::SoundLoop() m_audio_renderer->ReleaseBuffer(m_frames_in_buffer, 0); } - - m_stopped = true; } #endif // _WIN32 diff --git a/Source/Core/AudioCommon/WASAPIStream.h b/Source/Core/AudioCommon/WASAPIStream.h index 39d2d5d986..b4337a378a 100644 --- a/Source/Core/AudioCommon/WASAPIStream.h +++ b/Source/Core/AudioCommon/WASAPIStream.h @@ -45,7 +45,6 @@ public: private: u32 m_frames_in_buffer = 0; std::atomic m_running = false; - std::atomic m_stopped = false; std::thread m_thread; // CoUninitialize must be called after all WASAPI COM objects have been destroyed,