BASS.NET API for the Un4seen BASS Audio LibraryBASS_VST_AEFFECTFromIntPtr Method BASS.NET API for the Un4seen BASS Audio Library
Returns an instance of the BASS_VST_AEFFECT class derived from an IntPtr (aeffect) as obtained via BASS_VST_GetInfo(Int32, BASS_VST_INFO).

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

public static BASS_VST_AEFFECT FromIntPtr(
	IntPtr aeffect
)

Parameters

aeffect
Type: SystemIntPtr
The IntPtr to the AEffect structure as obtained from the BASS_VST_INFO class when calling BASS_VST_GetInfo(Int32, BASS_VST_INFO).

Return Value

Type: BASS_VST_AEFFECT
An instance of the BASS_VST_AEFFECT class if successfull, otherwise will be returned.
Remarks

This method can only be used in the .Net Framework version 2.0 or above!
Examples

VB
vstHandle = BassVst.BASS_VST_ChannelSetDSP(_stream, 
                    "C:\VstPlugins\Ambience.dll", BASSVSTDsp.BASS_VST_DEFAULT, 0)
Dim vstInfo As New BASS_VST_INFO()
If BassVst.BASS_VST_GetInfo(vstHandle, vstInfo) Then
  Dim aeffect As BASS_VST_AEFFECT = BASS_VST_AEFFECT.FromIntPtr(vstInfo.aeffect)
  If Not (aeffect Is Nothing) Then
    ' now you might use the aeffect instance, e.g. retrieve the number of programs
    Dim numPrograms As Integer = aeffect.numPrograms
    ...
    ' or call the dispatcher...
    Dim cmd As String = "bypass"
    Dim gch As GCHandle = GCHandle.Alloc(cmd, GCHandleType.Pinned)
    If aeffect.dispatcher(vstInfo.aeffect, BASSVSTDispatcherOpCodes.effCanDo, 
                          0, 0, gch.AddrOfPinnedObject(), 0F) <> 0 Then
      Dim ret As Integer = aeffect.dispatcher(vstInfo.aeffect, BASSVSTDispatcherOpCodes.effSetBypass, 
                                              0, 1, IntPtr.Zero, 0F)
      ...
      Console.WriteLine(ret.ToString())
    End If
    gch.Free()
    ...
  End If 
End If
vstHandle = BassVst.BASS_VST_ChannelSetDSP(_stream, 
                    "C:\\VstPlugins\\Ambience.dll", BASSVSTDsp.BASS_VST_DEFAULT, 0);
BASS_VST_INFO vstInfo = new BASS_VST_INFO();
if (BassVst.BASS_VST_GetInfo(vstHandle, vstInfo))
{
  BASS_VST_AEFFECT aeffect = BASS_VST_AEFFECT.FromIntPtr(vstInfo.aeffect);
  if (aeffect != null)
  {
    // now you might use the aeffect instance, e.g. retrieve the number of programs...
    int numPrograms = aeffect.numPrograms;
    ...
    // or call the dispatcher...
    string cmd = "bypass";
    GCHandle gch = GCHandle.Alloc(cmd, GCHandleType.Pinned);
    if (aeffect.dispatcher(vstInfo.aeffect, BASSVSTDispatcherOpCodes.effCanDo, 
                            0, 0, gch.AddrOfPinnedObject(), 0.0f) != 0)
    {
      int ret = aeffect.dispatcher(vstInfo.aeffect, BASSVSTDispatcherOpCodes.effSetBypass, 
                                   0, 1, IntPtr.Zero, 0.0f);
      Console.WriteLine(ret.ToString());
    }
    gch.Free();
    ...
  }
}
See Also

Reference