mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 13:57:57 -07:00
Merge pull request #6133 from ligfx/soundstreamsetrunning
AudioCommon: rename ClearAudioBuffer(mute) to SetSoundStreamRunning(running)
This commit is contained in:
commit
a596424dc2
@ -78,10 +78,9 @@ void AlsaSound::SoundLoop()
|
||||
m_thread_status.store(ALSAThreadStatus::STOPPED);
|
||||
}
|
||||
|
||||
void AlsaSound::Clear(bool muted)
|
||||
void AlsaSound::SetRunning(bool running)
|
||||
{
|
||||
m_muted = muted;
|
||||
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
|
||||
}
|
||||
|
||||
|
@ -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:
|
||||
|
@ -159,10 +159,10 @@ void UpdateSoundStream()
|
||||
}
|
||||
}
|
||||
|
||||
void ClearAudioBuffer(bool mute)
|
||||
void SetSoundStreamRunning(bool running)
|
||||
{
|
||||
if (g_sound_stream)
|
||||
g_sound_stream->Clear(mute);
|
||||
g_sound_stream->SetRunning(running);
|
||||
}
|
||||
|
||||
void SendAIBuffer(const short* samples, unsigned int num_samples)
|
||||
|
@ -24,7 +24,7 @@ bool SupportsDPL2Decoder(const std::string& backend);
|
||||
bool SupportsLatencyControl(const std::string& backend);
|
||||
bool SupportsVolumeChanges(const std::string& backend);
|
||||
void UpdateSoundStream();
|
||||
void ClearAudioBuffer(bool mute);
|
||||
void SetSoundStreamRunning(bool running);
|
||||
void SendAIBuffer(const short* samples, unsigned int num_samples);
|
||||
void StartAudioDump();
|
||||
void StopAudioDump();
|
||||
|
@ -35,11 +35,6 @@ void NullSound::Update()
|
||||
m_mixer->Mix(m_realtime_buffer.data(), (unsigned int)num_samples_to_render);
|
||||
}
|
||||
|
||||
void NullSound::Clear(bool mute)
|
||||
{
|
||||
m_muted = mute;
|
||||
}
|
||||
|
||||
void NullSound::Stop()
|
||||
{
|
||||
}
|
||||
|
@ -14,7 +14,6 @@ public:
|
||||
void SoundLoop() override;
|
||||
void SetVolume(int volume) override;
|
||||
void Stop() override;
|
||||
void Clear(bool mute) override;
|
||||
void Update() override;
|
||||
|
||||
static bool isValid() { return true; }
|
||||
|
@ -161,17 +161,15 @@ void OpenALStream::Update()
|
||||
m_sound_sync_event.Set();
|
||||
}
|
||||
|
||||
void OpenALStream::Clear(bool mute)
|
||||
void OpenALStream::SetRunning(bool running)
|
||||
{
|
||||
m_muted = mute;
|
||||
|
||||
if (m_muted)
|
||||
if (running)
|
||||
{
|
||||
palSourceStop(m_source);
|
||||
palSourcePlay(m_source);
|
||||
}
|
||||
else
|
||||
{
|
||||
palSourcePlay(m_source);
|
||||
palSourceStop(m_source);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
|
@ -13,10 +13,9 @@ class SoundStream
|
||||
{
|
||||
protected:
|
||||
std::unique_ptr<Mixer> m_mixer;
|
||||
bool m_muted;
|
||||
|
||||
public:
|
||||
SoundStream() : m_mixer(new Mixer(48000)), m_muted(false) {}
|
||||
SoundStream() : m_mixer(new Mixer(48000)) {}
|
||||
virtual ~SoundStream() {}
|
||||
static bool isValid() { return false; }
|
||||
Mixer* GetMixer() const { return m_mixer.get(); }
|
||||
@ -25,6 +24,5 @@ public:
|
||||
virtual void SoundLoop() {}
|
||||
virtual void Stop() {}
|
||||
virtual void Update() {}
|
||||
virtual void Clear(bool mute) { m_muted = mute; }
|
||||
bool IsMuted() const { return m_muted; }
|
||||
virtual void SetRunning(bool running) {}
|
||||
};
|
||||
|
@ -210,16 +210,14 @@ void XAudio2::SetVolume(int volume)
|
||||
m_mastering_voice->SetVolume(m_volume);
|
||||
}
|
||||
|
||||
void XAudio2::Clear(bool mute)
|
||||
void XAudio2::SetRunning(bool running)
|
||||
{
|
||||
m_muted = mute;
|
||||
|
||||
if (m_voice_context)
|
||||
{
|
||||
if (m_muted)
|
||||
m_voice_context->Stop();
|
||||
else
|
||||
if (running)
|
||||
m_voice_context->Play();
|
||||
else
|
||||
m_voice_context->Stop();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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(); }
|
||||
|
@ -198,16 +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)
|
||||
{
|
||||
m_muted = mute;
|
||||
|
||||
if (m_voice_context)
|
||||
{
|
||||
if (m_muted)
|
||||
m_voice_context->Stop();
|
||||
else
|
||||
if (running)
|
||||
m_voice_context->Play();
|
||||
else
|
||||
m_voice_context->Stop();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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(); }
|
||||
|
@ -147,7 +147,7 @@ static void RunAdjacentSystems(bool running)
|
||||
{
|
||||
// NOTE: We're assuming these will not try to call Break or EnableStepping.
|
||||
Fifo::EmulatorState(running);
|
||||
AudioCommon::ClearAudioBuffer(!running);
|
||||
AudioCommon::SetSoundStreamRunning(running);
|
||||
}
|
||||
|
||||
void Stop()
|
||||
|
Loading…
Reference in New Issue
Block a user