Author Topic: Synchronized Playback of two streams  (Read 1795 times)

RonS

  • Posts: 11
Synchronized Playback of two streams
« on: 1 Dec '09 - 19:11 »
Hi everyone!

I have "found" something that doesn't seem to be well documented in the help-files or maybe not documented at all.

When using ASIO drivers with a mixer, I can do the following (in VB.NET):

Bass.BASS_ChannelStop(mixer_handle) '<-- not documented?
Bass.BASS_ChannelSetPosition(stream1_handle, 0)
Bass.BASS_ChannelSetPosition(stream2_handle, 0)
Bass.BASS_ChannelSetPosition(mixer_handle, 0) '<-- not documented?

After that, both streams will play in perfect sync together, which is something a few people on this forum have asked for, but as far as I can see, was never fully answered.

Am I right?

radio42

  • Posts: 4716
Re: Synchronized Playback of two streams
« Reply #1 on: 1 Dec '09 - 21:39 »
Well, in the BASS_Mixer_StreamCreate the following is documented:
"...The playback buffer can be flushed by calling "Bass.BASS_ChannelPlay (restart = "true" or "Bass.BASS_ChannelSetPosition" (pos = 0)..."

For BASS_ChannelStop the following is documented:
"...When used with a "decoding channel" (BASS_STREAM_DECODE or BASS_MUSIC_DECODE was used at creation), this function will end the channel at its current position, so that it's not possible to decode any more data from it. Any BASS_SYNC_END syncs that have been set on the channel will not be triggered by this; they are only triggered when reaching the natural end. BASS_ChannelSetPosition can be used to reset the channel and start decoding again..."

So I guess both applies to your case.
Stopping a decoding mixer channel (as you are using ASIO) will end the mixer ast this point.
And a later BASS_ChannelSetPosition resumes it plus flushes the mixer buffer.

So I guess all is documented at this point.
In your case I even assume, that you wouldn't have to call BASS_ChannelStop at all to get the sources in sync....

RonS

  • Posts: 11
Re: Synchronized Playback of two streams
« Reply #2 on: 1 Dec '09 - 22:11 »
Okay, I see .... thanks Bernd, and greets from Berlin  :)