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 to 100, 0 = no limit.

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, BASSMIDI will begin killing voices, starting with the most quiet.

When the CPU usage is limited, the stream's samples are loaded asynchronously so that any loading delays (eg. due to slow disk) do not hold up the stream for too long. If a sample cannot be loaded in time, then it will be silenced until it is available and the stream will continue playing other samples as normal in the meantime. This does not affect sample loading via BASS_MIDI_StreamLoadSamples, which always operates synchronously.

By default, a MIDI stream will have no CPU limit.

See also

BASS_ATTRIB_MIDI_VOICES

BASS_ChannelGetAttribute, BASS_ChannelSetAttribute