19 AudioChannelsSetting::audioStereo;
69 void Play(
const uint8_t* buf,
size_t len);
146 virtual void DoPlay(
const uint8_t* buf,
size_t len) = 0;
149 std::unique_ptr<SoundMatrixDecoder>
153 bool mInitialized =
false;
AudioChannelsSetting
Selects the number and arrangement of output audio channels.
Definition AudioChannelsSetting.h:9
Abstract base class for platform-specific audio output backends.
Definition AudioPlayer.h:32
void Play(const uint8_t *buf, size_t len)
Submits a frame of PCM audio to the output device.
int32_t GetSampleLength() const
Returns the configured number of samples per audio frame.
bool SetAudioChannels(AudioChannelsSetting channels)
Changes the channel mode and reinitialises the audio device.
virtual void DoClose()=0
Closes the platform audio device and releases its resources.
void SetDesiredBuffered(int32_t size)
Sets the target number of buffered frames.
int32_t GetSampleRate() const
Returns the configured output sample rate in Hz.
int32_t GetDesiredBuffered() const
Returns the target number of frames to keep buffered.
virtual void DoPlay(const uint8_t *buf, size_t len)=0
Writes interleaved PCM samples to the platform audio device.
bool IsInitialized()
Returns true if Init() has been called and succeeded.
virtual bool DoInit()=0
Opens and configures the platform audio device.
AudioChannelsSetting GetAudioChannels() const
Returns the current channel-output mode.
int32_t GetNumOutputChannels() const
Returns the number of output channels implied by the current channel setting.
void SetSampleLength(int32_t length)
Sets the number of samples per audio frame.
bool Init()
Calls DoInit() and sets the initialised flag on success.
virtual int32_t Buffered()=0
Returns the number of audio frames currently queued in the device buffer.
void SetSampleRate(int32_t rate)
Sets the output sample rate.
AudioPlayer(AudioSettings settings)
Constructs an AudioPlayer with the given configuration.
Definition AudioPlayer.h:39
Core namespace for the libultraship engine framework.
Definition gfx_direct3d_common.h:14
Configuration parameters shared by all AudioPlayer backends.
Definition AudioPlayer.h:14
int32_t SampleLength
Number of samples per audio frame.
Definition AudioPlayer.h:16
AudioChannelsSetting ChannelSetting
Channel mode (stereo / 5.1 matrix / 5.1 raw).
Definition AudioPlayer.h:18
int32_t DesiredBuffered
Target number of frames to keep buffered.
Definition AudioPlayer.h:17
int32_t SampleRate
Output sample rate in Hz.
Definition AudioPlayer.h:15