mixEachSoundFont function

bool mixEachSoundFont(
  1. Pointer<NativeFunction<MixEachSoundFontCallback>> function,
  2. Pointer<NativeType> data
)

Iterate SoundFonts paths to use by supported MIDI backends.

This function will take the string reported by Mix_GetSoundFonts(), split it up into separate paths, as delimited by semicolons in the string, and call a callback function for each separate path.

If there are no paths available, this returns 0 without calling the callback at all.

If the callback returns non-zero, this function stops iterating and returns non-zero. If the callback returns 0, this function will continue iterating, calling the callback again for further paths. If the callback never returns 1, this function returns 0, so this can be used to decide if an available soundfont is acceptable for use.

\param function the callback function to call once per path. \param data a pointer to pass to the callback for its own personal use. \returns true if callback ever returned true, false on error or if the callback never returned true.

\since This function is available since SDL_mixer 3.0.0.

\sa Mix_GetSoundFonts

extern SDL_DECLSPEC bool SDLCALL Mix_EachSoundFont(Mix_EachSoundFontCallback function, void *data)

Implementation

bool mixEachSoundFont(
    Pointer<NativeFunction<MixEachSoundFontCallback>> function,
    Pointer<NativeType> data) {
  final mixEachSoundFontLookupFunction = libSdl3Mixer.lookupFunction<
      Uint8 Function(Pointer<NativeFunction<MixEachSoundFontCallback>> function,
          Pointer<NativeType> data),
      int Function(Pointer<NativeFunction<MixEachSoundFontCallback>> function,
          Pointer<NativeType> data)>('Mix_EachSoundFont');
  return mixEachSoundFontLookupFunction(function, data) == 1;
}