BASS_MIDI_StreamLoadSamples
Preloads the samples required by a MIDI file stream.
BOOL BASS_MIDI_StreamLoadSamples( HSTREAM handle );
Parameters
handle | The MIDI stream handle. |
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_NOTAVAIL | The stream is for real-time events only, so it is not possible to know what presets are going to be used. Use BASS_MIDI_FontLoad instead. |
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.The samples loaded by this function are subject to automatic compacting via the BASS_CONFIG_MIDI_COMPACT option, so it is probably wise to disable that option when using this function, to avoid any chance of the loaded samples subsequently being automatically unloaded.
This function is not affected by any filtering that may have been enabled via BASS_MIDI_StreamSetFilter; the samples loaded will be those needed by the original event sequence.
This function should not be used while the MIDI stream is being rendered, as it could delay the rendering.