BASS_ChannelSetFX
Sets an effect on a stream, MOD music, or recording channel.
HFX BASS_ChannelSetFX(
DWORD handle,
DWORD type,
int priority
);
Parameters
handle | The channel handle... a HSTREAM, HMUSIC, or HRECORD.
|
type | The type of effect. One of the following, with optional flags.
BASS_FX_DX8_CHORUS | DX8 Chorus. Use BASS_DX8_CHORUS structure to set/get parameters.
| BASS_FX_DX8_COMPRESSOR | DX8 Compression. Use BASS_DX8_COMPRESSOR structure to set/get parameters.
| BASS_FX_DX8_DISTORTION | DX8 Distortion. Use BASS_DX8_DISTORTION structure to set/get parameters.
| BASS_FX_DX8_ECHO | DX8 Echo. Use BASS_DX8_ECHO structure to set/get parameters.
| BASS_FX_DX8_FLANGER | DX8 Flanger. Use BASS_DX8_FLANGER structure to set/get parameters.
| BASS_FX_DX8_GARGLE | DX8 Gargle. Use BASS_DX8_GARGLE structure to set/get parameters.
| BASS_FX_DX8_I3DL2REVERB | DX8 I3DL2 (Interactive 3D Audio Level 2) reverb. Use BASS_DX8_I3DL2REVERB structure to set/get parameters.
| BASS_FX_DX8_PARAMEQ | DX8 Parametric equalizer. Use BASS_DX8_PARAMEQ structure to set/get parameters.
| BASS_FX_DX8_REVERB | DX8 Reverb. Use BASS_DX8_REVERB structure to set/get parameters.
| BASS_FX_VOLUME | Volume level adjustment. Use BASS_FX_VOLUME_PARAM structure to set/get parameters.
| BASS_DSP_BYPASS | Flag: Set the effect in a bypassed/paused state. Use BASS_FXSetBypass to start processing.
| BASS_DSP_MONO_N(n) | Flag: Apply the effect to only the n'th channel (1 - 255).
| BASS_DSP_STEREO_N(n) | Flag: Apply the effect to only the n'th channel (1 - 255) and the one after it.
|
Other effects may be supported by add-ons, eg. BASS_FX.
|
priority | The priority of the new effect, which determines its position in the DSP chain. DSP/FX with higher priority are applied before those with lower.
|
Return value
If successful, then the new effect's handle is returned, else 0 is returned. Use BASS_ErrorGetCode to get the error code.
Error codes
BASS_ERROR_HANDLE | handle is not a valid channel.
|
BASS_ERROR_ILLTYPE | type is invalid. If an add-on effect type, it may be that the add-on has not been loaded.
|
BASS_ERROR_NOFX | The specified DX8 effect is unavailable.
|
BASS_ERROR_FORMAT | The channel's format is not supported by the effect.
|
BASS_ERROR_SPEAKER | The specified MONO or STEREO flag is invalid.
|
BASS_ERROR_UNKNOWN | Some other mystery problem!
|
Remarks
Use BASS_ChannelRemoveFX or BASS_FXFree to remove an effect. Use BASS_FXSetParameters to set an effect's parameters.
Multiple effects may be used per channel, in which case the order that they are applied is determined by their priorities. The priorities can be changed via BASS_FXSetPriority. Any effects that have the same priority are applied in the order that they were given that priority.
DX8 effects are limited to stereo, so when they are used on a multi-channel stream, BASS will split the data into stereo streams (plus a mono one for odd numbers) for processing by multiple instances of the effect. That separate processing of channels may lead to unexpected results with some effect types.
Effects can be applied to MOD musics and streams, but not sample channels. If you want to apply effects to a sample, BASS_SampleGetChannel can create a stream from a sample.
Platform-specific
DX8 effects are a Windows feature requiring DirectX 8, or DirectX 9 for floating-point support. On other platforms, they are emulated by BASS, except for the following which are currently unsupported: COMPRESSOR, GARGLE, and I3DL2REVERB.
Windows 11 24H2 removed the I3DL2REVERB effect, so it should be avoided if you need to run on the latest Windows.
See also
BASS_ChannelLock, BASS_ChannelRemoveFX, BASS_FXGetParameters, BASS_FXReset, BASS_FXSetParameters, BASS_FXSetPriority, BASS_ChannelSetDSP, BASS_CONFIG_FLOATDSP