BASS.NET API for the Un4seen BASS Audio Library

BassBASS_ChannelSetFX Method

BASS.NET API for the Un4seen BASS Audio Library
Sets an effect on a stream, MOD music, or recording channel.

Namespace:  Un4seen.Bass
Assembly:  Bass.Net (in Bass.Net.dll) Version: 2.4.17.5
Syntax

[DllImportAttribute("bass")]
public static int BASS_ChannelSetFX(
	int handle,
	BASSFXType type,
	int priority
)

Parameters

handle
Type: SystemInt32
The channel handle... a HSTREAM, HMUSIC, or HRECORD.
type
Type: Un4seen.BassBASSFXType
One of the following types of effect (see BASSFXType):
BASS_FX_DX8_CHORUSDX8 Chorus. Use BASS_DX8_CHORUS structure to set/get parameters.
BASS_FX_DX8_COMPRESSORDX8 Compression. Use BASS_DX8_COMPRESSOR structure to set/get parameters.
BASS_FX_DX8_DISTORTIONDX8 Distortion. Use BASS_DX8_DISTORTION structure to set/get parameters.
BASS_FX_DX8_ECHODX8 Echo. Use BASS_DX8_ECHO structure to set/get parameters.
BASS_FX_DX8_FLANGERDX8 Flanger. Use BASS_DX8_FLANGER structure to set/get parameters.
BASS_FX_DX8_GARGLEDX8 Gargle. Use BASS_DX8_GARGLE structure to set/get parameters.
BASS_FX_DX8_I3DL2REVERBDX8 I3DL2 (Interactive 3D Audio Level 2) reverb. Use BASS_DX8_I3DL2REVERB structure to set/get parameters.
BASS_FX_DX8_PARAMEQDX8 Parametric equalizer. Use BASS_DX8_PARAMEQ structure to set/get parameters.
BASS_FX_DX8_REVERBDX8 Reverb. Use BASS_DX8_REVERB structure to set/get parameters.
BASS_FX_VOLUMEVolume level adjustment. Use BASS_FX_VOLUME_PARAM structure to set/get parameters.
Other effects may be supported by add-ons, e.g. BASS_FX:
BASS_FX_BFX_MIXBASS_FX Channel Swap/Remap/Downmix. Use BASS_BFX_MIX structure to set/get parameters.
BASS_FX_BFX_ROTATEBASS_FX Channel Rotate. Use BASS_BFX_ROTATE structure to set/get parameters.
BASS_FX_BFX_VOLUMEBASS_FX Volume. Use BASS_BFX_VOLUME structure to set/get parameters.
BASS_FX_BFX_PEAKEQBASS_FX Peaking Equalizer. Use BASS_BFX_PEAKEQ structure to set/get parameters.
BASS_FX_BFX_DAMPBASS_FX Dynamic Amplification. Use BASS_BFX_DAMP structure to set/get parameters.
BASS_FX_BFX_AUTOWAHBASS_FX Auto Wah. Use BASS_BFX_AUTOWAH structure to set/get parameters.
BASS_FX_BFX_PHASERBASS_FX Phaser. Use BASS_BFX_PHASER structure to set/get parameters.
BASS_FX_BFX_ECHO4BASS_FX Echo 3. Use BASS_BFX_ECHO3 structure to set/get parameters.
BASS_FX_BFX_CHORUSBASS_FX Chorus. Use BASS_BFX_CHORUS structure to set/get parameters.
BASS_FX_BFX_BQFBASS_FX BiQuad Filter. Use BASS_BFX_BQF structure to set/get parameters.
BASS_FX_BFX_DISTORTIONBASS_FX Distortion. Use BASS_BFX_DISTORTION structure to set/get parameters.
BASS_FX_BFX_COMPRESSOR2BASS_FX Compressor. Use BASS_BFX_COMPRESSOR2 structure to set/get parameters.
BASS_FX_BFX_VOLUME_ENVBASS_FX volume envelope effect. Use BASS_BFX_VOLUME_ENV structure to set/get parameters.
priority
Type: SystemInt32
The priority of the new FX, which determines it's position in the DSP chain - DSP/FX with higher priority are applied before those with lower. This parameter has no effect with DX8 effects when the "with FX flag" DX8 effect implementation is used.

Return Value

Type: Int32
If succesful, then the new effect's handle is returned, else 0 is returned. Use BASS_ErrorGetCode to get the error code.
Remarks

Multiple effects may be used per channel. Use BASS_ChannelRemoveFX(Int32, Int32) to remove an effect. Use BASS_FXSetParameters(Int32, IntPtr) to set an effect's parameters.

Effects can be applied to MOD musics and streams, but not samples. If you want to apply an effect to a sample, you could use a stream instead.

Depending on the DX8 effect implementation being used by the channel, the channel may have to be stopped before adding or removing DX8 effects on it. If necessary, that is done automatically and the channel is resumed afterwards.

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.

ERROR CODEDescription
BASS_ERROR_HANDLEhandle is not a valid channel.
BASS_ERROR_ILLTYPEAn illegal type was specified.
BASS_ERROR_NOFXDX8 effects are unavailable.
BASS_ERROR_FORMATThe channel's format is not supported by the effect. It may be floating-point (without DX9) or more than stereo.
BASS_ERROR_UNKNOWNSome other mystery problem!

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. On Windows CE, only PARAMEQ is supported.

Examples

BASS_DX8_ECHO echo = new BASS_DX8_ECHO(90f, 50f, 500f, 500f, true);
int channel = Bass.BASS_StreamCreateFile("test.mp3", 0, 0, BASSFlag.BASS_DEFAULT);
int fxEchoHandle = Bass.BASS_ChannelSetFX(channel, BASSFXType.BASS_FX_ECHO, 1);
...
// changing the echo effect, dry/wet mix...
echo.fWetDryMix = 50f;
Bass.BASS_FXSetParameters(fxEchoHandle, echo);
See Also

Reference