Author Topic: Playing 2 consecutive files gapeless  (Read 295 times)

pwatel

  • Posts: 59
Playing 2 consecutive files gapeless
« on: 20 Aug '17 - 12:46 »
Hello
what is the better strategy to play buffered files with gapeless listening?
In 100% ram one could load 2 consecutive files in the playing list in 2 separate memory buffers and then glue the memory?  does it make sense of I am talking out of my bottom?  or there are better strategies
in normal buffered no idea, especially I want bit perfect output so going through a mixer is not an option, is not it?
Any help appreciated thanks
pw

Ian @ un4seen

  • Administrator
  • Posts: 20427
Re: Playing 2 consecutive files gapeless
« Reply #1 on: 21 Aug '17 - 17:01 »
You can use a mixer to play 2 files gaplessly, but they should ideally all have the same sample rate. So long as the mixer and file sample rates match (so no resampling is needed), it is still possible to have bit perfect output. Here are a couple of posts with some example code for gapless playback via a mixer:

   www.un4seen.com/forum/?topic=14514.msg101055#msg101055
   www.un4seen.com/forum/?topic=6159.msg41390#msg41390

pwatel

  • Posts: 59
Re: Playing 2 consecutive files gapeless
« Reply #2 on: 22 Aug '17 - 07:16 »
Thank you
Does this strategy would work in WASAPI also?

Ian @ un4seen

  • Administrator
  • Posts: 20427
Re: Playing 2 consecutive files gapeless
« Reply #3 on: 22 Aug '17 - 14:42 »
Yes, you can do the same when using WASAPI output. You just need to add the BASS_STREAM_DECODE flag to the BASS_Mixer_StreamCreate call then, which allows your WASAPIPROC function to get the "mix" from BASS_ChannelGetData.

pwatel

  • Posts: 59
Re: Playing 2 consecutive files gapeless
« Reply #4 on: 30 Aug '17 - 03:43 »
Is there any other way to this without the mixer, it is another object to use etc
I understand it makes sense to have the same file sampling etc
but it is just to glue 2 memory buffers

Ian @ un4seen

  • Administrator
  • Posts: 20427
Re: Playing 2 consecutive files gapeless
« Reply #5 on: 30 Aug '17 - 17:54 »
What format is the data in the memory buffers? Most file formats won't allow you just join them.

If you're using WASAPI output, then you could just start getting data from the 2nd file in your WASAPIPROC function immediately after the 1st file ends. Note that the WASAPI output must have the same sample format as the 2 files then. That isn't always possible (the device might not support the file's rate), so a mixer would usually be used with WASAPI output even if not mixing, to handle the conversion.