BASS_ChannelSetDSPEx

Sets a user DSP function on a stream, MOD music, or recording channel.

HDSP BASS_ChannelSetDSPEx(
    DWORD handle,
    DSPPROC *proc,
    void *user,
    int priority,
    DWORD flags
);

Parameters

handleThe channel handle... a HSTREAM, HMUSIC, or HRECORD.
procThe callback function.
userUser instance data to pass to the callback function.
priorityThe priority of the new DSP, which determines its position in the DSP chain. DSPs with higher priority are called before those with lower.
flagsA combination of these flags.
BASS_DSP_BYPASSSet the DSP in a bypassed/paused state. Use BASS_FXSetBypass to start processing.
BASS_DSP_FLOATThe DSP function always wants floating-point sample data. 8/16-bit data will be converted before being passed to the DSP function, and then converted back again after (if BASS_DSP_READONLY is not set).
BASS_DSP_FREECALLCall the DSP function with a NULL buffer when it is removed from the channel or the channel is freed.
BASS_DSP_READONLYThe DSP function does not modify the data. This lets BASS know that it does not need to copy back data from any temporary buffers, eg. used in floating-point conversion or mono/stereo channel separation.
BASS_DSP_MONO_N(n)Apply the DSP to only the n'th channel (1 - 255). The DSP function will receive mono data.
BASS_DSP_STEREO_N(n)Apply the DSP to only the n'th channel (1 - 255) and the one after it. The DSP function will receive stereo data.

Return value

If successful, then the new DSP's handle is returned, else 0 is returned. Use BASS_ErrorGetCode to get the error code.

Error codes

BASS_ERROR_HANDLEhandle is not a valid channel.
BASS_ERROR_ILLPARAMproc cannot be NULL.
BASS_ERROR_SPEAKERThe specified MONO or STEREO flag is invalid.

Remarks

This function is the same as BASS_ChannelSetDSP but with the additional flags options, so the remarks there also apply here.

When floating-point conversion is enabled via the BASS_DSP_FLOAT flag on adjacent DSPs in the DSP chain, the data will remain floating-point (rather than being converted back and forth) between them. If it is enabled on all DSPs then the data will remain floating-point throughout, like enabling the BASS_CONFIG_FLOATDSP option, except that BASS_CONFIG_FLOATDSP also applies to any effects set via BASS_ChannelSetFX and the BASS_ATTRIB_VOLDSP attribute.

See also

BASS_ChannelLock, BASS_ChannelRemoveDSP, BASS_ChannelSetFX, BASS_FXFree, BASS_FXSetPriority, BASS_CONFIG_FLOATDSP, DSPPROC callback