sdlGetAudioDeviceName function

String? sdlGetAudioDeviceName(
  1. int devid
)

Get the human-readable name of a specific audio device.

\param devid the instance ID of the device to query. \returns the name of the audio device, or NULL on failure; call SDL_GetError() for more information.

\threadsafety It is safe to call this function from any thread.

\since This function is available since SDL 3.1.3.

\sa SDL_GetAudioPlaybackDevices \sa SDL_GetAudioRecordingDevices

extern SDL_DECLSPEC const char * SDLCALL SDL_GetAudioDeviceName(SDL_AudioDeviceID devid)

Implementation

String? sdlGetAudioDeviceName(int devid) {
  final sdlGetAudioDeviceNameLookupFunction = libSdl3.lookupFunction<
      Pointer<Utf8> Function(Uint32 devid),
      Pointer<Utf8> Function(int devid)>('SDL_GetAudioDeviceName');
  final result = sdlGetAudioDeviceNameLookupFunction(devid);
  if (result == nullptr) {
    return null;
  }
  return result.toDartString();
}