SDL_ConvertAudioSamples(3)
π SDL_ConvertAudioSamples π
okay bestie, welcome to the SDL_ConvertAudioSamples(3) page, living in the SDL3 FUNCTIONS collection β¨
π NAME π
SDL_ConvertAudioSamples β converts some audio data from one format to another format. glow up for your audio, literally π
β¨ SYNOPSIS β¨
#include <SDL3/SDL_audio.h>
bool SDL_ConvertAudioSamples(const SDL_AudioSpec *src_spec, const Uint8 *src_data, int src_len, const SDL_AudioSpec *dst_spec, Uint8 **dst_data, int *dst_len);
πΈ DESCRIPTION πΈ
okay so real talk first, bestie: this function is a convenience queen, but you should NOT use it to resample audio in blocks, because it will introduce audio artifacts on the boundaries π like, the seams will show. fr fr. Only use this one if you're converting your audio data in its entirety in one single call. If you wanna convert audio in smaller chunks, use an SDL_AudioStream instead β that's literally what it was designed for, it's giving purpose π
and internally? not me creating and destroying an SDL_AudioStream on every single use π so yeah, it's also less efficient than just using one directly, if you need to convert multiple times. main character energy costs a lil extra, that's just the vibe.
π¦ FUNCTION PARAMETERS π¦
src_specβ the format details of the input audio β¨src_dataβ the audio data to be converted π«src_lenβ the len ofsrc_dataπdst_specβ the format details of the output audio πdst_dataβ will be filled with a pointer to the converted audio data, which should be freed withSDL_free(). On error, it will beNULLπ (so like, check it, okay?)dst_lenβ will be filled with the len ofdst_dataπ
β RETURN VALUE β
Returns true on success or false on failure π₯² β and if it fails, call SDL_GetError() for more info, she will tell you everything π
π§ THREAD SAFETY π§
It is safe to call this function from any thread π multithreaded baddie behavior, we love to see it.
π AVAILABILITY π
This function is available since SDL 3.2.0 π
mwah, that's the whole page bestie, go convert something gorgeous πβ¨π¦πΈπ
sign-off szn: brought to you by Simple Directmedia Layer π version SDL 3.4.18 β yeah, that's the whole footer vibe, no cap π«Ά
π¦ 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