MIX_GetAudioProperties(3)

πŸ“¦
version 3.2.4 Β· 2 versions
, in fedora 44

πŸ’– 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's MIX_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