SoundStream: rename Clear(mute) to SetRunning(running)

This commit is contained in:
Michael M 2017-10-21 12:37:39 -07:00
parent d6985fc3e8
commit b031d3316c
10 changed files with 20 additions and 20 deletions

View File

@ -78,9 +78,9 @@ void AlsaSound::SoundLoop()
m_thread_status.store(ALSAThreadStatus::STOPPED);
}
void AlsaSound::Clear(bool muted)
void AlsaSound::SetRunning(bool running)
{
m_thread_status.store(muted ? ALSAThreadStatus::PAUSED : ALSAThreadStatus::RUNNING);
m_thread_status.store(running ? ALSAThreadStatus::RUNNING : ALSAThreadStatus::PAUSED);
cv.notify_one(); // Notify thread that status has changed
}

View File

@ -26,7 +26,7 @@ public:
void SoundLoop() override;
void Stop() override;
void Update() override;
void Clear(bool) override;
void SetRunning(bool running) override;
static bool isValid() { return true; }
private:

View File

@ -162,7 +162,7 @@ void UpdateSoundStream()
void SetSoundStreamRunning(bool running)
{
if (g_sound_stream)
g_sound_stream->Clear(running);
g_sound_stream->SetRunning(running);
}
void SendAIBuffer(const short* samples, unsigned int num_samples)

View File

@ -161,15 +161,15 @@ void OpenALStream::Update()
m_sound_sync_event.Set();
}
void OpenALStream::Clear(bool mute)
void OpenALStream::SetRunning(bool running)
{
if (mute)
if (running)
{
palSourceStop(m_source);
palSourcePlay(m_source);
}
else
{
palSourcePlay(m_source);
palSourceStop(m_source);
}
}

View File

@ -59,7 +59,7 @@ public:
void SoundLoop() override;
void SetVolume(int volume) override;
void Stop() override;
void Clear(bool mute) override;
void SetRunning(bool running) override;
void Update() override;
static bool isValid();

View File

@ -24,5 +24,5 @@ public:
virtual void SoundLoop() {}
virtual void Stop() {}
virtual void Update() {}
virtual void Clear(bool mute) {}
virtual void SetRunning(bool running) {}
};

View File

@ -210,14 +210,14 @@ void XAudio2::SetVolume(int volume)
m_mastering_voice->SetVolume(m_volume);
}
void XAudio2::Clear(bool mute)
void XAudio2::SetRunning(bool running)
{
if (m_voice_context)
{
if (mute)
m_voice_context->Stop();
else
if (running)
m_voice_context->Play();
else
m_voice_context->Stop();
}
}

View File

@ -59,7 +59,7 @@ public:
bool Start() override;
void Stop() override;
void Clear(bool mute) override;
void SetRunning(bool running) override;
void SetVolume(int volume) override;
static bool isValid() { return InitLibrary(); }

View File

@ -198,14 +198,14 @@ void XAudio2_7::SetVolume(int volume)
m_mastering_voice->SetVolume(m_volume);
}
void XAudio2_7::Clear(bool mute)
void XAudio2_7::SetRunning(bool running)
{
if (m_voice_context)
{
if (mute)
m_voice_context->Stop();
else
if (running)
m_voice_context->Play();
else
m_voice_context->Stop();
}
}

View File

@ -64,7 +64,7 @@ public:
bool Start() override;
void Stop() override;
void Clear(bool mute) override;
void SetRunning(bool running) override;
void SetVolume(int volume) override;
static bool isValid() { return InitLibrary(); }