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;
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;

View File

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

View File

@ -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;

View File

@ -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;

View File

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

View File

@ -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; }
};

View File

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