AudioSDL 3.2
SDL_CreateAudioStream
Creates a standalone audio stream that converts from one format to another.
Signature
SDL_AudioStream * SDL_CreateAudioStream(const SDL_AudioSpec *src_spec, const SDL_AudioSpec *dst_spec);
How it works
On its own a stream is a converter: data goes in as src_spec, comes out as dst_spec. Bound to a device (SDL_BindAudioStream), the device pulls from it and sets the output side itself, which is why dst_spec can be NULL in that case.
Parameters
src_specconst SDL_AudioSpec *
The format of the data you put in.
dst_specconst SDL_AudioSpec *
The format that comes out, or NULL when the stream will be bound to a device.
Return value
The stream, or NULL on failure.
Example
example.cpp
1SDL_AudioSpec musicSpec{SDL_AUDIO_S16, 2, 44100};
2SDL_AudioStream* music = SDL_CreateAudioStream(&musicSpec, nullptr);
3SDL_BindAudioStream(dev, music);