Any VB sample code to mix a few channels? For example I want to mix 3 Mp3 tracks and finally output the mixed one to a WAV. Any help will be appreciated.
If you take the writewav example as a starting point, you would change the "btnLoadFile_Click" stuff to something like this...
chan = BASS_Mixer_StreamCreate(44100, 2, BASS_STREAM_DECODE) ' 44100hz stereo 16-bit mixer
source1 = BASS_StreamCreateFile(BASSFALSE, FileName1, 0, 0, BASS_SAMPLE_FLOAT or BASS_STREAM_DECODE)
BASS_Mixer_StreamAddChannel(chan, source1, 0) ' plug source1 into mixer
source2 = BASS_StreamCreateFile(BASSFALSE, FileName2, 0, 0, BASS_SAMPLE_FLOAT or BASS_STREAM_DECODE)
BASS_Mixer_StreamAddChannel(chan, source2, 0) ' plug source2 into mixer
source3 = BASS_StreamCreateFile(BASSFALSE, FileName3, 0, 0, BASS_SAMPLE_FLOAT or BASS_STREAM_DECODE)
BASS_Mixer_StreamAddChannel(chan, source3, 0) ' plug source3 into mixer
BASS_MIXER_DOWNMIX definition missing in BASSmix.pas
That's strange. I can see it in there
BASS_MIXER_DOWNMIX = $400000; // downmix to stereo (or mono if mixer is mono)
It seems that small amount of data stays in buffer when remove source channel. If remove last source and add new source, part of previous source will be heard
I guess that's when playing the mixer output? It's because of the playback buffer - there'll be some data from the old channel still in the buffer. You shouldn't hear an overlap though, as the new channel will be equally delayed.
Reducing the buffer length (BASS_CONFIG_BUFFER) will improve things (reduce the latency).
Is it possible to add pause/play functions for mixer source? Channel functions don't work because mixer source is decoding channel
Removing/adding (BASS_Mixer_ChannelRemove/BASS_Mixer_StreamAddChannel) the source channels should have the same effect as pausing/resuming. When the source is re-added, it'll be at the position it was when it was removed.