BASS_ATTRIB_CPU attribute

The CPU usage of a channel.

BASS_ChannelGetAttribute(
    DWORD handle,
    BASS_ATTRIB_CPU,
    float *cpu
);

Parameters

handleThe channel handle... a HMUSIC or HSTREAM.
cpuThe CPU usage.

Remarks

This attribute gives the percentage of CPU that the channel is using, including the time taken by decoding and DSP/FX processing. It does not include the time taken to add the channel's data to the final output mix during playback. The processing of some add-on stream formats may also not be entirely included, if they use additional decoding threads; see the add-on documentation for details.

Like BASS_GetCPU, this function does not strictly tell the CPU usage, but rather how timely the processing is. For example, if it takes 10ms to generate 100ms of data, that would be 10%. If the reported usage exceeds 100%, that means the channel's data is taking longer to generate than to play. The duration of the data is based on the channel's current sample rate (BASS_ATTRIB_FREQ).

A channel's CPU usage is updated whenever it generates data. That could be during a playback buffer update cycle, or a BASS_Update call, or a BASS_ChannelUpdate call. For a decoding channel, it would be in a BASS_ChannelGetData or BASS_ChannelGetLevel call.

This attribute is read-only, so cannot be modified via BASS_ChannelSetAttribute.

See also

BASS_ChannelGetAttribute, BASS_GetCPU