Namespace: Un4seen.BassAsio
Assembly: Bass.Net (in Bass.Net.dll) Version: 2.4.17.5
public virtual int AsioOutputCallback( bool input, int channel, IntPtr buffer, int length, IntPtr user )
Parameters
- input
- Type: SystemBoolean
Dealing with an input channel? Must be , since we are dealing with Asio output. - channel
- Type: SystemInt32
The output channel number... 0 = first. - buffer
- Type: SystemIntPtr
The pointer to the buffer in which to put the data to output. - length
- Type: SystemInt32
The number of BYTES to process. - user
- Type: SystemIntPtr
Not used.
Return Value
Type: Int32The number of bytes written.
In order to use this default output ASIO callback (playback), you need to make sure that you use this callback only with ASIO 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 pause ASIO via BASS_ASIO_ChannelPause(Boolean, Int32) or Pause(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 ASIO 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 ASIO output.
If you intend to overload this callback in a derive implementation make sure to call the base method to not loose any functionatily.
public class MyAsioHandler : BassAsioHandler { public override int AsioOutputCallback(bool input, int channel, IntPtr buffer, int length, IntPtr user) { // buffer is not filled // do your own stuff here... int len = base.AsioOutputCallback(input, channel, buffer, length, user); if (len > 0) { // buffer is already filled // do your own stuff here... } return len; } }