BASS.NET API for the Un4seen BASS Audio LibraryBassWaDspBASS_WADSP_SetChannel Method BASS.NET API for the Un4seen BASS Audio Library
Assigns a channel to a Winamp DSP.

You only need this method, if you do NOT use the default BASS_WADSP_ChannelSetDSP(Int32, Int32, Int32) method, but use your own DSP callback (see DSPPROC).

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

[DllImportAttribute("bass_wadsp.dll", CharSet = CharSet.Auto)]
public static bool BASS_WADSP_SetChannel(
	int plugin,
	int handle
)

Parameters

plugin
Type: SystemInt32
The plugin handle (returned by BASS_WADSP_Load(String, Int32, Int32, Int32, Int32, WINAMPWINPROC)).
handle
Type: SystemInt32
The BASS channel handle (HSTREAM, HMUSIC, or HRECORD) which to assign to the Winamp DSP.

Return Value

Type: Boolean
on success, else . Use BASS_ErrorGetCode to get the error code.
Remarks

You must use this method when implementing your own DSPPROC callback before starting to play the channel.

ERROR CODEDescription
BASS_ERROR_HANDLEThe plugin or handle is not a valid handle.

Examples

VB
Private _streamA As Integer = 0
Private _dspPluginA As Integer = 0
Private _myDSPAddr As DSPPROC
...
_dspPluginA = BassWaDsp.BASS_WADSP_Load("dsp_test.dll", 5, 5, 100, 100, Nothing)
BassWaDsp.BASS_WADSP_Start(_dspPluginA, 0, 0)
...
_streamA = Bass.BASS_StreamCreateFile("test.mp3", 0, 0, 
                BASSFlag.BASS_DEFAULT Or BASSFlag.BASS_STREAM_AUTOFREE)
' play the stream
If _streamA <> 0 Then
  _myDSPAddr = New DSPPROC(AddressOf MyWinampDSP)
  Bass.BASS_ChannelSetDSP(_streamA, _myDSPAddr, New IntPtr(_dspPluginA), - 500)
  BassWaDsp.BASS_WADSP_SetChannel(_dspPluginA, _streamA)
  Bass.BASS_ChannelPlay(_streamA, False)
End If
...
Private Sub MyWinampDSP(handle As Integer, channel As Integer, 
                        buffer As IntPtr, length As Integer, user As IntPtr)
  If length = 0 OrElse buffer = IntPtr.Zero Then
    Return
  End If
  BassWaDsp.BASS_WADSP_ModifySamplesDSP(user.ToInt32(), buffer, length)
End Sub
private int _streamA = 0;
private int _dspPluginA = 0;
private DSPPROC _myDSPAddr;
...
_dspPluginA = BassWaDsp.BASS_WADSP_Load("dsp_test.dll", 5, 5, 100, 100, null);
BassWaDsp.BASS_WADSP_Start(_dspPluginA, 0, 0);
...
_streamA = Bass.BASS_StreamCreateFile("test.mp3", 0, 0, 
                BASSFlag.BASS_DEFAULT | BASSFlag.BASS_STREAM_AUTOFREE);
// play the stream
if (_streamA != 0 )
{
  _myDSPAddr = new DSPPROC(MyWinampDSP);
  Bass.BASS_ChannelSetDSP(_streamA, _myDSPAddr, new IntPtr(_dspPluginA), -500);
  BassWaDsp.BASS_WADSP_SetChannel(_dspPluginA, _streamA);
  Bass.BASS_ChannelPlay(_streamA, false);
}
...
private void MyWinampDSP(int handle, int channel, IntPtr buffer, int length, IntPtr user)
{
  if (length == 0 || buffer == IntPtr.Zero)
    return;
  BassWaDsp.BASS_WADSP_ModifySamplesDSP(user.ToInt32(), buffer, length);
}
See Also

Reference