BASS.NET API for the Un4seen BASS Audio LibraryVSTPROC DelegateBASS.NET API for the Un4seen BASS Audio Library
User defined VST callback method to be used with BASS_VST_SetCallback(Int32, VSTPROC, IntPtr).

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

public delegate int VSTPROC(
	int vstHandle,
	BASSVSTAction action,
	int param1,
	int param2,
	IntPtr user
)

Parameters

vstHandle
Type: SystemInt32
The VST plugin handle as returned from BASS_VST_ChannelSetDSP(Int32, String, BASSVSTDsp, Int32).
action
Type: Un4seen.Bass.AddOn.VstBASSVSTAction
The action parameter, one of the BASSVSTAction values (see below).
param1
Type: SystemInt32
The first parameter (see the VST SDK for further details).
param2
Type: SystemInt32
The second parameter (see the VST SDK for further details).
user
Type: SystemIntPtr
The user parameter as specified in the BASS_VST_SetCallback(Int32, VSTPROC, IntPtr) call.

Return Value

Type: Int32
Unless defined otherwise, the callback function should always return 0.
Remarks

The callback function is called with one of the following actions (see BASSVSTAction):

Actions:
BASS_VST_PARAM_CHANGEDSome parameters are changed by the editor opened by BASS_VST_EmbedEditor(Int32, IntPtr), NOT called if you call BASS_VST_SetParam(Int32, Int32, Single).

param1=oldParamNum, param2=newParamNum; might be used to detect changes in the number of parameters in case the VST uses dynamic parameter numbers.

BASS_VST_EDITOR_RESIZEDThe embedded editor window should be resized, the new width/height can be found in param1/param2 and in BASS_VST_GetInfo(Int32, BASS_VST_INFO).
BASS_VST_AUDIO_MASTERCan be used to subclass the audioMaster callback (see the VST SDK), param1 is a pointer to a BASS_VST_AUDIO_MASTER_PARAM structure.

Examples

VB
Private _myVstProc As VSTPROC ' keep the callback delegate in a global member
...
' your VST callback - referenced below by BASS_VST_SetCallback()
Private Function YourVstProc(vstHandle As Integer, action As BASSVSTAction, param1 As Integer, param2 As Integer, user As IntPtr) As Integer
  Select Case action
    Case BASSVSTAction.BASS_VST_PARAM_CHANGED
      ' we get notified that the user has changed some sliders in the editor - 
      ' do what to do here ...
    Case BASSVSTAction.BASS_VST_EDITOR_RESIZED
      ' the editor window requests a new size,
      ' maybe we should resize the window the editor is embedded in?
      ' the new width/height can be found in param1/param2
    Case BASSVSTAction.BASS_VST_AUDIO_MASTER
      ' this is only for people familiar with the VST SDK,
      ' param1 is a pointer to a BASS_VST_AUDIO_MASTER_PARAM structure
      ' which contains all information needed
  End Select
  Return 0
End Function
...
' open the VST editor (e.g. if we are inside a System.Windows.Forms.Form)
BassVst.BASS_VST_EmbedEditor(vstHandle, Me.Handle)
' we want to get notified for parameter changes etc.
_myVstProc = New VSTPROC(AddressOf YourVstProc)
BassVst.BASS_VST_SetCallback(vstHandle, _myVstProc, IntPtr.Zero)
private VSTPROC _myVstProc; // keep the callback delegate in a global member
...
// your VST callback - referenced below by BASS_VST_SetCallback()
private int YourVstProc(int vstHandle, BASSVSTAction action, int param1, int param2, IntPtr user)
{
  switch (action)
  {
    case BASSVSTAction.BASS_VST_PARAM_CHANGED:
      // we get notified that the user has changed some sliders in the editor - 
      // do what to do here ...
      break;
    case BASSVSTAction.BASS_VST_EDITOR_RESIZED:
      // the editor window requests a new size,
      // maybe we should resize the window the editor is embedded in?
      // the new width/height can be found in param1/param2
      break;
    case BASSVSTAction.BASS_VST_AUDIO_MASTER:
      // this is only for people familiar with the VST SDK,
      // param1 is a pointer to a BASS_VST_AUDIO_MASTER_PARAM structure
      // which contains all information needed
      break;
  }
  return 0;
}
...
// open the VST editor (e.g. if we are inside a System.Windows.Forms.Form)
BassVst.BASS_VST_EmbedEditor(vstHandle, this.Handle);
// we want to get notified for parameter changes etc.
_myVstProc = new VSTPROC(YourVstProc);
BassVst.BASS_VST_SetCallback(vstHandle, _myVstProc, IntPtr.Zero);
See Also

Reference