Scroll to navigation

MIX_GetAudioProperties(3) SDL_mixer3 FUNCTIONS MIX_GetAudioProperties(3)

NAME

MIX_GetAudioProperties - Get the properties associated with a MIX_Audio .

HEADER FILE

Defined in SDL3_mixer/SDL_mixer.h

SYNOPSIS

#include "SDL3_mixer/SDL_mixer.h"
SDL_PropertiesID MIX_GetAudioProperties(MIX_Audio *audio);


#define MIX_PROP_METADATA_TITLE_STRING SDL_mixer.metadata.title"
#define MIX_PROP_METADATA_ARTIST_STRING SDL_mixer.metadata.artist"
#define MIX_PROP_METADATA_ALBUM_STRING SDL_mixer.metadata.album"
#define MIX_PROP_METADATA_COPYRIGHT_STRING SDL_mixer.metadata.copyright"
#define MIX_PROP_METADATA_TRACK_NUMBER SDL_mixer.metadata.track"
#define MIX_PROP_METADATA_TOTAL_TRACKS_NUMBER SDL_mixer.metadata.total_tracks"
#define MIX_PROP_METADATA_YEAR_NUMBER SDL_mixer.metadata.year"
#define MIX_PROP_METADATA_DURATION_FRAMES_NUMBER SDL_mixer.metadata.duration_frames"
#define MIX_PROP_METADATA_DURATION_INFINITE_BOOLEAN SDL_mixer.metadata.duration_infinite"

DESCRIPTION

SDL_mixer offers some properties of its own, but this can also be a convenient place to store app-specific data.

A SDL_PropertiesID is created the first time this function is called for a given MIX_Audio , if necessary.

The following read-only properties are provided by SDL_mixer:

MIX_PROP_METADATA_TITLE_STRING : the
audio's title ("Smells Like Teen Spirit").

MIX_PROP_METADATA_ARTIST_STRING : the
audio's artist name ("Nirvana").

MIX_PROP_METADATA_ALBUM_STRING : the
audio's album name ("Nevermind").

MIX_PROP_METADATA_COPYRIGHT_STRING :
the audio's copyright info ("Copyright (c) 1991")

MIX_PROP_METADATA_TRACK_NUMBER : the
audio's track number on the album (1)

MIX_PROP_METADATA_TOTAL_TRACKS_NUMBER :
the total tracks on the album (13)

MIX_PROP_METADATA_YEAR_NUMBER : the
year the audio was released (1991)

MIX_PROP_METADATA_DURATION_FRAMES_NUMBER :
The sample frames worth of PCM data that comprise this audio. It might be
off by a little if the decoder only knows the duration as a unit of time.

MIX_PROP_METADATA_DURATION_INFINITE_BOOLEAN :
if true, audio never runs out of sound to generate. This isn't
necessarily always known to SDL_mixer, though.

Other properties, documented with

MIX_LoadAudioWithProperties (), may also be present.

Note that the metadata properties are whatever SDL_mixer finds in things like ID3 tags, and they often have very little standardized formatting, may be missing, and can be completely wrong if the original data is untrustworthy (like an MP3 from a P2P file sharing service).

FUNCTION PARAMETERS

the audio to query.

RETURN VALUE

Returns a valid property ID on success or 0 on failure; call SDL_GetError() for more information.

THREAD SAFETY

It is safe to call this function from any thread.

AVAILABILITY

This function is available since SDL_mixer 3.0.0.

SDL_mixer 3.1.0 SDL_mixer