table of contents
SDL_GetDefaultAudioInfo(3) | SDL3 FUNCTIONS | SDL_GetDefaultAudioInfo(3) |
NAME¶
SDL_GetDefaultAudioInfo - Get the name and preferred format of the default audio device.
SYNOPSIS¶
#include "SDL3/SDL.h"
int SDL_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int iscapture);
DESCRIPTION¶
Some (but not all!) platforms have an isolated mechanism to get information about the "default" device. This can actually be a completely different device that's not in the list you get from
SDL_GetAudioDeviceSpec (). It can even be a network address! (This is discussed in
SDL_OpenAudioDevice ().)
As a result, this call is not guaranteed to be performant, as it can query the sound server directly every time, unlike the other query functions. You should call this function sparingly! spec will be filled with the sample rate, sample format, and channel count, if a default device exists on the system. If name is provided, will be filled with either a dynamically-allocated UTF-8 string or NULL.
FUNCTION PARAMETERS¶
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_GetAudioDeviceName(3), SDL_GetAudioDeviceSpec(3), SDL_OpenAudioDevice(3)
SDL 3.0.0 | SDL |