BASS.NET API for the Un4seen BASS Audio LibraryBassWasapiHandlerWasapiOutputCallback Method BASS.NET API for the Un4seen BASS Audio Library
Provides a ready made WASAPIPROC callback procedure which might be used for WASAPI output.

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

public virtual int WasapiOutputCallback(
	IntPtr buffer,
	int length,
	IntPtr user


Type: SystemIntPtr
The pointer to the buffer in which to put the data to output. Will always be floating point!
Type: SystemInt32
The number of bytes to process.
Type: SystemIntPtr
The user instance data given when BASS_WASAPI_Init(Int32, Int32, Int32, BASSWASAPIInit, Single, Single, WASAPIPROC, IntPtr) was called.

Return Value

Type: Int32
The number of bytes written.


In order to use this default output WASAPI callback (playback), you need to make sure that you use this callback only with WASAPI output (IsInput must be ).

Furthermore the following should be considered: If the underlying stream channel OutputChannel is at the end (all data was decoded), this callback does NOT automatically stop WASAPI via BASS_WASAPI_Stop(Boolean). So you need to do that by yourself (if you whish to save some performance), e.g. setup a BASS_SYNC_END on the OutputChannel. If the underlying OutputChannel returns less data, than requested the WASAPI output buffer will be filled with 0's (silence).

Internally BASS_ChannelGetData(Int32, IntPtr, Int32) will be called on the underlying OutputChannel to request sample data, before the sample data is send to the WASAPI output.

If you intend to overload this callback in a derive implementation make sure to call the base method to not loose any functionatily.

See Also