MIX_GetAudioProperties(3)
π MIX_GetAudioProperties(3) π
okay bestie, welcome to the SDL_mixer3 functions section, and today's main character is MIX_GetAudioProperties β the manual page you're reading rn. let's go β¨
β¨ NAME β¨
MIX_GetAudioProperties β get the properties associated with a MIX_Audio. that's it, that's the job π«Ά
πΈ SYNOPSIS πΈ
#include <SDL3_mixer/SDL_mixer.h>
SDL_PropertiesID MIX_GetAudioProperties(MIX_Audio *audio);
π DESCRIPTION π
so SDL_mixer ships with some properties of its very own, lowkey, but this function is also just a super convenient lil spot to stash your app-specific data. like a designated shelf. for your stuff. iconic.
A SDL_PropertiesID gets created the first time this function is called for a given MIX_Audio, if necessary. so it's not just sitting there waiting, it spawns on demand. no cap.
The following properties are read-only, and they come from SDL_mixer itself:
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. heads up though: it might be off by a little if the decoder only knows the duration as a unit of time π (not its fault, fr).MIX_PROP_METADATA_INFINITE_BOOLEANβ wait no, it'sMIX_PROP_METADATA_DURATION_INFINITE_BOOLEANπ β if true, the audio never runs out of sound to generate. that said, this isn't necessarily always known to SDL_mixer. so, y'know, vibes.
Other properties, documented with MIX_LoadAudioWithProperties(), may also be present. so check those too π
β οΈ real talk: the metadata properties are whatever SDL_mixer finds in things like ID3 tags. they often have very little standardized formatting, may be missing entirely, and can be completely wrong if the original data is untrustworthy (like an MP3 from a P2P file sharing service π). trust the tags at your own risk, bestie.
π FUNCTION PARAMETERS π
audioβ the audio to query.
β RETURN VALUE β
Returns a valid property ID on success, or 0 on failure. and if it fails? call SDL_GetError() for more info, obviously π
π§ THREAD SAFETY π§
It is safe to call this function from any thread. go off, multithreaded queen π
π AVAILABILITY π
This function is available since SDL_mixer 3.0.0.
that's the whole page, you ate that fr fr π this gem lives in the SDL_mixer manual, SDL_mixer 3.2.4 edition, and yes it's still giving MIX_GetAudioProperties(3) energy. bye bestie, go read some properties π¦π
π¦ where this page comes from
- fedora 44: SDL3_mixer-doc 3.2.4-3.fc44 Β· Zlib AND (GPL-2.0-or-later OR LGPL-2.0-or-later)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms