BASS.NET API for the Un4seen BASS Audio Library

BassMidiBASS_MIDI_StreamLoadSamples Method

BASS.NET API for the Un4seen BASS Audio Library
Preloads the samples required by a MIDI file stream.

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

public static bool BASS_MIDI_StreamLoadSamples(
	int handle


Type: SystemInt32
The MIDI stream handle.

Return Value

Type: Boolean
If 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.

Preloaded samples can be compacted/unloaded just like any other samples, so it is probably wise to disable the BASS_CONFIG_MIDI_COMPACT option when preloading samples, to avoid any chance of the samples subsequently being automatically unloaded.

This function should not be used while the MIDI stream is being rendered, as that could interrupt the rendering.

ERROR CODEDescription
BASS_ERROR_HANDLEhandle is not valid.
BASS_ERROR_NOTAVAILThe stream is for real-time events only, so it's not possible to know what presets are going to be used. Use BASS_MIDI_FontLoad(Int32, Int32, Int32) instead.

See Also