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

nudrick

  • Posts: 8
Hello

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?


Thanks

Ian @ un4seen

  • Administrator
  • Posts: 21370
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:

   www.un4seen.com/forum/?topic=16636.msg116359#msg116359