Namespace: Un4seen.Bass.AddOn.Midi
Assembly: Bass.Net (in Bass.Net.dll) Version: 2.4.17.2
[DllImportAttribute("bassmidi")] 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: BooleanIf successful, is returned, else is returned. Use BASS_ErrorGetCode to get the error code.
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 CODE | Description |
---|---|
BASS_ERROR_HANDLE | handle is not valid. |
BASS_ERROR_CODEC | The appropriate add-on to decode the samples is not loaded. |
BASS_ERROR_FILEFORM | An SFZ sample has an unknown file format. A BASS add-on may be needed to handle it. |
BASS_ERROR_NOTAVAIL | The soundfont does not contain the requested preset. |
BASS_ERROR_MEM | There is insufficient memory. |