BASS.NET API for the Un4seen BASS Audio Library

BassVstBASS_VST_ChannelSetDSP Method (Int32, String, BASSVSTDsp, Int32)

BASS.NET API for the Un4seen BASS Audio Library
Assigns a VST effects (defined by a DLL file name) to any BASS channels.

This overload implements the Unicode overload for the dllFile name, so the BASS_UNICODE flag will automatically be added if not already set.

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

public static int BASS_VST_ChannelSetDSP(
	int chan,
	string dllFile,
	BASSVSTDsp flags,
	int priority
)

Parameters

chan
Type: SystemInt32
The channel handle... a HSTREAM, HMUSIC, or HRECORD. Or 0, if you want to test, if the dll is a valid VST plugin.
dllFile
Type: SystemString
The fully qualified path and file name to the VST effect plugin (a DLL file name).
flags
Type: Un4seen.Bass.AddOn.VstBASSVSTDsp
A combination of these flags (see BASSVSTDsp):
BASS_VST_KEEP_CHANSBy default, mono effects assigned to stereo channels are mixed down before processing and converted back to stereo afterwards. Set this flag to avoid this behaviour in which case only the first channel is affected by processing.
BASS_UNICODEdllFile is Unicode (16-bit characters) (not needed here, since the overloads already take care of it).
priority
Type: SystemInt32
Same meaning as for BASS_ChannelSetDSP(Int32, DSPPROC, IntPtr, Int32) - DSPs with higher priority are called before those with lower.

Return Value

Type: Int32
On success, the method returns the new vstHandle that must be given to all the other functions, else 0 is returned. Use BASS_ErrorGetCode to get the error code.
Remarks

The VST plugin is implemented via a DSP callback on the channel. That means when you play the channel (or call BASS_ChannelGetData(Int32, IntPtr, Int32) if it's a decoding channel), the sample data will be sent to the VST effect at the same time. If the channel is freed all DSPs are removed automatically, also all VST DSPs are removed as well. If you want or need to free the VST DSP manually you can call BASS_VST_ChannelRemoveDSP(Int32, Int32).

For testing if a DLL is a valid VST effect, you can set chan to 0 - however, do not forget to call BASS_VST_ChannelRemoveDSP(Int32, Int32) even in this case.

You may safely assign the same DLL to different channels at the same time - the library makes sure, every channel is processed indepeningly. But take care to use the correct vstHandles in this case.

Finally, you can use any number of VST effects on a channel. They are processed alongside with all other BASS DSPs in the order of it's priority.

To set or get the parameters of a VST effect you might use BASS_VST_GetParamCount(Int32) alongside with BASS_VST_GetParam(Int32, Int32) and BASS_VST_SetParam(Int32, Int32, Single) to enumerate over the total number of effect parameters. To retrieve details about an individual parameter you might use BASS_VST_GetParamInfo(Int32, Int32, BASS_VST_PARAM_INFO). If the VST effect supports an embedded editor you might also invoke this one with BASS_VST_EmbedEditor(Int32, IntPtr). If the embedded editor also supports localization you might set the language in advance with BASS_VST_SetLanguage(String).

If you need to temporarily bypass the VST effect you might call BASS_VST_SetBypass(Int32, Boolean) - BASS_VST_GetBypass(Int32) will tell you the current bypass status though.

Use BASS_VST_GetInfo(Int32, BASS_VST_INFO) to get even more details about a loaded VST plugin.

Examples

// create any stream 
int stream = Bass.BASS_StreamCreateFile(_fileName, 0, 0, BASSFlag.BASS_SAMPLE_FLOAT);
// and assign a VST effect
int vstHandle = BassVst.BASS_VST_ChannelSetDSP(stream, 
                        "C:\\VstPlugins\\DelayEditGUI.dll", BASSVSTDsp.BASS_VST_DEFAULT, 1);
// and play the stream
Bass.BASS_ChannelPlay(stream, false);
...
// if the VST effect is not needed anymore...
BassVst.BASS_VST_ChannelRemoveDSP(stream, vstHandle);
See Also

Reference