table of contents
SDL_MixAudioFormat(3) | SDL3 FUNCTIONS | SDL_MixAudioFormat(3) |
NAME¶
SDL_MixAudioFormat - Mix audio data in a specified format.
HEADER FILE¶
Defined in SDL3/SDL_audio.h
SYNOPSIS¶
#include "SDL3/SDL.h"
int SDL_MixAudioFormat(Uint8 * dst, const Uint8 * src, SDL_AudioFormat format, Uint32 len, int volume);
DESCRIPTION¶
This takes an audio buffer src of len bytes of format data and mixes it into dst , performing addition, volume adjustment, and overflow clipping. The buffer pointed to by dst must also be len bytes of format data.
This is provided for convenience -- you can mix your own audio data.
Do not use this function for mixing together more than two streams of sample data. The output from repeated application of this function may be distorted by clipping, because there is no accumulator with greater range than the input (not to mention this being an inefficient way of doing it).
It is a common misconception that this function is required to write audio data to an output stream in an audio callback. While you can do that,
SDL_MixAudioFormat () is really only needed when you're mixing a single audio stream with a volume adjustment.
FUNCTION PARAMETERS¶
RETURN VALUE¶
Returns 0 on success or a negative error code on failure; call
SDL_GetError () for more information.
THREAD SAFETY¶
It is safe to call this function from any thread.
AVAILABILITY¶
This function is available since SDL 3.0.0.
SDL 3.1.2 | Simple Directmedia Layer |