I create 2 streams from 2 different audio files of same freq, channels and bitrate.
stream1=Bass.BASS_StreamCreateFile(file1, 0, 0, BASSFlag.BASS_STREAM_DECODE)
stream2=Bass.BASS_StreamCreateFile(file2, 0, 0, BASSFlag.BASS_STREAM_DECODE)
mixer=BassMix.BASS_Mixer_StreamCreate(FileInfo.freq, FileInfo.chans, BASSFlag.BASS_STREAM_DECODE)
BassMix.BASS_Mixer_StreamAddChannel(mixer, stream1, BASSFlag.BASS_MIXER_BUFFER)
BassMix.BASS_Mixer_StreamAddChannel(mixer, stream2, BASSFlag.BASS_MIXER_BUFFER)
Then I create a mixer and add the stream channels in the mixer. Then I set an encoder on the mixer as I need the mixed audio in another file.
encHandle=BassEnc.BASS_Encode_Start(mixer, fileName, BASSEncode.BASS_ENCODE_PCM Or BASSEncode.BASS_ENCODE_FP_16BIT, Nothing, 0)
Then I use the following to get the mixed data.
While len > 0
len= BassMix.BASS_Mixer_ChannelGetData(stream1, buffer, buffer.Length)
len= BassMix.BASS_Mixer_ChannelGetData(stream2, buffer, buffer.Length)
End While
BassEnc.BASS_Encode_Stop(encHandle)
I do not know if I'm doing right or wrong. But I'm only getting a 0Kb audio file as an output. Please help me.