BASS_MIDI_FontLoad
Preloads presets from a soundfont.
BOOL BASS_MIDI_FontLoad( HSOUNDFONT handle, int preset, int bank );
Parameters
handle | The soundfont handle. |
preset | Preset number to load... -1 = all presets. |
bank | Bank number to load... -1 = all banks. |
Return value
If successful, TRUE is returned, else FALSE is returned. Use BASS_ErrorGetCode to get the error code.Error codes
BASS_ERROR_HANDLE | handle is not valid. |
BASS_ERROR_CODEC | The appropriate add-on to decode the samples is not loaded. |
BASS_ERROR_NOTAVAIL | The soundfont does not contain the requested preset. |
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 will not 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 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 and BASS_MIDI_FontUnload.
A soundfont should not be preloaded while it is being used to render any MIDI streams, as that could delay the rendering.