Show / Hide Table of Contents

Delegate AsioProcedure

User defined ASIO channel callback function (to be used with ChannelEnable(Boolean, Int32, AsioProcedure, IntPtr)).

Namespace: System.Dynamic.ExpandoObject
Assembly: ManagedBass.Asio.dll
Syntax
public delegate int AsioProcedure(bool Input, int Channel, IntPtr Buffer, int Length, IntPtr User);
Parameters
Boolean Input

Dealing with an Input channel? false = an output channel.

Int32 Channel

The Input/output channel number... 0 = first.

IntPtr Buffer

The pointer to the Buffer containing the recorded data (Input channel), or in which to put the data to output (output channel).

Int32 Length

The number of bytes to process.

IntPtr User

The User instance data given when ChannelEnable(Boolean, Int32, AsioProcedure, IntPtr) was called.

Returns
Int32

The number of bytes written (ignored with Input channels).

Remarks

ASIO is a low latency system, so a channel callback function should obviously be as quick as possible. CPUUsage can be used to monitor that.

When multiple channels are joined together, the sample data of the channels is interleaved; the channel that was enabled via ChannelEnable(Boolean, Int32, AsioProcedure, IntPtr) comes first, followed by the channels that have been joined to it. The order of the joined channels defaults to numerically ascending order unless the JoinOrder flag was used in the Init(Int32, AsioInitFlags) call, in which case they will be in the order in which ChannelJoin(Boolean, Int32, Int32) was called to join then.

When an output channel's function returns less data than requested, the remainder of the Buffer is filled with silence, and some processing is saved by that. When 0 is returned, the level of processing is the same as if the channel had been paused with ChannelPause(Boolean, Int32), ie. the ASIO Buffer is simply filled with silence and all additional processing (resampling/etc) is bypassed.

ASIO is a low latency system, so a channel callback function should obviously be as quick as possible. CPUUsage can be used to monitor that. Do not call the Stop() or Free() functions from within an ASIO callback. Also, if it is an output channel, ChannelSetFormat(Boolean, Int32, AsioSampleFormat) and ChannelSetRate(Boolean, Int32, Double) should not be used on the channel being processed by the callback.

Prior to calling this function, BassAsio will set the thread's device context to the device that the channel belongs to. So when using multiple devices, CurrentDevice can be used to determine which device the channel is on.

Back to top Copyright © 2017 Mathew Sachin
Generated by DocFx