AudioCommon: make SoundLoop() non-virtual and private

This commit is contained in:
Tillmann Karras 2021-08-07 22:15:45 +01:00
parent d14b9a73b2
commit b6d8c111bc
7 changed files with 7 additions and 10 deletions

View File

@ -23,12 +23,13 @@ public:
~AlsaSound() override; ~AlsaSound() override;
bool Init() override; bool Init() override;
void SoundLoop() override;
bool SetRunning(bool running) override; bool SetRunning(bool running) override;
static bool isValid() { return true; } static bool isValid() { return true; }
private: private:
void SoundLoop();
// maximum number of frames the buffer can hold // maximum number of frames the buffer can hold
static constexpr size_t BUFFER_SIZE_MAX = 8192; static constexpr size_t BUFFER_SIZE_MAX = 8192;

View File

@ -3,10 +3,6 @@
#include "AudioCommon/NullSoundStream.h" #include "AudioCommon/NullSoundStream.h"
void NullSound::SoundLoop()
{
}
bool NullSound::Init() bool NullSound::Init()
{ {
return true; return true;

View File

@ -9,7 +9,6 @@ class NullSound final : public SoundStream
{ {
public: public:
bool Init() override; bool Init() override;
void SoundLoop() override;
bool SetRunning(bool running) override; bool SetRunning(bool running) override;
void SetVolume(int volume) override; void SetVolume(int volume) override;

View File

@ -56,13 +56,14 @@ public:
OpenALStream() : m_source(0) {} OpenALStream() : m_source(0) {}
~OpenALStream() override; ~OpenALStream() override;
bool Init() override; bool Init() override;
void SoundLoop() override;
void SetVolume(int volume) override; void SetVolume(int volume) override;
bool SetRunning(bool running) override; bool SetRunning(bool running) override;
static bool isValid(); static bool isValid();
private: private:
void SoundLoop();
std::thread m_thread; std::thread m_thread;
Common::Flag m_run_thread; Common::Flag m_run_thread;

View File

@ -27,7 +27,7 @@ public:
void UnderflowCallback(pa_stream* s); void UnderflowCallback(pa_stream* s);
private: private:
void SoundLoop() override; void SoundLoop();
bool PulseInit(); bool PulseInit();
void PulseShutdown(); void PulseShutdown();

View File

@ -20,7 +20,6 @@ public:
Mixer* GetMixer() const { return m_mixer.get(); } Mixer* GetMixer() const { return m_mixer.get(); }
virtual bool Init() { return false; } virtual bool Init() { return false; }
virtual void SetVolume(int) {} virtual void SetVolume(int) {}
virtual void SoundLoop() {}
// Returns true if successful. // Returns true if successful.
virtual bool SetRunning(bool running) { return false; } virtual bool SetRunning(bool running) { return false; }
}; };

View File

@ -35,13 +35,14 @@ public:
~WASAPIStream(); ~WASAPIStream();
bool Init() override; bool Init() override;
bool SetRunning(bool running) override; bool SetRunning(bool running) override;
void SoundLoop() override;
static bool isValid(); static bool isValid();
static std::vector<std::string> GetAvailableDevices(); static std::vector<std::string> GetAvailableDevices();
static Microsoft::WRL::ComPtr<IMMDevice> GetDeviceByName(std::string_view name); static Microsoft::WRL::ComPtr<IMMDevice> GetDeviceByName(std::string_view name);
private: private:
void SoundLoop();
u32 m_frames_in_buffer = 0; u32 m_frames_in_buffer = 0;
std::atomic<bool> m_running = false; std::atomic<bool> m_running = false;
std::thread m_thread; std::thread m_thread;