|
SDL3pp
A slim C++ wrapper for SDL3
|
An opaque object that represents audio data. More...

Public Member Functions | |
| constexpr | Audio (std::nullptr_t=nullptr) noexcept |
| Default ctor. | |
| constexpr | Audio (AudioRaw resource) noexcept |
| Constructs from raw Audio. More... | |
| constexpr | Audio (const Audio &other) noexcept=delete |
| Copy constructor. | |
| constexpr | Audio (Audio &&other) noexcept |
| Move constructor. | |
| constexpr | Audio (const AudioRef &other)=delete |
| constexpr | Audio (AudioRef &&other)=delete |
| Audio (MixerRef mixer, IOStreamRef io, bool predecode, bool closeio=false) | |
| Load audio for playback from an IOStream. More... | |
| Audio (MixerRef mixer, StringParam path, bool predecode) | |
| Load audio for playback from a file. More... | |
| Audio (PropertiesRef props) | |
| Load audio for playback through a collection of properties. More... | |
| Audio (MixerRef mixer, IOStreamRef io, const AudioSpec &spec, bool closeio=false) | |
| Load raw PCM data from an IOStream. More... | |
| Audio (MixerRef mixer, SourceBytes data, const AudioSpec &spec) | |
| Load raw PCM data from a memory buffer. More... | |
| ~Audio () | |
| Destructor. | |
| constexpr Audio & | operator= (Audio &&other) noexcept |
| Assignment operator. | |
| Audio & | operator= (const Audio &other)=delete |
| Assignment operator. | |
| constexpr AudioRaw | get () const noexcept |
| Retrieves underlying AudioRaw. | |
| constexpr AudioRaw | release () noexcept |
| Retrieves underlying AudioRaw and clear this. | |
| constexpr auto | operator<=> (const Audio &other) const noexcept=default |
| Comparison. | |
| constexpr | operator bool () const noexcept |
| Converts to bool. | |
| void | Destroy () |
| Destroy the specified audio. More... | |
| PropertiesRef | GetProperties () |
| Get the properties associated with a Audio. More... | |
| Sint64 | GetDuration () |
| Get the length of a Audio's playback in sample frames. More... | |
| void | GetFormat (AudioSpec *spec) |
| Query the initial audio format of a Audio. More... | |
| Sint64 | MSToFrames (Milliseconds ms) |
| Convert milliseconds to sample frames for a Audio's format. More... | |
| Milliseconds | FramesToMS (Sint64 frames) |
| Convert sample frames for a Audio's format to milliseconds. More... | |
Generally you load audio data (in whatever file format) into SDL_mixer with Mixer.LoadAudio() or one of its several variants, producing a Audio object.
A Audio represents static audio data; it could be background music, or maybe a laser gun sound effect. It is loaded into RAM and can be played multiple times, possibly on different tracks at the same time.
Unlike most other objects, Audio objects can be shared between mixers.
|
inlineexplicitconstexprnoexcept |
| resource | a AudioRaw to be wrapped. |
This assumes the ownership, call release() if you need to take back.