Author Topic: BASSMIX can't change device while playing realtime  (Read 444 times)

noelquipit

  • Posts: 15
Hi, im doing a simple bassmix player. I already tried the bass library on changing audio out real time. and it's works fine.
Mow back on bassmix, i also tried to do the same on changing output while playing real time but it wont work. despite of no error.

Can anyone here help me if there's a way on changing the output device while playing? it seem the init can only one set the device nut only on starting the system. i want the real-time changes.

Chris

  • Posts: 1864
Re: BASSMIX can't change device while playing realtime
« Reply #1 on: 1 Aug '19 - 14:20 »
Hi, you can do it via Bass_SetDevice
but of cource the device must be init via Bass_Init


Ian @ un4seen

  • Administrator
  • Posts: 22253
Re: BASSMIX can't change device while playing realtime
« Reply #2 on: 1 Aug '19 - 15:54 »
I guess you were previously using file stream handles in BASS_ChannelSetDevice calls to change output device. When using a mixer, you would need to use the mixer's handle instead, as that is the stream that is being played by BASS, ie. what you're calling BASS_ChannelPlay on.

noelquipit

  • Posts: 15
Re: BASSMIX can't change device while playing realtime
« Reply #3 on: 2 Aug '19 - 01:28 »
Hi Sir Ian, Im very new on this. I've look everywhere based on your suggestion but i got no luck. can you give me example code on it? everything you said above is right, because i was copying the code from BAS library.

Ian @ un4seen

  • Administrator
  • Posts: 22253
Re: BASSMIX can't change device while playing realtime
« Reply #4 on: 2 Aug '19 - 13:32 »
To move the playback to a different device, you would call BASS_ChannelSetDevice with the mixer's handle. Before doing that, you will need to initialize the new device via BASS_Init. Something like this:

Code: [Select]
BASS_Init(newdevice, 44100, 0, 0, NULL); // initialize new device
BASS_ChannelSetDevice(mixer, newdevice); // move the mixer to the new device

You can optionally free the old device afterwards:

Code: [Select]
BASS_SetDevice(olddevice); // set device context to old device
BASS_Free(); // free the old device

If you do that then you will need to make sure the mixer's sources aren't left on the old device, otherwise they will be freed by BASS_Free too. You could detach them from any device like this:

Code: [Select]
BASS_ChannelSetDevice(decoder, BASS_NODEVICE); // detach a decoder from any device

Please see the documentation for details on the mentioned functions.

noelquipit

  • Posts: 15
Re: BASSMIX can't change device while playing realtime
« Reply #5 on: 3 Aug '19 - 01:42 »
Oh my God!!! it's really work!!!! Now i will definitely buy the license of this library!!!

Thanks Sir Ian!!! Is there any voting here? for i will definitely vote for you.

Ian @ un4seen

  • Administrator
  • Posts: 22253
Re: BASSMIX can't change device while playing realtime
« Reply #6 on: 5 Aug '19 - 14:10 »
Good to hear that you've got it working. No voting here but thanks anyway :)