SDL3pp
A slim C++ wrapper for SDL3
|
Handle to an owned audioStream. More...
Public Member Functions | |
constexpr | AudioStream (SDL_AudioStream *resource={}) |
Constructs from the underlying resource. | |
constexpr | AudioStream (const AudioStream &other)=delete |
constexpr | AudioStream (AudioStream &&other)=default |
Move constructor. | |
~AudioStream () | |
Frees up resource when object goes out of scope. | |
AudioStream & | operator= (AudioStream other) |
Assignment operator. | |
constexpr | AudioStreamRef (const AudioStreamRef &other) |
Copy constructor. | |
constexpr | AudioStreamRef (AudioStreamRef &&other) |
Move constructor. | |
![]() | |
constexpr | AudioStreamRef (const AudioStreamRef &other) |
Copy constructor. | |
constexpr | AudioStreamRef (AudioStreamRef &&other) |
Move constructor. | |
constexpr | ~AudioStreamRef ()=default |
Default constructor. | |
AudioStreamRef & | operator= (AudioStreamRef other) |
Assignment operator. | |
void | reset (SDL_AudioStream *newResource={}) |
Free an audio stream. | |
AudioStreamBase (OptionalRef< const AudioSpec > src_spec, OptionalRef< const AudioSpec > dst_spec) | |
Create a new audio stream. | |
AudioStreamBase (const AudioDeviceBase &devid, OptionalRef< const AudioSpec > spec=std::nullopt, AudioStreamCallback callback=nullptr, void *userdata=nullptr) | |
Convenience function for straightforward audio init for the common case. | |
AudioStreamBase (const AudioDeviceBase &devid, OptionalRef< const AudioSpec > spec, AudioStreamCB callback) | |
Convenience function for straightforward audio init for the common case. | |
![]() | |
AudioStreamBase (OptionalRef< const AudioSpec > src_spec, OptionalRef< const AudioSpec > dst_spec) | |
Create a new audio stream. | |
AudioStreamBase (const AudioDeviceBase &devid, OptionalRef< const AudioSpec > spec=std::nullopt, AudioStreamCallback callback=nullptr, void *userdata=nullptr) | |
Convenience function for straightforward audio init for the common case. | |
AudioStreamBase (const AudioDeviceBase &devid, OptionalRef< const AudioSpec > spec, AudioStreamCB callback) | |
Convenience function for straightforward audio init for the common case. | |
PropertiesRef | GetProperties () const |
Get the properties associated with an audio stream. | |
AudioSpec | GetInputFormat () const |
Query the current input format of an audio stream. | |
AudioSpec | GetOutputFormat () const |
Query the current output format of an audio stream. | |
void | GetFormat (AudioSpec *src_spec, AudioSpec *dst_spec) const |
Query the current format of an audio stream. | |
void | SetInputFormat (const AudioSpec &spec) |
Change the input format of an audio stream. | |
void | SetOutputFormat (const AudioSpec &spec) |
Change the output format of an audio stream. | |
void | SetFormat (OptionalRef< const AudioSpec > src_spec, OptionalRef< const AudioSpec > dst_spec) |
Change the input and output formats of an audio stream. | |
float | GetFrequencyRatio () const |
Get the frequency ratio of an audio stream. | |
void | SetFrequencyRatio (float ratio) |
Change the frequency ratio of an audio stream. | |
float | GetGain () const |
Get the gain of an audio stream. | |
void | SetGain (float gain) |
Change the gain of an audio stream. | |
OwnArray< int > | GetInputChannelMap () const |
Get the current input channel map of an audio stream. | |
OwnArray< int > | GetOutputChannelMap () const |
Get the current output channel map of an audio stream. | |
void | SetInputChannelMap (std::span< int > chmap) |
Set the current input channel map of an audio stream. | |
void | SetOutputChannelMap (std::span< int > chmap) |
Set the current output channel map of an audio stream. | |
void | PutData (SourceBytes buf) |
Add data to the stream. | |
int | GetData (TargetBytes buf) |
Get converted/resampled data from the stream. | |
int | GetAvailable () const |
Get the number of converted/resampled bytes available. | |
int | GetQueued () const |
Get the number of bytes currently queued. | |
void | Flush () |
Tell the stream that you're done sending data, and anything being buffered should be converted/resampled and made available immediately. | |
void | Clear () |
Clear any pending data in the stream. | |
void | PauseDevice () |
Use this function to pause audio playback on the audio device associated with an audio stream. | |
void | ResumeDevice () |
Use this function to unpause audio playback on the audio device associated with an audio stream. | |
bool | DevicePaused () const |
Use this function to query if an audio device associated with a stream is paused. | |
AudioStreamLock | Lock () |
Lock an audio stream for serialized access. | |
void | SetGetCallback (AudioStreamCB callback) |
Set a callback that runs when data is requested from an audio stream. | |
void | SetGetCallback (AudioStreamCallback callback, void *userdata) |
Set a callback that runs when data is requested from an audio stream. | |
void | SetPutCallback (AudioStreamCB callback) |
Set a callback that runs when data is added to an audio stream. | |
void | SetPutCallback (AudioStreamCallback callback, void *userdata) |
Set a callback that runs when data is added to an audio stream. | |
void | Bind (AudioDeviceBase &devid) |
Bind a single audio stream to an audio device. | |
void | Unbind () |
Unbind a single audio stream from its audio device. | |
AudioDeviceRef | GetDevice () const |
Query an audio stream for its currently-bound device. | |
constexpr | Resource (T resource={}) |
Constructs the underlying resource. | |
constexpr | Resource (std::nullptr_t) |
Equivalent to default ctor. | |
constexpr | Resource (std::nullopt_t) |
Equivalent to default ctor. | |
Resource (const Resource &other)=delete | |
Resource (Resource &&other)=delete | |
![]() | |
constexpr | Resource (SDL_AudioStream * resource={}) |
Constructs the underlying resource. | |
constexpr | Resource (std::nullptr_t) |
Equivalent to default ctor. | |
constexpr | Resource (std::nullopt_t) |
Equivalent to default ctor. | |
Resource (const Resource &other)=delete | |
Resource (Resource &&other)=delete | |
Resource & | operator= (const Resource &other)=delete |
Resource & | operator= (Resource &&other)=delete |
constexpr | operator bool () const |
True if contains a valid resource. | |
constexpr bool | operator== (const Resource &other) const=default |
Comparison. | |
constexpr bool | operator== (std::nullopt_t) const |
Comparison. | |
constexpr bool | operator== (std::nullptr_t) const |
Comparison. | |
constexpr SDL_AudioStream * | get () const |
Return contained resource;. | |
constexpr SDL_AudioStream * | release (SDL_AudioStream * newResource={}) |
Return contained resource and empties or replace value. | |
constexpr const SDL_AudioStream * | operator-> () const |
Access to fields. | |
constexpr SDL_AudioStream * | operator-> () |
Access to fields. | |