SDL_DestroyAudioStream(3)

πŸ’– SDL_DestroyAudioStream πŸ’–

okay bestie, welcome to the SDL3 FUNCTIONS section of the manual, and today's main character is SDL_DestroyAudioStream. yes she's a destructor. yes she eats memory for breakfast. let's get into it 🫢


✨ NAME ✨

SDL_DestroyAudioStream β€” free an audio stream. that's it. that's the whole job. she frees. she streams. she leaves. πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

#include <SDL3/SDL_audio.h>

void SDL_DestroyAudioStream(SDL_AudioStream *stream);

no return value, no drama, no cap. it's a void. she gives you nothing back and honestly? iconic. πŸ‘‘


πŸ¦‹ DESCRIPTION πŸ¦‹

so like. this function releases all allocated data, and yes that includes any audio that is still queued. anything still sitting in the buffer waiting for its moment? gone. evaporated. she does not care. 😭

and here's the part that lowkey saves your life: you do not need to manually clear the stream first. don't do extra work, bestie. she handles it. it's giving effortless. ✨

if this stream was bound to an audio device, it gets unbound during this call. so the whole situationship is officially over the second you call her. πŸ’”

and if this stream was created with SDL_OpenAudioDeviceStream, then the audio device that was opened alongside this stream's creation will be closed too. not just unbound β€” closed. she's taking the whole friend group down with her. periodt. πŸ’€


🌸 FUNCTION PARAMETERS 🌸

  • stream β€” the audio stream to destroy. that's the one. hand her over. 🫢

πŸ’œ THREAD SAFETY πŸ’œ

it is safe to call this function from any thread. every thread. all of them. simultaneously, even. she's built different. no locks required in your heart. πŸ”₯


⭐ AVAILABILITY ⭐

this function has been available since SDL 3.2.0. so if you're on anything older, sorry babe, she's not there yet. πŸ™ˆ


🌈 SEE ALSO 🌈

  • SDL_CreateAudioStream(3) β€” you know, the one that made this whole mess in the first place. balanced, as all things should be. πŸŽ€

and that's the vibe check, bestie β€” go forth and free your streams responsibly, and remember: if you created it with SDL_OpenAudioDeviceStream, the device goes down with it, iykyk.

this page brought to you by Simple Directmedia Layer, living in the SDL 3.4.18 era, and it lives in the SDL_DestroyAudioStream(3) slot right where you found it. mwah πŸ’– bye!!

πŸ“¦ where this page comes from