BASS.NET API for the Un4seen BASS Audio Library

BassVstBASS_VST_EmbedEditor Method

BASS.NET API for the Un4seen BASS Audio Library
Many VST effects come along with an graphical parameters editor; with the following function, you can embed these editors to your user interface.

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

[DllImportAttribute("bass_vst")]
public static bool BASS_VST_EmbedEditor(
	int vstHandle,
	IntPtr parentWindow
)

Parameters

vstHandle
Type: SystemInt32
The VST effect handle as returned by BASS_VST_ChannelSetDSP(Int32, String, BASSVSTDsp, Int32).
parentWindow
Type: SystemIntPtr
The IntPtr to the window handle (HWND) of the parents window in which the editor should be embedded (e.g. use a new modeless dialog or user control).

Return Value

Type: Boolean
If successful, is returned, else is returned. Use BASS_ErrorGetCode to get the error code.
Remarks

To embed the editor to another window, call this function with parentWindow set to the HWND (this.Handle) of the parent window. To check, if an effect has an editor, see the hasEditor flag set by BASS_VST_GetInfo(Int32, BASS_VST_INFO).

To "unembed" the editor, call this function with parentWindow set to .

If you create the editor window independently of a real channel (by skipping the channel parameter when calling BASS_VST_ChannelSetDSP(Int32, String, BASSVSTDsp, Int32)) and the editor displays any spectrums, VU-meters or such, the data for this come from the most recent channel using the same effect and the same scope. The scope can be set by BASS_VST_SetScope(Int32, Int32) to any ID, the default is 0.

In order to create a new window in which the editor should be embedded, it is a good idea to call BASS_VST_GetInfo(Int32, BASS_VST_INFO) in order to retrieve the editors height and width.

Examples

private int _vstHandle = 0;
...
_vstHandle = BassVst.BASS_VST_ChannelSetDSP(_stream, 
                     "C:\\VstPlugins\\Ambience.dll", BASSVSTDsp.BASS_VST_DEFAULT, 1 );
// show the embedded editor
BASS_VST_INFO vstInfo = new BASS_VST_INFO();
if ( BassVst.BASS_VST_GetInfo(vstHandle, vstInfo) && vstInfo.hasEditor )
{
  // create a new System.Windows.Forms.Form
  Form f = new Form();
  f.Width = vstInfo.editorWidth+4;
  f.Height = vstInfo.editorHeight+34;
  f.Closing += new CancelEventHandler(f_Closing);
  f.Text = vstInfo.effectName;
  f.Show();
  BassVst.BASS_VST_EmbedEditor(_vstHandle, f.Handle);
}

private void f_Closing(object sender, CancelEventArgs e)
{
  // unembed the VST editor
  BassVst.BASS_VST_EmbedEditor(_vstHandle, IntPtr.Zero);
}
See Also

Reference