asge::audio::AudioStream
A shared handle to one SDL_AudioStream bound to an AudioDevice, plus the slot it occupies in that device's stream pool.
#include <AudioStream.hpp>Copies share the same underlying SDL_AudioStream (via shared_ptr) and the same Index() AudioDevice::CreateStream is the only place a fresh one is minted. Not meant to be constructed directly by callers other than AudioDevice; see its doc comment for how the pool owns these slots.
Private Attributes
Public Member Functions
AudioStream()AudioStream(std::shared_ptr< SDL_AudioStream > inStream, std::size_t inIdx)AudioStream(AudioStream const &)=defaultAudioStream(AudioStream &&)=defaultAudioStream & operator=(AudioStream const &)=defaultAudioStream & operator=(AudioStream &&)=defaultstd::size_t Index() const noexceptThis stream's slot index in its owning AudioDevice's pool, or -1 once detached.
void Index(std::size_t inIndex) noexceptvoid Reset() noexceptBoolResult ClearData() noexceptDiscards any PCM data currently queued on this stream.
BoolResult PutData(media::AudioClip &inClip) noexceptQueues inClip's whole PCM buffer onto this stream and flushes it for playback.
bool IsDataAvailable() const noexceptTrue if this stream still has queued PCM data the device hasn't consumed yet.
BoolResult SetAudioGain(float inVolume) noexceptSets this stream's own playback gain (1.0 = unchanged, 0.0 = silent), independent of the device's master gain.