BASS_ATTRIB_MIDI_CPU attribute


The maximum percentage of CPU time that a MIDI stream can use.

BASS_ChannelSetAttribute(
    HSTREAM handle,
    BASS_ATTRIB_MIDI_CPU,
    float limit
);

Parameters

handleThe MIDI stream handle.
limitThe CPU usage limit... 0 = automatic, over 100 = limit waiting for samples to load but do not kill voices.

Remarks

It is not strictly the CPU usage that is measured, but rather how timely the stream is able to render data. For example, a limit of 50% would mean that the rendering would need to be at least 2x real-time speed. When the limit is exceeded (unless the limit is over 100), BASSMIDI will begin killing voices, starting with the most quiet.

When the CPU usage is limited, BASSMIDI will also limit how long it waits for samples to load. If the required amount of data cannot be loaded in time then a sample will be silenced until it is available and the stream will continue playing other samples as normal in the meantime.

The default value is 0 (automatic), which means the stream's CPU usage will be limited to 100% when it is processed in an update thread (eg. during playback) and will otherwise be unlimited (wait for samples indefinitely and no voice killing).

See also

BASS_ATTRIB_MIDI_VOICES

BASS_ChannelGetAttribute, BASS_ChannelSetAttribute