Author Topic: [Solved] Track position goes further than GetLength value  (Read 264 times)

frostsake

  • Posts: 24
Hello,

I have a problem with one track and the latest version of BASS.
The problematic track can be downloaded here: http://www.filedropper.com/samsmith-moneyonmymind

I unfortunately can't post the code (it's written in Go, and uses a personal BASS wrapper), but here's exactly what I do so that you can reproduce:
  • I initialize BASS using the "No Sound" device
  • I load the file with BASS_StreamCreateFile, using the BASS_STREAM_DECODE and BASS_STREAM_PRESCAN flags (offset & length = 0)
  • I then call BASS_GetChannelLength and convert the result to seconds with BASS_ChannelBytes2Seconds

Now, in a loop:
  • I get the track position using BASS_ChannelGetPosition and convert the result to seconds with BASS_ChannelBytes2Seconds
  • Finally I read the level of the track with BASS_ChannelGetLevelEx (length = 0.10s) and store the level with its corresponding position in an array. If there's a BASS_ERROR_ENDED error, I break the loop

The problem is the latest "level" value stored is at 190.90 seconds of the track, and the GetLength call gives 189.996032 seconds (which is ~900ms shorter).
As you can see, BASS is able to decode further than the returned length of the track, which is quite surprising.

Is there something I am missing? Are you able to reproduce?
Thanks for you help.
« Last Edit: 13 Oct '17 - 15:15 by frostsake »

Ian @ un4seen

  • Administrator
  • Posts: 20433
Re: Track position goes further than GetLength value
« Reply #1 on: 9 Oct '17 - 16:52 »
The problem is caused by a bad iTunes gap info tag. Here's an update that will ignore the tag in this case (and any others like it):

   www.un4seen.com/stuff/bass.zip

Let me know if you still have any trouble with it.

frostsake

  • Posts: 24
Re: Track position goes further than GetLength value
« Reply #2 on: 10 Oct '17 - 14:51 »
Thanks for your help Ian, I really appreciate! Unfortunately I use a Mac or Linux laptop ;D
Maybe you have a .dylib or .so version available?

Ian @ un4seen

  • Administrator
  • Posts: 20433
Re: Track position goes further than GetLength value
« Reply #3 on: 10 Oct '17 - 17:56 »
Here are OSX and Linux versions of the update:

   www.un4seen.com/stuff/libbass.dylib
   www.un4seen.com/stuff/bass-linux.zip

frostsake

  • Posts: 24
Re: Track position goes further than GetLength value
« Reply #4 on: 13 Oct '17 - 15:15 »
Thanks you very much, works perfectly (at least on Linux)  :)