BASS.NET API for the Un4seen BASS Audio Library

BassAsioHandler Constructor (Boolean, Int32, Int32, Int32, BASSASIOFormat, Double)

BASS.NET API for the Un4seen BASS Audio Library
Creates an instance of the ASIO handler - initializing and enabling the given ASIO device and channel.

Namespace:  Un4seen.BassAsio
Assembly:  Bass.Net (in Bass.Net.dll) Version: 2.4.17.5
Syntax

public BassAsioHandler(
	bool input,
	int asioDevice,
	int asioChannel,
	int asioNumChans,
	BASSASIOFormat asioFormat,
	double asioSamplerate
)

Parameters

input
Type: SystemBoolean
Dealing with an input channel? =an output channel, = an input channel (in which case the UseInput will automatically set to , so that you can use the InputChannel.).
asioDevice
Type: SystemInt32
The ASIO device to use (0=first).
asioChannel
Type: SystemInt32
The ASIO input/output channel number (0=first).
asioNumChans
Type: SystemInt32
The total number of ASIO channels to use (following channels will be joined - e.g. 2 for stereo).
asioFormat
Type: Un4seen.BassAsioBASSASIOFormat
The ASIO sample format to use for the channel(s) - see BASSASIOFormat for details.
asioSamplerate
Type: SystemDouble
The desired samplerate to use with the channel(s) - use BASS_ASIO_GetRate or -1 if uncertain and to prevent resampling. If the ASIO device samplerate could not be set to the desired samplerate, the device's current samplerate will be taken instead.
Remarks

Use this constructor for either manual Asio handler use or for Asio input recording.

The following will be done internally:

1. The ASIO device will be initialized (if already done, the ASIO device will just be set).

2. The ASIO device's samplerate will be set to the given asioSamplerate - if the ASIO device samplerate could not be changed the device's current samplerate will be taken!

3a. If input: use the AsioInputCallback(Boolean, Int32, IntPtr, Int32, IntPtr) as the internal ASIOPROC. Also UseInput will be set to , so that you can use the InputChannel to retrieve the recorded sample data.

3b. If output: use the AsioOutputCallback(Boolean, Int32, IntPtr, Int32, IntPtr) as the internal ASIOPROC.

4. If the ASIO device was already started, it will be stopped when necessary (only if the ASIO channel has not yet been enabled). The device will be started again.

5. Enable and join the given asioChannel with the following channels according to the total asioNumChans.

6. Set the ASIO channel format and samplerate according to the given asioSamplerate and asioFormat.

Note: If the given asioChannel has already been enabled, it will be reused and not enabled and joined again! This means, that the channel number of the already joined channel will not be changed as well and might not match to the channel number of the given asioNumChans parameter.

Examples

Automatic use of the BassAsioHandler (Asio recording input, Asio full-duplex output):
private BassAsioHandler _asio;
...
// not playing anything via BASS, so don't need an update thread
Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_UPDATEPERIOD, 0);
// setup BASS - "no sound" device but 48000 (default for ASIO)
Bass.BASS_Init(0, 48000, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero);
BassAsio.BASS_ASIO_Init(0, BASSASIOInit.BASS_ASIO_THREAD);
...
// assign ASIO input to the first device and channel (stereo, 32-bit float, 48kHz)
_asio = new BassAsioHandler(true, 0, 0, 2, BASSASIOFormat.BASS_ASIO_FORMAT_FLOAT, 48000);
// set the full-duplex option to the first ASIO output device and channel
// the ASIO output format will aways be the same as the input for full-duplex
_asio.SetFullDuplex(0, 0);
// start ASIO
_asio.Start(0);
...
// when you want to disbale all associated channels, call:
_asio.Dispose();
See Also

Reference