audio: Added SDL_GetAudioStreamBinding.

Now you can open a device, bind a stream, and forget about the device ID
until you're ready to shutdown, where you can query the stream for it.
This commit is contained in:
Ryan C. Gordon
2023-06-22 01:00:12 -04:00
parent 01f7b53865
commit 464640440f
5 changed files with 40 additions and 0 deletions

View File

@@ -542,6 +542,7 @@ extern DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID devid);
* \sa SDL_BindAudioStreams
* \sa SDL_UnbindAudioStreams
* \sa SDL_UnbindAudioStream
* \sa SDL_GetAudioStreamBinding
*/
extern DECLSPEC int SDLCALL SDL_BindAudioStreams(SDL_AudioDeviceID devid, SDL_AudioStream **streams, int num_streams);
@@ -562,6 +563,7 @@ extern DECLSPEC int SDLCALL SDL_BindAudioStreams(SDL_AudioDeviceID devid, SDL_Au
* \sa SDL_BindAudioStreams
* \sa SDL_UnbindAudioStreams
* \sa SDL_UnbindAudioStream
* \sa SDL_GetAudioStreamBinding
*/
extern DECLSPEC int SDLCALL SDL_BindAudioStream(SDL_AudioDeviceID devid, SDL_AudioStream *stream);
@@ -584,6 +586,7 @@ extern DECLSPEC int SDLCALL SDL_BindAudioStream(SDL_AudioDeviceID devid, SDL_Aud
* \sa SDL_BindAudioStreams
* \sa SDL_BindAudioStream
* \sa SDL_UnbindAudioStream
* \sa SDL_GetAudioStreamBinding
*/
extern DECLSPEC void SDLCALL SDL_UnbindAudioStreams(SDL_AudioStream **streams, int num_streams);
@@ -602,9 +605,31 @@ extern DECLSPEC void SDLCALL SDL_UnbindAudioStreams(SDL_AudioStream **streams, i
* \sa SDL_BindAudioStream
* \sa SDL_BindAudioStreams
* \sa SDL_UnbindAudioStreams
* \sa SDL_GetAudioStreamBinding
*/
extern DECLSPEC void SDLCALL SDL_UnbindAudioStream(SDL_AudioStream *stream);
/**
* Query an audio stream for its currently-bound device.
*
* This reports the audio device that an audio stream is currently bound to.
*
* If not bound, or invalid, this returns zero, which is not a valid device ID.
*
* \param stream the audio stream to query.
* \returns The bound audio device, or 0 if not bound or invalid.
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_BindAudioStream
* \sa SDL_BindAudioStreams
* \sa SDL_UnbindAudioStream
* \sa SDL_UnbindAudioStreams
*/
extern DECLSPEC SDL_AudioDeviceID SDLCALL SDL_GetAudioStreamBinding(SDL_AudioStream *stream);
/**
* Create a new audio stream.