Un4seen.BassAsioBassAsioHandler
Namespace: Un4seen.BassAsio
Assembly: Bass.Net (in Bass.Net.dll) Version: 2.4.17.5
The BassAsioHandler type exposes the following members.
Name | Description | |
---|---|---|
BassAsioHandler |
Default constructor - leaving all defaults and not assigning any ASIO channel.
| |
BassAsioHandler(Int32, Int32, Int32, BASSASIOFormat) |
Creates an instance of the ASIO handler for output - initializing and enabling the given ASIO device and channel according to the Bass stream.
| |
BassAsioHandler(Boolean, Int32, Int32, Int32, BASSASIOFormat, Double) |
Creates an instance of the ASIO handler - initializing and enabling the given ASIO device and channel.
|
Name | Description | |
---|---|---|
BypassFullDuplex |
Gets or Sets the bypass flag for full-duplex ASIO output processing (default is ).
| |
Channel |
Returns the first ASIO channel being used.
| |
ChannelNumChans |
Gets the total number of ASIO channel which are joined together, starting with Channel.
| |
Device |
Returns the ASIO device being used by the Asio handler.
| |
DeviceVolume |
Gets or Sets the master volume of the Device between 0 (silent) and 1 (full).
| |
Format |
Gets or Sets the actual ASIO channel format (default is BASS_ASIO_FORMAT_FLOAT).
| |
FullDuplexChannel |
Returns the first full-duplex ASIO output channel being used (or -1, if not used).
| |
FullDuplexDevice |
Returns the full-duplex ASIO output device being used (or -1, if not used).
| |
InputChannel |
Returns an input channel which allows you to retrieve the recorded sample data and/or apply any DSP/FX on Asio input.
| |
InternalAsioProc |
Gets the ASIOPROC currently being used by the Asio handler.
| |
IsInput |
Returns , if the ASIO handler is used with an ASIO input device.
| |
IsInputFullDuplex |
Returns , if the ASIO handler is used with an ASIO input device and the full-duplex option was set via SetFullDuplex(Int32, Int32).
| |
IsMirrored |
Returns if the ASIO Channel is being mirrored to another output channel.
| |
IsResampling | ||
MirrorChannel |
Gets the first ASIO mirror channel (or -1 if not mirrored).
| |
OutputChannel |
Gets or Sets the BASS output channel handle which is used with this ASIO handler.
| |
Pan |
Gets or Sets the panning of the Channel (and all joined ChannelNumChans) between -1 (left) to +1 (right), 0=centered.
| |
PanMirror |
Gets or Sets the panning of the MirrorChannel (and all attached ChannelNumChans) between -1 (left) to +1 (right), 0=centered.
| |
SampleRate |
Gets or Sets the actual ASIO channel sample rate in Hz (default is 48000).
| |
UseInput |
Enables the use of the InputChannel channel with ASIO input (which is the default for Asio input).
| |
Volume |
Gets or Sets the volume of the Channel (and all joined ChannelNumChans) between 0 (silent) and 1 (full).
| |
VolumeMirror |
Gets or Sets the volume of the MirrorChannel (and all attached ChannelNumChans) between 0 (silent) and 1 (full).
|
Name | Description | |
---|---|---|
AsioInputCallback |
Provides a ready made ASIOPROC callback procedure which might be used for ASIO input.
| |
AsioOutputCallback |
Provides a ready made ASIOPROC callback procedure which might be used for ASIO output.
| |
AsioToAsioFullDuplexCallback |
Provides a ready made ASIOPROC callback procedure which might be used for full-duplex ASIO input to Asio output.
| |
AsioToBassFullDuplexCallback |
Provides a ready made ASIOPROC callback procedure which might be used for full-duplex ASIO input to Bass output.
| |
AssignOutputChannel |
Assigns a (new) BASS channel handle for ASIO output.
| |
Dispose |
Disposes an instance of this class also unjoining and disabling all used ASIO channels.
| |
Finalize |
Finalization code.
(Overrides ObjectFinalize.) | |
Pause |
Pauses or Unpauses the ASIO Channel(s) being used.
| |
PauseMirror |
Pauses or Unpauses the MirrorChannel(s) being used.
| |
RemoveFullDuplex |
Removes the full-duplex option from ASIO input.
| |
RemoveMirror |
Removes a mirror set on the current ASIO Channel.
| |
SetFullDuplex(Int32, Int32) |
Sets the full-duplex option for ASIO input using the given ASIO output device and channel.
| |
SetFullDuplex(Int32, BASSFlag, Boolean) |
Sets the full-duplex option for ASIO input using the given BASS output device.
| |
SetMirror |
Mirrors the current ASIO Channel to the given output channel.
| |
Start |
Starts the Asio Device.
| |
StartFullDuplex |
Starts the Asio FullDuplexDevice.
| |
Stop |
Stops the Asio Device.
| |
StopFullDuplex |
Stops the Asio FullDuplexDevice.
|
Name | Description | |
---|---|---|
Notification |
Event handler used to notify that an asio handler notification event (sync) has occurred.
|
Name | Description | |
---|---|---|
UseDedicatedThreads |
Gets or Sets, if the driver should be hosted in a dedicated thread.
|
Scenario: | How-To: |
---|---|
Asio output | A Bass decoding channel or a recording channel feeding Asio output.
Simply use the corresponding output constructor to specify the Asio Device and Channel as well the OutputChannel to use and you are done. The SampleRate, ChannelNumChans and Format will automatically be aligned. Use the AssignOutputChannel(Int32) method to change the underlying bass channel on the fly. |
Asio input | Directly record from Asio input.
Simply use the corresponding input constructor to specify the Asio Device, Channel, SampleRate, ChannelNumChans and Format you want to record at. To retrieve the input sample data use the InputChannel channel (e.g. setup an own DSP, use it with the WaveWriter or Encoder Framework). |
Asio input, full-duplex to Asio | Monitor your Asio input on any Asio output.
To enable full-duplex just call the Asio overload of the SetFullDuplex(Int32, Int32) method (when done call RemoveFullDuplex(Boolean)). |
Asio input, full-duplex to BASS | Monitor your Asio input on any BASS device.
To enable full-duplex just call the bass overload of the SetFullDuplex(Int32, Int32) method (when done call RemoveFullDuplex(Boolean)). |
DSP/FX | You can set any DSP/FX on either the input and/or the output (full-duplex).
See InputChannel and OutputChannel for more details. |
You might use the Volume and Pan properties to easily control your Asio input/output settings. Asio mirrors are also supported via the SetMirror(Int32) and RemoveMirror methods. Mirrors have independent VolumeMirror and PanMirror settings.
Asio channels can be paused and resumed at any time by using the Pause(Boolean) method. To physically start the used Asio device the Start(Int32, Int32) method might be used. Stop will unjoin, disable and stop the Asio device (if really needed).
Caution: Once you created an instance of this class, the respective ASIO channels are joined and enabled. The used ASIO channels will NOT be unjoined or disabled automatically when an instance of this class is being disposed by the .Net Garbage Collector! Call the Dispose method manually to completely free all assigned ASIO channels, including any full-duplex and the mirror options. However, calling Dispose will not stop the Asio device - this has to be done manually in any case (e.g. by calling Stop)!
Note: This class internally uses Un4seen.Bass, so you need to provide the native BASS.dll as well when using this class.
The AsioOutputCallback(Boolean, Int32, IntPtr, Int32, IntPtr), AsioInputCallback(Boolean, Int32, IntPtr, Int32, IntPtr), AsioToAsioFullDuplexCallback(Boolean, Int32, IntPtr, Int32, IntPtr) and AsioToBassFullDuplexCallback(Boolean, Int32, IntPtr, Int32, IntPtr) callbacks are virtual methods which might be overloaded if you want to derive your own ASIO handler with any special callback handling.
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); ... int stream = Bass.BASS_StreamCreateFile(fileName, 0, 0, BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_SAMPLE_FLOAT); if (stream != 0) { // assign ASIO output to the first device and channel // and assume the ASIO format, samplerate and number of channels from the BASS stream _asio = new BassAsioHandler(0, 0, stream); // start ASIO _asio.Start(0); }
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();