BASS.NET API for the Un4seen BASS Audio LibraryBassWaDspBASS_WADSP_ModifySamplesSTREAM Method (Int32, IntPtr, Int32)BASS.NET API for the Un4seen BASS Audio Library
Invokes the internal 'ModifySamples' method of the Winamp DSP directly (which is only needed for user defined DSPPROC callbacks or in a user defined STREAMPROC).

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

public static int BASS_WADSP_ModifySamplesSTREAM(
	int plugin,
	IntPtr buffer,
	int length


Type: SystemInt32
The plugin handle (returned by BASS_WADSP_Load(String, Int32, Int32, Int32, Int32, WINAMPWINPROC)).
Type: SystemIntPtr
The pointer to the memory block containing the sample data to modify.
Type: SystemInt32
The number of bytes contained in the buffer.

Return Value

Type: Int32
The number of bytes modified, which might be different from the number of bytes given. A Winamp DSP might return at max. twice the number of bytes but not less than half the number of bytes.

This method can be used to support Winamp DSPs which modify the samplerate, pitch etc. - meaning modifying the number of bytes given. However, this is not a simple task to do so, since Bass does not expect this. In order to handle a modified number of bytes you might need to implement a complex intermediate 'ring-buffer' in between Bass and the Winamp DSP. Note: Some Winamp DSPs work with a fixed number of 1152 samples only (meaning 1152 * chans * 2 bytes!) - this might also bring in some additional complexity. Implementing and correctly handling this intermediate 'buffer' is up to you and not handled by BASS_WADSP - however, this method is the right method to use for such a case, since it returns exactly what the Winamp DSP returned.

So make sure, that the buffer is at least twice as big as the samples it contains when you call this method, so that the Winamp DSP might have enough space to store it's returned samples into it.

This method can be used with 8-bit, 16-bit or float channels. Since all Winamp DSPs will internally only work with 16-bit channels an automatic internal conversion from 8-bit resp. float to 16-bit and back will take place.

See Also