BASS.NET API for the Un4seen BASS Audio LibraryENCODEPROCEX DelegateBASS.NET API for the Un4seen BASS Audio Library
User defined callback function to process (receive) encoded sample data.

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

public delegate void ENCODEPROCEX(
	int handle,
	int channel,
	IntPtr buffer,
	int length,
	long offset,
	IntPtr user


Type: SystemInt32
The encoder that the data is from.
Type: SystemInt32
The channel that the data is from.
Type: SystemIntPtr
The pointer to the buffer containing the encoded data.
Type: SystemInt32
The number of bytes in the buffer.
Type: SystemInt64
The file offset of the data in bytes.
Type: SystemIntPtr
The user instance data given.

To have the encoded data received by this callback function, the encoder needs to be told to output to STDOUT (instead of a file).

It is clever to NOT alloc any buffer data (e.g. a byte[]) everytime within the callback method, since ALL callbacks should be really fast! And if you would do a 'byte[] data = new byte[]' every time here...the GarbageCollector would never really clean up that memory. Sideeffects might occure, due to the fact, that BASS will call this callback too fast and too often...

NOTE: When you pass an instance of a callback delegate to one of the BASS functions, this delegate object will not be reference counted. This means .NET would not know, that it might still being used by BASS. The Garbage Collector might (re)move the delegate instance, if the variable holding the delegate is not declared as global. So make sure to always keep your delegate instance in a variable which lives as long as BASS needs it, e.g. use a global variable or member.

See Also