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

Reference for Track. More...

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

Public Member Functions

constexpr TrackRef (TrackRaw resource) noexcept
 Constructs from raw Track. More...
 
constexpr TrackRef (const Track &resource) noexcept
 Constructs from Track. More...
 
constexpr TrackRef (Track &&resource) noexcept
 Constructs from Track. More...
 
constexpr TrackRef (const TrackRef &other) noexcept
 Copy constructor.
 
constexpr TrackRef (TrackRef &&other) noexcept
 Move constructor.
 
 ~TrackRef ()
 Destructor.
 
TrackRefoperator= (const TrackRef &other) noexcept
 Assignment operator.
 
constexpr operator TrackRaw () const noexcept
 Converts to TrackRaw.
 
constexpr Track (std::nullptr_t=nullptr) noexcept
 Default ctor.
 
constexpr Track (TrackRaw resource) noexcept
 Constructs from raw Track. More...
 
constexpr Track (const Track &other) noexcept=delete
 Copy constructor.
 
constexpr Track (Track &&other) noexcept
 Move constructor.
 
constexpr Track (const TrackRef &other)=delete
 
constexpr Track (TrackRef &&other)=delete
 
 Track (MixerRef mixer)
 Create a new track on a mixer. More...
 
- Public Member Functions inherited from SDL::Track
constexpr Track (std::nullptr_t=nullptr) noexcept
 Default ctor.
 
constexpr Track (TrackRaw resource) noexcept
 Constructs from raw Track. More...
 
constexpr Track (const Track &other) noexcept=delete
 Copy constructor.
 
constexpr Track (Track &&other) noexcept
 Move constructor.
 
constexpr Track (const TrackRef &other)=delete
 
constexpr Track (TrackRef &&other)=delete
 
 Track (MixerRef mixer)
 Create a new track on a mixer. More...
 
 ~Track ()
 Destructor.
 
constexpr Trackoperator= (Track &&other) noexcept
 Assignment operator.
 
Trackoperator= (const Track &other)=delete
 Assignment operator.
 
constexpr TrackRaw get () const noexcept
 Retrieves underlying TrackRaw.
 
constexpr TrackRaw release () noexcept
 Retrieves underlying TrackRaw and clear this.
 
constexpr auto operator<=> (const Track &other) const noexcept=default
 Comparison.
 
constexpr operator bool () const noexcept
 Converts to bool.
 
void Destroy ()
 Destroy the specified track. More...
 
PropertiesRef GetProperties ()
 Get the properties associated with a track. More...
 
MixerRef GetMixer ()
 Get the Mixer that owns a Track. More...
 
void SetAudio (AudioRef audio)
 Set a Track's input to a Audio. More...
 
void SetAudioStream (AudioStreamRef stream)
 Set a Track's input to an AudioStream. More...
 
void SetIOStream (IOStreamRef io, bool closeio=false)
 Set a Track's input to an IOStream. More...
 
void SetRawIOStream (IOStreamRef io, const AudioSpec &spec, bool closeio=false)
 Set a Track's input to an IOStream providing raw PCM data. More...
 
void Tag (StringParam tag)
 Assign an arbitrary tag to a track. More...
 
void Untag (StringParam tag)
 Remove an arbitrary tag from a track. More...
 
OwnArray< char * > GetTags ()
 Get the tags currently associated with a track. More...
 
void SetPlaybackPosition (Sint64 frames)
 Seek a playing track to a new position in its input. More...
 
Sint64 GetPlaybackPosition ()
 Get the current input position of a playing track. More...
 
Sint64 GetFadeFrames ()
 Query whether a given track is fading. More...
 
int GetLoops ()
 Query how many loops remain for a given track. More...
 
void SetLoops (int num_loops)
 Change the number of times a currently-playing track will loop. More...
 
AudioRef GetAudio ()
 Query the Audio assigned to a track. More...
 
AudioStreamRef GetAudioStream ()
 Query the AudioStream assigned to a track. More...
 
Sint64 GetRemaining ()
 Return the number of sample frames remaining to be mixed in a track. More...
 
Sint64 MSToFrames (Milliseconds ms)
 Convert milliseconds to sample frames for a track's current format. More...
 
Milliseconds FramesToMS (Sint64 frames)
 Convert sample frames for a track's current format to milliseconds. More...
 
void Play (PropertiesRef options=nullptr)
 Start (or restart) mixing a track for playback. More...
 
bool Stop (Sint64 fade_out_frames)
 Halt a currently-playing track, possibly fading out over time. More...
 
bool Pause ()
 Pause a currently-playing track. More...
 
bool Resume ()
 Resume a currently-paused track. More...
 
bool Playing ()
 Query if a track is currently playing. More...
 
bool Paused ()
 Query if a track is currently paused. More...
 
void SetGain (float gain)
 Set a track's gain control. More...
 
float GetGain ()
 Get a track's gain control. More...
 
void SetFrequencyRatio (float ratio)
 Change the frequency ratio of a track. More...
 
float GetFrequencyRatio ()
 Query the frequency ratio of a track. More...
 
void SetOutputChannelMap (std::span< const int > chmap)
 Set the current output channel map of a track. More...
 
void SetStereo (const StereoGains &gains)
 Force a track to stereo output, with optionally left/right panning. More...
 
void Set3DPosition (const Point3D &position)
 Set a track's position in 3D space. More...
 
Point3D Get3DPosition ()
 Get a track's current position in 3D space. More...
 
void SetGroup (GroupRef group)
 Assign a track to a mixing group. More...
 
void SetStoppedCallback (TrackStoppedCallback cb, void *userdata)
 Set a callback that fires when a Track is stopped. More...
 
void SetStoppedCallback (TrackStoppedCB cb)
 Set a callback that fires when a Track is stopped. More...
 
void SetRawCallback (TrackMixCallback cb, void *userdata)
 Set a callback that fires when a Track has initial decoded audio. More...
 
void SetRawCallback (TrackMixCB cb)
 Set a callback that fires when a Track has initial decoded audio. More...
 
void SetCookedCallback (TrackMixCallback cb, void *userdata)
 Set a callback that fires when the mixer has transformed a track's audio. More...
 
void SetCookedCallback (TrackMixCB cb)
 Set a callback that fires when the mixer has transformed a track's audio. More...
 

Detailed Description

This does not take ownership!

Constructor & Destructor Documentation

◆ TrackRef() [1/3]

constexpr SDL::TrackRef::TrackRef ( TrackRaw  resource)
inlineconstexprnoexcept
Parameters
resourcea TrackRaw.

This does not takes ownership!

◆ TrackRef() [2/3]

constexpr SDL::TrackRef::TrackRef ( const Track resource)
inlineconstexprnoexcept
Parameters
resourcea Track.

This does not takes ownership!

◆ TrackRef() [3/3]

constexpr SDL::TrackRef::TrackRef ( Track &&  resource)
inlineconstexprnoexcept
Parameters
resourcea Track.

This will release the ownership from resource!

Member Function Documentation

◆ Track() [1/2]

SDL::Track::Track ( MixerRef  mixer)
inline

A track provides a single source of audio. All currently-playing tracks will be processed and mixed together to form the final output from the mixer.

There are no limits to the number of tracks one may create, beyond running out of memory, but in normal practice there are a small number of tracks that are reused between all loaded audio as appropriate.

Tracks are unique to a specific Mixer and can't be transferred between them.

Parameters
mixerthe mixer on which to create this track.
Postcondition
a new Track on success.
Exceptions
Erroron failure.
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
Track.Destroy

◆ Track() [2/2]

constexpr SDL::Track::Track ( TrackRaw  resource)
inlineexplicitconstexprnoexcept
Parameters
resourcea TrackRaw 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: