From b6d8c111bc259021398adcc9820339c9376b5955 Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Sat, 7 Aug 2021 22:15:45 +0100 Subject: [PATCH] AudioCommon: make SoundLoop() non-virtual and private --- Source/Core/AudioCommon/AlsaSoundStream.h | 3 ++- Source/Core/AudioCommon/NullSoundStream.cpp | 4 ---- Source/Core/AudioCommon/NullSoundStream.h | 1 - Source/Core/AudioCommon/OpenALStream.h | 3 ++- Source/Core/AudioCommon/PulseAudioStream.h | 2 +- Source/Core/AudioCommon/SoundStream.h | 1 - Source/Core/AudioCommon/WASAPIStream.h | 3 ++- 7 files changed, 7 insertions(+), 10 deletions(-) diff --git a/Source/Core/AudioCommon/AlsaSoundStream.h b/Source/Core/AudioCommon/AlsaSoundStream.h index 8926cb34a6..37a4db2bf2 100644 --- a/Source/Core/AudioCommon/AlsaSoundStream.h +++ b/Source/Core/AudioCommon/AlsaSoundStream.h @@ -23,12 +23,13 @@ public: ~AlsaSound() override; bool Init() override; - void SoundLoop() override; bool SetRunning(bool running) override; static bool isValid() { return true; } private: + void SoundLoop(); + // maximum number of frames the buffer can hold static constexpr size_t BUFFER_SIZE_MAX = 8192; diff --git a/Source/Core/AudioCommon/NullSoundStream.cpp b/Source/Core/AudioCommon/NullSoundStream.cpp index fb97f23667..3c7a0ebb98 100644 --- a/Source/Core/AudioCommon/NullSoundStream.cpp +++ b/Source/Core/AudioCommon/NullSoundStream.cpp @@ -3,10 +3,6 @@ #include "AudioCommon/NullSoundStream.h" -void NullSound::SoundLoop() -{ -} - bool NullSound::Init() { return true; diff --git a/Source/Core/AudioCommon/NullSoundStream.h b/Source/Core/AudioCommon/NullSoundStream.h index 91cf113e7d..6d90092425 100644 --- a/Source/Core/AudioCommon/NullSoundStream.h +++ b/Source/Core/AudioCommon/NullSoundStream.h @@ -9,7 +9,6 @@ class NullSound final : public SoundStream { public: bool Init() override; - void SoundLoop() override; bool SetRunning(bool running) override; void SetVolume(int volume) override; diff --git a/Source/Core/AudioCommon/OpenALStream.h b/Source/Core/AudioCommon/OpenALStream.h index 4fb858069b..bb42bf6689 100644 --- a/Source/Core/AudioCommon/OpenALStream.h +++ b/Source/Core/AudioCommon/OpenALStream.h @@ -56,13 +56,14 @@ public: OpenALStream() : m_source(0) {} ~OpenALStream() override; bool Init() override; - void SoundLoop() override; void SetVolume(int volume) override; bool SetRunning(bool running) override; static bool isValid(); private: + void SoundLoop(); + std::thread m_thread; Common::Flag m_run_thread; diff --git a/Source/Core/AudioCommon/PulseAudioStream.h b/Source/Core/AudioCommon/PulseAudioStream.h index ad3519e21d..0be6143552 100644 --- a/Source/Core/AudioCommon/PulseAudioStream.h +++ b/Source/Core/AudioCommon/PulseAudioStream.h @@ -27,7 +27,7 @@ public: void UnderflowCallback(pa_stream* s); private: - void SoundLoop() override; + void SoundLoop(); bool PulseInit(); void PulseShutdown(); diff --git a/Source/Core/AudioCommon/SoundStream.h b/Source/Core/AudioCommon/SoundStream.h index dd6deecf9b..3fa4a1775a 100644 --- a/Source/Core/AudioCommon/SoundStream.h +++ b/Source/Core/AudioCommon/SoundStream.h @@ -20,7 +20,6 @@ public: Mixer* GetMixer() const { return m_mixer.get(); } virtual bool Init() { return false; } virtual void SetVolume(int) {} - virtual void SoundLoop() {} // Returns true if successful. virtual bool SetRunning(bool running) { return false; } }; diff --git a/Source/Core/AudioCommon/WASAPIStream.h b/Source/Core/AudioCommon/WASAPIStream.h index e9a751ee99..d0cdaf900c 100644 --- a/Source/Core/AudioCommon/WASAPIStream.h +++ b/Source/Core/AudioCommon/WASAPIStream.h @@ -35,13 +35,14 @@ public: ~WASAPIStream(); bool Init() override; bool SetRunning(bool running) override; - void SoundLoop() override; static bool isValid(); static std::vector GetAvailableDevices(); static Microsoft::WRL::ComPtr GetDeviceByName(std::string_view name); private: + void SoundLoop(); + u32 m_frames_in_buffer = 0; std::atomic m_running = false; std::thread m_thread;