Add SDL_GetAudioDeviceSpec.

This API is supported by pipewire, pulseaudio, coreaudio, wasapi, and disk.
This commit is contained in:
Ethan Lee
2021-02-27 17:37:25 -05:00
committed by Sam Lantinga
parent 00fabdde18
commit 67e8522d31
19 changed files with 256 additions and 67 deletions

View File

@@ -359,6 +359,25 @@ extern DECLSPEC int SDLCALL SDL_GetNumAudioDevices(int iscapture);
extern DECLSPEC const char *SDLCALL SDL_GetAudioDeviceName(int index,
int iscapture);
/**
* Get the audio format of a specific audio device.
* Must be a value between 0 and (number of audio devices-1).
* Only valid after a successfully initializing the audio subsystem.
* The values returned by this function reflect the latest call to
* SDL_GetNumAudioDevices(); recall that function to redetect available
* hardware.
*
* The spec will be filled with the sample rate, sample format, and channel
* count. All other values in the structure are filled with 0. When the
* supported struct members are 0, SDL was unable to get the property from the
* backend.
*
* \return 0 on success, nonzero on error
*/
extern DECLSPEC int SDLCALL SDL_GetAudioDeviceSpec(int index,
int iscapture,
SDL_AudioSpec *spec);
/**
* Open a specific audio device. Passing in a device name of NULL requests