SDL_CreateAudioStream(3)
β¨ SDL_CreateAudioStream β¨
okay so bestie, this is a page from the SDL3 FUNCTIONS manual (yes the manual name is literally part of the header, i'm folding it in here so it doesn't get lost π) and today we're learning how to make a whole new audio stream. it's giving "birth of a vibe" honestly.
πΈ NAME πΈ
SDL_CreateAudioStream β Create a new audio stream.
like literally, you're manifesting a stream of audio out of thin air π¦
π SYNOPSIS π
#include <SDL3/SDL_audio.h>
SDL_AudioStream * SDL_CreateAudioStream(const SDL_AudioSpec *src_spec, const SDL_AudioSpec *dst_spec);
π DESCRIPTION π
so here's the tea, and you need to hear it: src_spec or dst_spec may be NULL, no big deal, no drama. BUT β and this is the important part β any attempts to put or get data from an audio stream will fail until it has valid specs assigned to both ends of the stream. both ends, bestie. both. π«Ά
and no, you're not stuck forever! specs can be assigned later through SDL_SetAudioStreamFormat(), or by binding the stream to an audio device. and lowkey here's the detail that matters: binding will set the format of only the input or output, depending on what kind of device the stream was bound to. not both. just one. iykyk π
π FUNCTION PARAMETERS π
src_specβ the format details of the input audio. May beNULL.dst_specβ the format details of the output audio. May beNULL.
see? told you. both of them can just be NULL and the function will still hand you a stream. it's chill like that. π
β RETURN VALUE β
Returns a new audio stream on success β¨ or NULL on failure π; call SDL_GetError() for more information.
no cap: if you getNULLback, go readSDL_GetError()immediately. don't sit there guessing, the answer is right there.
π§ THREAD SAFETY π§
It is safe to call this function from any thread.
periodt. go wild, call it from wherever. π₯
π¦ AVAILABILITY π¦
This function is available since SDL 3.2.0.
(if you're on something older, sorry bestie, this one's not for you π)
π SEE ALSO π
SDL_PutAudioStreamData(3)SDL_GetAudioStreamData(3)SDL_GetAudioStreamAvailable(3)SDL_FlushAudioStream(3)SDL_ClearAudioStream(3)SDL_SetAudioStreamFormat(3)SDL_DestroyAudioStream(3)
and that's the whole page, bestie π Simple Directmedia Layer, SDL 3.4.18, and this little beauty is dated SDL_CreateAudioStream(3) β mwah, go make some noise ππΈβ¨
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms