BASS.NET API for the Un4seen BASS Audio Library

BassVstBASS_VST_SetParamCopyParams Method

BASS.NET API for the Un4seen BASS Audio Library
Copies all parameters from one vstHandle to another one.

Both vstHandles must be of the same VST effect plugin!

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

public static void BASS_VST_SetParamCopyParams(
	int sourceVstHandle,
	int destinVstHandle
)

Parameters

sourceVstHandle
Type: SystemInt32
The source VST effect handle as returned by BASS_VST_ChannelSetDSP(Int32, String, BASSVSTDsp, Int32) from where to copy the parameters.
destinVstHandle
Type: SystemInt32
The destination VST effect handle as returned by BASS_VST_ChannelSetDSP(Int32, String, BASSVSTDsp, Int32) to where the parameters should be copied.
Remarks

Copying parameters might be useful, if you created multiple instances of a VST effect plugin (e.g. for different channels).
Examples

For crossfadings, you might use several BASS channels for playback - each should have the same VST-effects of course. So changes done in the VST-editor need to be applied to several channels under some circumstances - on the other hand, if the player is stopped and no channel is available, the VST-editor should still be accessible.
private VSTPROC _myVstProc; // make global, so GC will not collect it
private int vst1;
private int vst2;
private int ch1;
private int ch2;
...
// create the 'real' channels to use
ch1 = BASS_StreamCreateFile(...);
vst1 = BassVst.BASS_VST_ChannelSetDSP(0, 
               "C:\\VstPlugins\\Ambience.dll", BASSVSTDsp.BASS_VST_DEFAULT, 1);
ch2 = BASS_StreamCreateFile(...);
vst2 = BassVst.BASS_VST_ChannelSetDSP(0, 
               "C:\\VstPlugins\\Ambience.dll", BASSVSTDsp.BASS_VST_DEFAULT, 1);

// create an 'unchanneled' VST-editor
int vstDummy = BassVst.BASS_VST_ChannelSetDSP(0, 
                       "C:\\VstPlugins\\Ambience.dll", BASSVSTDsp.BASS_VST_DEFAULT, 0);

// we want to be notified about parameter changes ...
myVstProc = new VSTPROC(vstEditorCallback);
BassVst.BASS_VST_SetCallback(vstDummy, myVstProc, IntPtr.Zero);

// so when the user opens the VST-editor this is being called
public int vstEditorCallback(int vstDummy, int action, int param1, int param2, IntPtr user)
{
    if (action == BASS_VST_PARAM_CHANGED)
    {
        // the user has changed some slider in the unchanneled editor
        // copy the changes to the 'real' channels
        BassVst.BASS_VST_SetParamCopyParams(vstDummy, vst1);
        BassVst.BASS_VST_SetParamCopyParams(vstDummy, vst2);
    }
    return 0;  
}
See Also

Reference