Author Topic: How Can I merge Streams  (Read 5760 times)


  • Posts: 9
How Can I merge Streams
« on: 7 Aug '03 - 17:09 »
Hi everybody!
I have a question to the world.

1.I need a way to merge two streams into one so i can apply an effect to both the streams without apply it twice.
How can I do this?
can someone help me?
(possibly in Delphi, but it's good in every language)

2.How can I merge all the sample channels into a stream?

Thanx Everybody.
Alexander... 8)


  • Posts: 28
Re: How Can I merge Streams
« Reply #1 on: 8 Aug '03 - 13:27 »
You need to write your own custom stream, and gather the data from decoding (BASS_STREAM_DECODE) channels. In the STREAMPROC call back, you will need something along these lines;

--use the supplied buffer in a BASS_ChannelGetData call (to stream1 with flag BASS_STREAM_DECODE set).

--create a second (temp) buffer.

--use this buffer in a BASS_ChannelGetData call (to stream2 with flag BASS_STREAM_DECODE set).

--add each sample in the temp buffer to the corresponding sample in the supplied buffer.

sounds easy, but in practice you will need to add checking to ensure that neither stream that you are mixing has run out of data etc...

Remember that you will need ensure you are not just adding the BYTES of the streams, as the sample values can be 1,2 or 4 bytes long. You might also have problems with differing sample rates.

I am currently writing a custom streamproc (which does this, among other things...). It can be tricky...

good luck.