SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
SDL::Audio Struct Reference

An opaque object that represents audio data. More...

Inheritance diagram for SDL::Audio:
[legend]

Public Member Functions

constexpr Audio (AudioRaw resource) noexcept
 Constructs from raw Audio.
constexpr Audio (const Audio &other)=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.
 Audio (MixerRef mixer, StringParam path, bool predecode)
 Load audio for playback from a file.
 Audio (PropertiesRef props)
 Load audio for playback through a collection of properties.
 Audio (MixerRef mixer, IOStreamRef io, const AudioSpec &spec, bool closeio=false)
 Load raw PCM data from an IOStream.
 Audio (MixerRef mixer, SourceBytes data, const AudioSpec &spec)
 Load raw PCM data from a memory buffer.
 ~Audio ()
 Destructor.
constexpr Audiooperator= (Audio &&other) noexcept
 Assignment operator.
Audiooperator= (const Audio &other)=delete
 Assignment operator.
void Destroy ()
 Destroy the specified audio.
PropertiesRef GetProperties ()
 Get the properties associated with a Audio.
Sint64 GetDuration ()
 Get the length of a Audio's playback in sample frames.
void GetFormat (AudioSpec *spec)
 Query the initial audio format of a Audio.
Sint64 MSToFrames (Milliseconds ms)
 Convert milliseconds to sample frames for a Audio's format.
Milliseconds FramesToMS (Sint64 frames)
 Convert sample frames for a Audio's format to milliseconds.
constexpr ResourceBase (RawPointer resource)
 Constructs from resource pointer.
constexpr ResourceBase (std::nullptr_t=nullptr)
 Constructs null/invalid.
Public Member Functions inherited from SDL::ResourceBase< AudioRaw >
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.

Additional Inherited Members

Public Types inherited from SDL::ResourceBase< AudioRaw >
using RawPointer
 The underlying raw pointer type.
using RawConstPointer
 The underlying const raw pointer type.

Detailed Description

An opaque object that represents audio data.

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.

Since
This datatype is available since SDL_mixer 3.0.0.
Category:
Resource

Constructor & Destructor Documentation

◆ Audio()

SDL::Audio::Audio ( AudioRaw resource)
inlineexplicitconstexprnoexcept

Constructs from raw Audio.

Parameters
resourcea AudioRaw to be wrapped.

This assumes the ownership, call release() if you need to take back.


The documentation for this struct was generated from the following file: