sdlGetAudioDeviceSpec function

int sdlGetAudioDeviceSpec(
  1. int index,
  2. int iscapture,
  3. Pointer<SdlAudioSpec> spec
)

Get the preferred audio format of a specific audio device.

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.

\param index the index of the audio device; valid values range from 0 to SDL_GetNumAudioDevices() - 1 \param iscapture non-zero to query the list of recording devices, zero to query the list of output devices. \param spec The SDL_AudioSpec to be initialized by this function. \returns 0 on success, nonzero on error

\since This function is available since SDL 2.0.16.

\sa SDL_GetNumAudioDevices \sa SDL_GetDefaultAudioInfo

extern DECLSPEC int SDLCALL SDL_GetAudioDeviceSpec(int index, int iscapture, SDL_AudioSpec *spec)

Implementation

int sdlGetAudioDeviceSpec(
    int index, int iscapture, Pointer<SdlAudioSpec> spec) {
  final sdlGetAudioDeviceSpecLookupFunction = libSdl2.lookupFunction<
      Int32 Function(Int32 index, Int32 iscapture, Pointer<SdlAudioSpec> spec),
      int Function(int index, int iscapture,
          Pointer<SdlAudioSpec> spec)>('SDL_GetAudioDeviceSpec');
  return sdlGetAudioDeviceSpecLookupFunction(index, iscapture, spec);
}