MIX_DecodeAudio(3)

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

✨ MIX_DecodeAudio(3) ✨

okay bestie, welcome to the SDL_mixer3 pages, this one's literally called MIX_DecodeAudio and it's giving "give me more audio bytes, queen" energy πŸ’…


🌸 NAME 🌸

MIX_DecodeAudio β€” Decode more audio from a MIX_AudioDecoder. πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <SDL3_mixer/SDL_mixer.h>

int MIX_DecodeAudio(MIX_AudioDecoder *audiodecoder, void *buffer, int buflen, const SDL_AudioSpec *spec);

no cap, that's the whole vibe right there ✨


πŸ’– DESCRIPTION πŸ’–

So here's the tea: data is decoded on demand in whatever format is requested. and like, the format is permitted to change between calls?? iconic behavior honestly. slay 🫢

This function will return the number of bytes decoded, which may be less than requested if there was an error or end-of-file. yep, she can under-deliver (for very valid reasons tho, not her fault).

A return value of zero means the entire file was decoded. a return value of -1 means an unrecoverable error happened 😭 that one's the bad ending fr fr.


πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • audiodecoder β€” the decoder from which to retrieve more data. your main character, the source of the goods πŸ’œ
  • buffer β€” the memory buffer to store decoded audio. this is where the bytes go to live ✨
  • buflen β€” the maximum number of bytes to store to buffer. hard limit bestie, don't overflow πŸ™ˆ
  • spec β€” the format that audio data will be stored to buffer. tell her how you want it served πŸ“

⭐ RETURN VALUE ⭐

Returns number of bytes decoded, or -1 on error. and if you get an error? call SDL_GetError() for more information, she'll explain everything πŸ’€


πŸ”₯ THREAD SAFETY πŸ”₯

It is safe to call this function from any thread. periodt. go wild, queen πŸ‘‘


🌈 AVAILABILITY 🌈

This function is available since SDL_mixer 3.0.0. vintage but make it modern πŸ’…


that's it bestie, go decode some audio and be iconic πŸŒΈπŸ¦‹πŸ’–

β€” written by the SDL_mixer girlies, SDL_mixer 3.2.4, iykyk πŸŽ€βœ¨

πŸ“¦ where this page comes from