Author Topic: Add 2 mp3 files to a mixer but play them one after another  (Read 316 times)


  • Posts: 8

I have created a mixer in this way:

Code: [Select]
int mixerStream = BassMix.BASS_Mixer_StreamCreate(44100, 2, BASSFlag.BASS_SAMPLE_FLOAT);
And then I add 2 mp3 files in this way:

Code: [Select]
string[] files = new string[2];
 files[0] = folder + "1.mp3";
 files[1] = folder + "2.mp3";
 int[] decoder = new int[2];

 for (int i = 0; i < files.Length; i++)
       decoder[i] = Bass.BASS_StreamCreateFile(files[i], 0, 0, BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_SAMPLE_FLOAT);
       BassMix.BASS_Mixer_StreamAddChannel(mixerStream, decoder[i], BASSFlag.BASS_STREAM_AUTOFREE | BASSFlag.BASS_MIXER_DOWNMIX);
 Bass.BASS_ChannelSetAttribute(mixerStream, BASSAttribute.BASS_ATTRIB_VOL, 0);

Then I make the broadcast to IceCast and it works perfectly but the main thing is that I want those audio files to be played one after another.

How can I do this? Is that possible?


Ian @ un4seen

  • Administrator
  • Posts: 21600
If you plug one source at a time into the mixer, you can use a "mixtime" BASS_SYNC_END sync to be notified when the mixer reaches the end of the current one, at which point you can plug in the next one and resume the mixer. Here is some example code for that: