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 (Audio &&other) noexcept
 Move constructor.
 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.
Public Member Functions inherited from SDL::AudioBase
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 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< AudioRaw >
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< AudioRaw >
using RawPointer
 The underlying raw pointer type.
using RawConstPointer
 The underlying const raw pointer type.
Protected Member Functions inherited from SDL::ResourceBaseT< AudioRaw >
constexpr ~ResourceBaseT ()=default
 Destructor.
constexpr ResourceBaseToperator= (const ResourceBaseT &)=default
 Assignment operator.

Detailed Description

An opaque object that represents audio data.

Generally you load audio data (in whatever file format) into SDL_mixer with 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: