|
SDL3pp
A slim C++ wrapper for SDL3
|
The opaque handle that represents an audio stream. More...
Public Member Functions | |
| constexpr | AudioStream (AudioStreamRaw resource) noexcept |
| Constructs from raw AudioStream. | |
| constexpr | AudioStream (AudioStream &&other) noexcept |
| Move constructor. | |
| AudioStream (OptionalRef< const AudioSpec > src_spec, OptionalRef< const AudioSpec > dst_spec) | |
| Create a new audio stream. | |
| AudioStream (AudioDeviceRef devid, OptionalRef< const AudioSpec > spec=std::nullopt, AudioStreamCallback callback=nullptr, void *userdata=nullptr) | |
| Convenience function for straightforward audio init for the common case. | |
| AudioStream (AudioDeviceRef devid, OptionalRef< const AudioSpec > spec, AudioStreamCB callback) | |
| Convenience function for straightforward audio init for the common case. | |
| ~AudioStream () | |
| Destructor. | |
| constexpr AudioStream & | operator= (AudioStream &&other) noexcept |
| Assignment operator. | |
| Public Member Functions inherited from SDL::AudioStreamBase | |
| void | Destroy () |
| Free an audio stream. | |
| 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. | |
| void | PutDataNoCopy (SourceBytes buf, AudioStreamDataCompleteCallback callback, void *userdata) |
| Add external data to an audio stream without copying it. | |
| void | PutDataNoCopy (SourceBytes buf, AudioStreamDataCompleteCB callback) |
| Add external data to an audio stream without copying it. | |
| 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 | Unlock (AudioStreamLock &&lock) |
| Unlock an audio stream for serialized access. | |
| void | SetGetCallback (AudioStreamCallback callback, void *userdata) |
| Set a callback that runs when data is requested from an audio stream. | |
| void | SetGetCallback (AudioStreamCB callback) |
| Set a callback that runs when data is requested from an audio stream. | |
| void | SetPutCallback (AudioStreamCallback callback, void *userdata) |
| Set a callback that runs when data is added to an audio stream. | |
| void | SetPutCallback (AudioStreamCB callback) |
| Set a callback that runs when data is added to an audio stream. | |
| void | Unbind () |
| Unbind a single audio stream from its audio device. | |
| AudioDeviceRef | GetDevice () const |
| Query an audio stream for its currently-bound device. | |
| void | PutPlanarData (const void *const *channel_buffers, int num_channels, int num_samples) |
| Add data to the stream with each channel in a separate array. | |
| constexpr | ResourceBaseT ()=default |
| Default constructor, creates null/invalid resource. | |
| constexpr | ResourceBaseT (RawPointer resource) |
| Constructs from resource pointer. | |
| constexpr | ResourceBaseT (std::nullptr_t) |
| Constructs null/invalid. | |
| constexpr | ResourceBaseT (const ResourceBaseT &)=default |
| Copy constructor. | |
| constexpr | ResourceBaseT (ResourceBaseT &&) noexcept=default |
| Move constructor. | |
| Public Member Functions inherited from SDL::ResourceBaseT< AudioStreamRaw > | |
| constexpr | ResourceBaseT ()=default |
| Default constructor, creates null/invalid resource. | |
| constexpr | operator bool () const |
| Converts to bool. | |
| constexpr auto | operator<=> (const ResourceBaseT &other) const=default |
| Comparison. | |
| constexpr RawConstPointer | operator-> () const noexcept |
| member access to underlying resource pointer. | |
| constexpr RawPointer | get () const noexcept |
| Retrieves underlying resource pointer. | |
| constexpr RawPointer | release () noexcept |
| Retrieves underlying resource pointer and clear this. | |
Additional Inherited Members | |
| Public Types inherited from SDL::ResourceBaseT< AudioStreamRaw > | |
| using | RawPointer |
| The underlying raw pointer type. | |
| using | RawConstPointer |
| The underlying const raw pointer type. | |
| Protected Member Functions inherited from SDL::ResourceBaseT< AudioStreamRaw > | |
| constexpr | ~ResourceBaseT ()=default |
| Destructor. | |
| constexpr ResourceBaseT & | operator= (const ResourceBaseT &)=default |
| Assignment operator. | |
The opaque handle that represents an audio stream.
AudioStream is an audio conversion interface.
Audio streams are the core of the SDL3 audio interface. You create one or more of them, bind them to an opened audio device, and feed data to them (or for recording, consume data from them).
|
inlineexplicitconstexprnoexcept |
Constructs from raw AudioStream.
| resource | a AudioStreamRaw to be wrapped. |
This assumes the ownership, call release() if you need to take back.