BASS.NET API for the Un4seen BASS Audio LibraryBassMidiBASS_MIDI_FontLoad Method BASS.NET API for the Un4seen BASS Audio Library
Preloads presets from a soundfont.

Namespace: Un4seen.Bass.AddOn.Midi
Assembly: Bass.Net (in Bass.Net.dll) Version: 2.4.12.0
Syntax

[DllImportAttribute("bassmidi.dll", CharSet = CharSet.Unicode)]
public static bool BASS_MIDI_FontLoad(
	int handle,
	int preset,
	int bank
)

Parameters

handle
Type: SystemInt32
The soundfont handle.
preset
Type: SystemInt32
Preset number to load... -1 = all presets.
bank
Type: SystemInt32
Bank number to load... -1 = all banks.

Return Value

Type: Boolean
If successful, is returned, else is returned. Use BASS_ErrorGetCode to get the error code.
Remarks

Samples are normally loaded as they are needed while rendering a MIDI stream, which can result in CPU spikes, particularly with packed soundfonts. That generally won't cause any problems, but when smooth/constant performance is critical this function can be used to preload the samples before rendering, so avoiding the need to load them while rendering.

When preloading samples to render a particular MIDI stream, it is more efficient to use BASS_MIDI_StreamLoadSamples(Int32) to preload the specific samples that the MIDI stream will use, rather than preloading the entire soundfont.

Samples that are preloaded by this function are not affected by automatic compacting via the BASS_CONFIG_MIDI_COMPACT option, but can be compacted/unloaded manually with BASS_MIDI_FontCompact(Int32).

A soundfont should not be preloaded while it's being used to render any MIDI streams, as that could delay the rendering.

ERROR CODEDescription
BASS_ERROR_HANDLEhandle is not valid.
BASS_ERROR_CODECThe appropriate add-on to decode the samples is not loaded.
BASS_ERROR_NOTAVAILThe soundfont does not contain the requested preset.

See Also

Reference