Starts the current Asio device.
Namespace: Un4seen.BassAsio
Assembly: Bass.Net (in Bass.Net.dll) Version: 2.4.17.5
Syntax
Parameters
- buflen
- Type: SystemInt32
Buffer length in samples... 0 = use current length (use -1 to request the preferred buffer length).
Return Value
Type: BooleanIf successful, then is returned, else is returned. Use BASS_ASIO_ErrorGetCode to get the error code.
Remarks
The default number of processing threads is 1, which means that the enabled channels' ASIOPROC functions get called in series (starting with the lowest input channel). Multiple channels can be processed in parallel if multiple threads are created for that purpose via the threads parameter. All input channels will be processed before any output channels are, so that full duplex is unaffected. The number of threads is automatically capped at the number required to process all enabled channels simultaneously.
ERROR CODE | Description |
---|---|
BASS_ERROR_INIT | BASS_ASIO_Init(Int32, BASSASIOInit) has not been successfully called. |
BASS_ERROR_ALREADY | The device has already been started. |
BASS_ERROR_NOCHAN | No channels have been enabled. |
BASS_ERROR_UNKNOWN | Some other mystery problem! |
Examples
using Un4seen.Bass; using Un4seen.BassAsio; ... Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero); BassAsio.BASS_ASIO_Init(0, BASSASIOInit.BASS_ASIO_THREAD); ... int stream = Bass.BASS_StreamCreateFile("test.mp3", 0, 0, BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_SAMPLE_FLOAT); if (stream != 0) { // now setup ASIO _myAsioProc = new ASIOPROC(AsioCallback); // enable 1st output channel...(0=first) BassAsio.BASS_ASIO_ChannelEnable(false, 0, _myAsioProc, new IntPtr(stream)); // and join the next channels to it BassAsio.BASS_ASIO_ChannelJoin(false, 1, 0); // and start playing it...start output using default buffer/latency BassAsio.BASS_ASIO_Start(0); } ... private ASIOPROC _myAsioProc; // make it global, so that it can not be removed by the Garbage Collector private int AsioCallback(bool input, int channel, IntPtr buffer, int length, IntPtr user) { // Note: 'user' contains the underlying stream channel (see above) // We can simply use the bass method to get some data from a decoding channel // and store it to the asio buffer in the same moment... return Bass.BASS_ChannelGetData(user.ToInt32(), buffer, length); }
See Also