summaryrefslogtreecommitdiff
path: root/Source/Core/AudioCommon/AlsaSoundStream.cpp
diff options
context:
space:
mode:
authorMarkus Wick <degasus@users.noreply.github.com>2018-01-02 09:58:36 +0100
committerGitHub <noreply@github.com>2018-01-02 09:58:36 +0100
commitcb168b184386f169aeb828f660ac63c5bc3e540c (patch)
treea7e89360ae75653e46536bd77d9fd27bd44774c1 /Source/Core/AudioCommon/AlsaSoundStream.cpp
parent26a9957285aac023ee7d35cf506b82381575df9a (diff)
parenta988a8a4587bf18d8ad8dba36653b803e3a583b4 (diff)
Merge pull request #6134 from ligfx/soundstreamlifecycle
SoundStream: change Start/Stop lifecycle to Init/SetRunning/destruct
Diffstat (limited to 'Source/Core/AudioCommon/AlsaSoundStream.cpp')
-rw-r--r--Source/Core/AudioCommon/AlsaSoundStream.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/Source/Core/AudioCommon/AlsaSoundStream.cpp b/Source/Core/AudioCommon/AlsaSoundStream.cpp
index 6345b7646b..fad5dde8b0 100644
--- a/Source/Core/AudioCommon/AlsaSoundStream.cpp
+++ b/Source/Core/AudioCommon/AlsaSoundStream.cpp
@@ -15,9 +15,19 @@ AlsaSound::AlsaSound()
{
}
-bool AlsaSound::Start()
+AlsaSound::~AlsaSound()
{
- m_thread_status.store(ALSAThreadStatus::RUNNING);
+ m_thread_status.store(ALSAThreadStatus::STOPPING);
+
+ // Give the opportunity to the audio thread
+ // to realize we are stopping the emulation
+ cv.notify_one();
+ thread.join();
+}
+
+bool AlsaSound::Init()
+{
+ m_thread_status.store(ALSAThreadStatus::PAUSED);
if (!AlsaInit())
{
m_thread_status.store(ALSAThreadStatus::STOPPED);
@@ -28,16 +38,6 @@ bool AlsaSound::Start()
return true;
}
-void AlsaSound::Stop()
-{
- m_thread_status.store(ALSAThreadStatus::STOPPING);
-
- // Give the opportunity to the audio thread
- // to realize we are stopping the emulation
- cv.notify_one();
- thread.join();
-}
-
void AlsaSound::Update()
{
// don't need to do anything here.
@@ -78,10 +78,11 @@ void AlsaSound::SoundLoop()
m_thread_status.store(ALSAThreadStatus::STOPPED);
}
-void AlsaSound::SetRunning(bool running)
+bool AlsaSound::SetRunning(bool running)
{
m_thread_status.store(running ? ALSAThreadStatus::RUNNING : ALSAThreadStatus::PAUSED);
cv.notify_one(); // Notify thread that status has changed
+ return true;
}
bool AlsaSound::AlsaInit()