mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2025-01-18 06:25:37 +00:00
NullAudioStream: Provide factory function
This commit is contained in:
parent
e66214d93e
commit
6176fc4486
|
@ -18,3 +18,8 @@ void NullAudioStream::BufferAvailable()
|
|||
// drop any buffer as soon as they're available
|
||||
DropBuffer();
|
||||
}
|
||||
|
||||
std::unique_ptr<AudioStream> NullAudioStream::Create()
|
||||
{
|
||||
return std::unique_ptr<AudioStream>(new NullAudioStream());
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
class NullAudioStream final : public AudioStream
|
||||
{
|
||||
public:
|
||||
NullAudioStream();
|
||||
~NullAudioStream();
|
||||
|
||||
static std::unique_ptr<AudioStream> Create();
|
||||
|
@ -14,4 +13,7 @@ protected:
|
|||
void PauseDevice(bool paused) override;
|
||||
void CloseDevice() override;
|
||||
void BufferAvailable() override;
|
||||
|
||||
private:
|
||||
NullAudioStream();
|
||||
};
|
||||
|
|
|
@ -130,7 +130,7 @@ void SDLHostInterface::CreateAudioStream()
|
|||
switch (m_settings.audio_backend)
|
||||
{
|
||||
case AudioBackend::Null:
|
||||
m_audio_stream = std::make_unique<NullAudioStream>();
|
||||
m_audio_stream = NullAudioStream::Create();
|
||||
break;
|
||||
|
||||
case AudioBackend::Default:
|
||||
|
@ -143,7 +143,7 @@ void SDLHostInterface::CreateAudioStream()
|
|||
{
|
||||
ReportError("Failed to recreate audio stream, falling back to null");
|
||||
m_audio_stream.reset();
|
||||
m_audio_stream = std::make_unique<NullAudioStream>();
|
||||
m_audio_stream = NullAudioStream::Create();
|
||||
if (!m_audio_stream->Reconfigure(44100, 2))
|
||||
Panic("Failed to reconfigure null audio stream");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue