Scroll to navigation

SDL_CreateAndBindAudioStream(3) SDL3 FUNCTIONS SDL_CreateAndBindAudioStream(3)

NAME

SDL_CreateAndBindAudioStream - Convenience function to create and bind an audio stream in one step.

SYNOPSIS

#include "SDL3/SDL.h"
SDL_AudioStream* SDL_CreateAndBindAudioStream(SDL_AudioDeviceID devid, const SDL_AudioSpec *spec);

DESCRIPTION

This manages the creation of an audio stream, and setting its format correctly to match both the app and the audio device's needs. This is optional, but slightly less cumbersome to set up for a common use case.

The spec parameter represents the app's side of the audio stream. That is, for recording audio, this will be the output format, and for playing audio, this will be the input format. This function will set the other side of the audio stream to the device's format.

FUNCTION PARAMETERS

an audio device to bind a stream to. This must be an opened device, and can not be zero.
the audio stream's input format

RETURN VALUE

Returns a bound audio stream on success, ready to use. NULL on error; 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.

SEE ALSO

SDL_BindAudioStreams(3), SDL_UnbindAudioStreams(3), SDL_UnbindAudioStream(3)

SDL 3.0.0 SDL