The processing granularity of a channel.

    DWORD handle,
    float unit


handleThe channel handle... a HMUSIC, HSTREAM, HRECORD.
unitThe processing unit size in sample frames... 0 = none.


This attribute allows a channel's processing to be in units of a certain size, which can be helpful for some DSP processing. It does not apply to decoding channels or recording channels without a RECORDPROC; their procesing is controlled by BASS_ChannelGetData.

Each processing cycle will be on a whole number of units, not necessarily only one unit, and the number of units can vary between cycles depending on how much space there is in the channel's playback buffer (or captured data in a recording buffer). There might not be a whole number of units at the end of a file or when a stream stalls.

When granularity is enabled (non-0), it can change the timing of any DSP/FX changes that are made in mixtime sync callbacks. That is because the DSP/FX processing is done on the entire block of data at the end of the processing cycle then (rather than splitting it at the sync positions), to maintain the specified granularity, resulting in the changes effectively being applied at the start of the processing cycle.

The default value is 0 (none). Changes take immediate effect.


Request a processing unit of 512 samples.
BASS_ChannelSetAttribute(stream, BASS_ATTRIB_GRANULE, 512);

See also

BASS_ChannelGetAttribute, BASS_ChannelSetAttribute