|
| constexpr | AudioStream (AudioStreamRaw resource) noexcept |
| | Constructs from raw AudioStream.
|
|
constexpr | AudioStream (const AudioStream &other)=delete |
| | Copy constructor.
|
|
constexpr | AudioStream (AudioStream &&other) noexcept |
| | Move constructor.
|
|
constexpr | AudioStream (const AudioStreamRef &other)=delete |
|
constexpr | AudioStream (AudioStreamRef &&other)=delete |
| | 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.
|
|
AudioStream & | operator= (const AudioStream &other)=delete |
| | Assignment operator.
|
| 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 | ResourceBase (RawPointer resource) |
| | Constructs from resource pointer.
|
|
constexpr | ResourceBase (std::nullptr_t=nullptr) |
| | Constructs null/invalid.
|
|
constexpr | ResourceBase (RawPointer resource) |
| | Constructs from resource pointer.
|
|
constexpr | operator bool () const |
| | Converts to bool.
|
|
constexpr auto | operator<=> (const ResourceBase &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.
|
The opaque handle that represents an audio stream.
AudioStream is an audio conversion interface.
- It can handle resampling data in chunks without generating artifacts, when it doesn't have the complete buffer available.
- It can handle incoming data in any variable size.
- It can handle input/output format changes on the fly.
- It can remap audio channels between inputs and outputs.
- You push data as you have it, and pull it when you need it
- It can also function as a basic audio data queue even if you just have sound that needs to pass from one place to another.
- You can hook callbacks up to them when more data is added or requested, to manage data on-the-fly.
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).
- Since
- This struct is available since SDL 3.2.0.
- See also
- CreateAudioStream
- Category:
- Resource