Author Topic: Play multiple streams on multiple devices  (Read 335 times)

kafffee

  • Posts: 9
Play multiple streams on multiple devices
« on: 20 Jul '21 - 13:29 »
Hey there,

I am wondering that if you have two streams, you can play them on different devices, one device for each.

I am looking forward to your answers  ;)

Chris

  • Posts: 1967
Re: Play multiple streams on multiple devices
« Reply #1 on: 20 Jul '21 - 15:24 »
Yes,  with BASS_SetDevice
Example

Code: [Select]
Bass_SetDevice(1);
Stream1  := Bass_StreamCreateFile......

Bass_SetDevice(2);
Stream2  := Bass_StreamCreateFile......

Be shure that you have before Init both Devices via Bass_Init....

kafffee

  • Posts: 9
Re: Play multiple streams on multiple devices
« Reply #2 on: 21 Jul '21 - 09:01 »
This won't work. It keeps playing one and the same device for both streams...   :(

Chris

  • Posts: 1967
Re: Play multiple streams on multiple devices
« Reply #3 on: 21 Jul '21 - 09:08 »

Quote
BASS will check the current thread's device setting, and if no device is selected (or the selected device is not initialized),
BASS will automatically select the lowest device that is initialized
so looks like you have not Init BOTH Devices



kafffee

  • Posts: 9
Re: Play multiple streams on multiple devices
« Reply #4 on: 21 Jul '21 - 09:24 »
OK now I got it running. Two streams playing on two devices. I did this even without _SetDevice just by initializing two times with Bass_Init by changing the first parameter.

But how to switch devices for each channel while playing?

Edit:
Okay, I bet you meant  Bass.BASS_ChannelSetDevice(streamA, 1) instead of just _SetDevice(1). That would make sense.

But it still doesnt work. When I use _ChannelSetDevice nothing happens.

I want to play both streams on the speakers by default, and on a mouse click switch one stream to headphones and back...
« Last Edit: 21 Jul '21 - 09:58 by kafffee »

Chris

  • Posts: 1967
Re: Play multiple streams on multiple devices
« Reply #5 on: 21 Jul '21 - 11:52 »
So if I right understand you have 1 Soundcard (Speakers) and the 2 Soundcard (Headphones) or both on One Device ?


kafffee

  • Posts: 9
Re: Play multiple streams on multiple devices
« Reply #6 on: 21 Jul '21 - 12:56 »
I got one soundcard for the speakers and another one for the headphones.

Ian @ un4seen

  • Administrator
  • Posts: 23890
Re: Play multiple streams on multiple devices
« Reply #7 on: 21 Jul '21 - 15:09 »
Okay, I bet you meant  Bass.BASS_ChannelSetDevice(streamA, 1) instead of just _SetDevice(1). That would make sense.

But it still doesnt work. When I use _ChannelSetDevice nothing happens.

What is the error code from the BASS_ChannelSetDevice call? Use BASS_ErrorGetCode to check that. If it's BASS_ERROR_INIT, make sure you have successfully initialized both devices via BASS_Init.

kafffee

  • Posts: 9
Re: Play multiple streams on multiple devices
« Reply #8 on: 21 Jul '21 - 16:28 »
It was indeed Error Code 8 (BASS_ERROR_INIT).

But I got it running now, initialized both devices, and then switched via _ChannelSetDevice.

Thank you so much, if I have any further questions I will let  you know. :) :)