Author Topic: Play out to M-Audio Multi Channel Sound Card  (Read 5371 times)

janakaprasadab

  • Posts: 41
Hi,

I'm using M-Audio ProFire 2626 Sound Cards, I'm trying to Play-out Multiple Files to Multiple Output channels on the card simultaneously. I tried to use ASIO since Multi speakers are not supported.. Bass Asio sample shows multiple Output channels.. I used bellow code to play out.

Play Button 1 Click
-----------------------------------
 _stream1 = Bass.BASS_StreamCreateFile(_fileName1, 0, 0, BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_SAMPLE_FLOAT);
 if (_stream1 != 0)
 {
      _asioOut1 = new BassAsioHandler(comboBoxAsioOutputDevice1.SelectedIndex, comboBoxAsioOutputChannel1.SelectedIndex * 2, _stream1);
      _asioOut1.Start(0,0 );
}
--------------------------------

Play Button 2 Click
-----------------------------------
 _stream2 = Bass.BASS_StreamCreateFile(_fileName1, 0, 0, BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_SAMPLE_FLOAT);
 if (_stream2 != 0)
 {
      _asioOut2 = new BassAsioHandler(comboBoxAsioOutputDevice2.SelectedIndex, comboBoxAsioOutputChannel2.SelectedIndex * 2, _stream2);
      _asioOut2.Start(0,0 );
}
--------------------------------


1. _asioOut1.Start(0,0 ); - This call auto starts the Channel 1 Playing
2. _asioOut2.Start(0,0 ); - This call auto starts the channel 2 Playing, but it pause the first channel little bit and Resume again + Second channel also starts playing, why is that?
3. if I call _asioOut1.Stop(); -- it Stops Both Channel so I called Bass.BASS_ChannelStop(_stream1);, It stops the Channel 1 only.. is this the correct method to stop the channel 1?

4. is there any sample shows how to play on Multiple channels of an ASIO device simultaneously without disturbing other channels (Ex : Play, Pause, Stop, Load Another File, etc)

Thanks       

Ian @ un4seen

  • Administrator
  • Posts: 20400
Re: Play out to M-Audio Multi Channel Sound Card
« Reply #1 on: 6 Sep '13 - 14:18 »
An ASIO device/driver needs to be stopped when changing its channel setup, eg. when enabling/disabling channels. So, to avoid having to briefly stop the device when you want to stop/start channels, all of the channels that you may want to use should be enabled prior to starting the device. Inactive channels can be paused via BASS_ASIO_ChannelPause. A demonstration of doing this can be found in the SPEAKERS example included in the BASSASIO package.

janakaprasadab

  • Posts: 41
Re: Play out to M-Audio Multi Channel Sound Card
« Reply #2 on: 7 Sep '13 - 02:48 »
Hi Ian,

Thanks for your prompt response..

I can keep Enable all the Required channels..

1. Can I enable ASIO channel without Valid Bass Audio Channel / File Name
2. Once Channel Enabled, Can I change the Playing File Dynamically.. (Unload Previous File and Load New File)..

I'm working in c#, I couldn't Find any ASIO Speaker sample in c#

Thanks

Ian @ un4seen

  • Administrator
  • Posts: 20400
Re: Play out to M-Audio Multi Channel Sound Card
« Reply #3 on: 9 Sep '13 - 14:01 »
Yes, you can enable ASIO channels without having anything to play on them, and you can change what's played on the ASIO channels. In plain BASSASIO terms, that would involve pausing inactive ASIO channels via BASS_ASIO_ChannelPause, and changing the handle that an ASIOPROC callback function uses in its BASS_ChannelGetData calls. I'm afraid I'm not very familiar with the BassAsioHandler class, but I think you would use the "Pause" and "AssignOutputChannel" methods in that case.

The SPEAKERS example that I referred to can be found in the main BASSASIO package (C/SPEAKERS folder). Although it isn't C#, the BASS/BASSASIO calls are basically the same in all languages, so it may still be helpful to have a look at that.

radio42

  • Posts: 4574
Re: Play out to M-Audio Multi Channel Sound Card
« Reply #4 on: 12 Sep '13 - 09:27 »
Correct, the "AssignOutputChannel" of the "BassAsioHandler" class can be used to assigns a (new) BASS channel handle for ASIO output.

As stated in the documentation the following will be done internally:
1. The current ASIO channel will be paused (if already enabled).
2. The samplerate, format and number of channels will be determined from the given 'outputChannel' parameter.
3. The ASIO device will be set to the determined samplerate.
    If this fails, the current ASIO samplerate will not be changed.
4a. ASIO "Channel" enabled: use the "AsioOutputCallback" as the internal ASIOPROC, if the ASIO "Channel" was already enabled and joined, it will not be changed.
4b. ASIO "Channel" disabled: Enable and join the given Asio "Channel" with the following channels according to the total number of chans of the 'outputChannel'
5. Set the ASIO "Channel" format and samplerate according to the given samplerate and format of the 'outputChannel'
6. The current ASIO channel will be unpaused (if it was paused before).
This method can not be used with ASIO input (see "IsInput"). It will immediately return with no effect.