Author Topic: Multiple output devices.  (Read 218 times)

Radek

  • Guest
Multiple output devices.
« on: 1 Mar '18 - 11:43 »
Hello, is it possible to initialize bass for multiple sound card and play wave or mp3 to chosen output?

For example:
I want to play samples one and two on first sound card and sample three and four on the second sound card.

Radek

Ian @ un4seen

  • Administrator
  • Posts: 20845
Re: Multiple output devices.
« Reply #1 on: 1 Mar '18 - 14:09 »
Yes, that is possible. After initializing both devices (via BASS_Init), you would need to use BASS_SetDevice to set the thread's device context before creating a stream. For example, like this:

Code: [Select]
BASS_SetDevice(device1); // set context to 1st device
stream1 = BASS_StreamCreateFile(FALSE, file1, 0, 0, 0); // open 1st file
stream2 = BASS_StreamCreateFile(FALSE, file2, 0, 0, 0); // open 2nd file
BASS_SetDevice(device2); // set context to 2nd device
stream3 = BASS_StreamCreateFile(FALSE, file3, 0, 0, 0); // open 3rd file
stream4 = BASS_StreamCreateFile(FALSE, file4, 0, 0, 0); // open 4th file

Please see the BASS_SetDevice documentation for more info on that. If wanted, you can also use BASS_ChannelSetDevice to move a stream to another device afterwards.