sdlAudioInit function

int sdlAudioInit(
  1. String? driverName
)

Use this function to initialize a particular audio driver.

This function is used internally, and should not be used unless you have a specific need to designate the audio driver you want to use. You should normally use SDL_Init() or SDL_InitSubSystem().

\param driver_name the name of the desired audio driver \returns 0 on success or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_AudioQuit

extern DECLSPEC int SDLCALL SDL_AudioInit(const char *driver_name)

Implementation

int sdlAudioInit(String? driverName) {
  final sdlAudioInitLookupFunction = libSdl2.lookupFunction<
      Int32 Function(Pointer<Utf8> driverName),
      int Function(Pointer<Utf8> driverName)>('SDL_AudioInit');
  final driverNamePointer =
      driverName != null ? driverName.toNativeUtf8() : nullptr;
  final result = sdlAudioInitLookupFunction(driverNamePointer);
  calloc.free(driverNamePointer);
  return result;
}