mixGetSoundFonts function

String? mixGetSoundFonts()

Get SoundFonts paths to use by supported MIDI backends.

There are several factors that determine what will be reported by this function:

  • If the boolean SDL hint "SDL_FORCE_SOUNDFONTS" is set, AND the "SDL_SOUNDFONTS" environment variable is also set, this function will return that environment variable regardless of whether Mix_SetSoundFounts() was ever called.
  • Otherwise, if Mix_SetSoundFonts() was successfully called with a non-NULL path, this function will return the string passed to that function.
  • Otherwise, if the "SDL_SOUNDFONTS" variable is set, this function will return that environment variable.
  • Otherwise, this function will search some common locations on the filesystem, and if it finds a SoundFont there, it will return that.
  • Failing everything else, this function returns NULL.

This returns a pointer to internal (possibly read-only) memory, and it should not be modified or free'd by the caller.

\returns semicolon-separated list of sound font paths.

\since This function is available since SDL_mixer 3.0.0.

extern SDL_DECLSPEC const char* SDLCALL Mix_GetSoundFonts(void)

Implementation

String? mixGetSoundFonts() {
  final mixGetSoundFontsLookupFunction = libSdl3Mixer.lookupFunction<
      Pointer<Utf8> Function(), Pointer<Utf8> Function()>('Mix_GetSoundFonts');
  final result = mixGetSoundFontsLookupFunction();
  if (result == nullptr) {
    return null;
  }
  return result.toDartString();
}