mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-31 21:28:51 +00:00
SoundStream: change Start/Stop to Init/SetRunning/destruct
This commit is contained in:
parent
ad4a89d64b
commit
0baddbf9a8
18 changed files with 102 additions and 121 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue