SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
Public Member Functions | List of all members
SDL::AudioDecoderRef Struct Reference

Reference for AudioDecoder. More...

Inheritance diagram for SDL::AudioDecoderRef:
Inheritance graph
[legend]
Collaboration diagram for SDL::AudioDecoderRef:
Collaboration graph
[legend]

Public Member Functions

constexpr AudioDecoderRef (AudioDecoderRaw resource) noexcept
 Constructs from raw AudioDecoder. More...
 
constexpr AudioDecoderRef (const AudioDecoder &resource) noexcept
 Constructs from AudioDecoder. More...
 
constexpr AudioDecoderRef (AudioDecoder &&resource) noexcept
 Constructs from AudioDecoder. More...
 
constexpr AudioDecoderRef (const AudioDecoderRef &other) noexcept
 Copy constructor.
 
constexpr AudioDecoderRef (AudioDecoderRef &&other) noexcept
 Move constructor.
 
 ~AudioDecoderRef ()
 Destructor.
 
AudioDecoderRefoperator= (const AudioDecoderRef &other) noexcept
 Assignment operator.
 
constexpr operator AudioDecoderRaw () const noexcept
 Converts to AudioDecoderRaw.
 
constexpr AudioDecoder (std::nullptr_t=nullptr) noexcept
 Default ctor.
 
constexpr AudioDecoder (AudioDecoderRaw resource) noexcept
 Constructs from raw AudioDecoder. More...
 
constexpr AudioDecoder (const AudioDecoder &other) noexcept=delete
 Copy constructor.
 
constexpr AudioDecoder (AudioDecoder &&other) noexcept
 Move constructor.
 
constexpr AudioDecoder (const AudioDecoderRef &other)=delete
 
constexpr AudioDecoder (AudioDecoderRef &&other)=delete
 
 AudioDecoder (StringParam path, PropertiesRef props=nullptr)
 Create a AudioDecoder from a path on the filesystem. More...
 
 AudioDecoder (IOStreamRef io, bool closeio=false, PropertiesRef props=nullptr)
 Create a AudioDecoder from an IOStream. More...
 
- Public Member Functions inherited from SDL::AudioDecoder
constexpr AudioDecoder (std::nullptr_t=nullptr) noexcept
 Default ctor.
 
constexpr AudioDecoder (AudioDecoderRaw resource) noexcept
 Constructs from raw AudioDecoder. More...
 
constexpr AudioDecoder (const AudioDecoder &other) noexcept=delete
 Copy constructor.
 
constexpr AudioDecoder (AudioDecoder &&other) noexcept
 Move constructor.
 
constexpr AudioDecoder (const AudioDecoderRef &other)=delete
 
constexpr AudioDecoder (AudioDecoderRef &&other)=delete
 
 AudioDecoder (StringParam path, PropertiesRef props=nullptr)
 Create a AudioDecoder from a path on the filesystem. More...
 
 AudioDecoder (IOStreamRef io, bool closeio=false, PropertiesRef props=nullptr)
 Create a AudioDecoder from an IOStream. More...
 
 ~AudioDecoder ()
 Destructor.
 
constexpr AudioDecoderoperator= (AudioDecoder &&other) noexcept
 Assignment operator.
 
AudioDecoderoperator= (const AudioDecoder &other)=delete
 Assignment operator.
 
constexpr AudioDecoderRaw get () const noexcept
 Retrieves underlying AudioDecoderRaw.
 
constexpr AudioDecoderRaw release () noexcept
 Retrieves underlying AudioDecoderRaw and clear this.
 
constexpr auto operator<=> (const AudioDecoder &other) const noexcept=default
 Comparison.
 
constexpr operator bool () const noexcept
 Converts to bool.
 
void Destroy ()
 Destroy the specified audio decoder. More...
 
PropertiesRef GetProperties ()
 Get the properties associated with a AudioDecoder. More...
 
void GetFormat (AudioSpec *spec)
 Query the initial audio format of a AudioDecoder. More...
 
int DecodeAudio (TargetBytes buffer, const AudioSpec &spec)
 Decode more audio from a AudioDecoder. More...
 

Detailed Description

This does not take ownership!

Constructor & Destructor Documentation

◆ AudioDecoderRef() [1/3]

constexpr SDL::AudioDecoderRef::AudioDecoderRef ( AudioDecoderRaw  resource)
inlineconstexprnoexcept
Parameters
resourcea AudioDecoderRaw.

This does not takes ownership!

◆ AudioDecoderRef() [2/3]

constexpr SDL::AudioDecoderRef::AudioDecoderRef ( const AudioDecoder resource)
inlineconstexprnoexcept
Parameters
resourcea AudioDecoder.

This does not takes ownership!

◆ AudioDecoderRef() [3/3]

constexpr SDL::AudioDecoderRef::AudioDecoderRef ( AudioDecoder &&  resource)
inlineconstexprnoexcept
Parameters
resourcea AudioDecoder.

This will release the ownership from resource!

Member Function Documentation

◆ AudioDecoder() [1/3]

constexpr SDL::AudioDecoder::AudioDecoder ( AudioDecoderRaw  resource)
inlineexplicitconstexprnoexcept
Parameters
resourcea AudioDecoderRaw to be wrapped.

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

◆ AudioDecoder() [2/3]

SDL::AudioDecoder::AudioDecoder ( IOStreamRef  io,
bool  closeio = false,
PropertiesRef  props = nullptr 
)
inline

Most apps won't need this, as SDL_mixer's usual interfaces will decode audio as needed. However, if one wants to decode an audio file into a memory buffer without playing it, this interface offers that.

This function allows properties to be specified. This is intended to supply file-specific settings, such as where to find SoundFonts for a MIDI file, etc. In most cases, the caller should pass a nullptr to specify no extra properties.

If closeio is true, then io will be closed when this decoder is done with it. If this function fails and closeio is true, then io will be closed before this function returns.

When done with the audio decoder, it can be destroyed with AudioDecoder.Destroy().

This function requires SDL_mixer to have been initialized with a successful call to MIX.Init(), but does not need an actual Mixer to have been created.

Parameters
iothe i/o stream from which to load data.
closeioif true, close the i/o stream when done with it.
propsdecoder-specific properties. May be nullptr.
Postcondition
an audio decoder, ready to decode.
Thread safety:
It is safe to call this function from any thread.
Since
This function is available since SDL_mixer 3.0.0.
See also
CreateAudioDecoder_IO
AudioDecoder.DecodeAudio
AudioDecoder.Destroy

◆ AudioDecoder() [3/3]

SDL::AudioDecoder::AudioDecoder ( StringParam  path,
PropertiesRef  props = nullptr 
)
inline

Most apps won't need this, as SDL_mixer's usual interfaces will decode audio as needed. However, if one wants to decode an audio file into a memory buffer without playing it, this interface offers that.

This function allows properties to be specified. This is intended to supply file-specific settings, such as where to find SoundFonts for a MIDI file, etc. In most cases, the caller should pass a nullptr to specify no extra properties.

Properties are discussed in SDL's documentation .

When done with the audio decoder, it can be destroyed with AudioDecoder.Destroy().

This function requires SDL_mixer to have been initialized with a successful call to MIX.Init(), but does not need an actual Mixer to have been created.

Parameters
paththe path on the filesystem from which to load data.
propsdecoder-specific properties. May be nullptr.
Postcondition
an audio decoder, ready to decode.
Thread safety:
It is safe to call this function from any thread.
Since
This function is available since SDL_mixer 3.0.0.
See also
CreateAudioDecoder_IO
AudioDecoder.DecodeAudio
AudioDecoder.Destroy

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