Scroll to navigation

SDL_GetAudioDeviceSpec(3) SDL3 FUNCTIONS SDL_GetAudioDeviceSpec(3)

NAME

SDL_GetAudioDeviceSpec - Get the preferred audio format of a specific audio device.

SYNOPSIS

#include "SDL3/SDL.h"
int SDL_GetAudioDeviceSpec(int index,
                           int iscapture,
                           SDL_AudioSpec *spec);

DESCRIPTION

This function is only valid after a successfully initializing the audio subsystem. The values returned by this function reflect the latest call to

SDL_GetNumAudioDevices (); re-call that function to redetect available hardware. spec will be filled with the sample rate, sample format, and channel count.

FUNCTION PARAMETERS

the index of the audio device; valid values range from 0 to SDL_GetNumAudioDevices () - 1
non-zero to query the list of recording devices, zero to query the list of output devices.
The SDL_AudioSpec
to be initialized by this function.

RETURN VALUE

Returns 0 on success or a negative error code on failure; call

SDL_GetError () for more information.

AVAILABILITY

This function is available since SDL 3.0.0.

SEE ALSO

SDL_GetNumAudioDevices(3), SDL_GetDefaultAudioInfo(3)

SDL 3.0.0 SDL