Convenience function to create and bind an audio stream in one step.
const SDL_AudioSpec *spec); SDL_AudioStream* SDL_CreateAndBindAudioStream(SDL_AudioDeviceID devid,
devid | an audio device to bind a stream to. This must be an opened device, and can not be zero. |
spec | the audio stream's input format |
Returns a bound audio stream on success, ready to use. NULL on error; call SDL_GetError() for more information.
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.
It is safe to call this function from any thread.
This function is available since SDL 3.0.0.