Author Topic: What does BASS_StreamGetFilePosition actually return?  (Read 145 times)

Chris Oakley

  • Posts: 96
This should be a quick one, and apologies if I've missed this in the documentation, but I'm not clear on what the BASS_StreamGetFilePosition function actually returns as its value. I can see it's a number, and it's clearly not time based, but it doesn't appear to be bytes either.

I've tried converting it but end up with odd numbers that don't tally up with anything.

For example:

Code: [Select]
pos = Bass.BASS_StreamGetFilePosition(Channel, BASSStreamFilePosition.BASS_FILEPOS_DOWNLOAD)

This returns 10055053 when the audio is fully downloaded. The audio length is 4:11 - so I can't see how that large number would relate to that.

If it was in bytes then when I do a:

Code: [Select]
Bass.BASS_ChannelBytes2Seconds(Channel, pos)

I get the value 57.0014342403628 when it's fully loaded, and again, I can't see how that relates to the audio of the length 4:11.

The reason I'm trying to find this out is because I want to be able to jump to a specific position in a song based on the seconds, so 60 seconds into the audio, for example - but I want to do that as soon as I can, and not have to wait for the full file to be pulled in. So if I can determine when 60 seconds has been downloaded, I can then jump to it and start playing while the rest of the audio downloads - does this make sense?

Ian @ un4seen

  • Administrator
  • Posts: 21329
BASS_StreamGetFilePosition deals with the file data rather than the decoded data. In the case of the BASS_FILEPOS_DOWNLOAD option, it tells how many bytes have been downloaded. It generally isn't possible to accurately translate that number to seconds.

Chris Oakley

  • Posts: 96
Ahh that's a shame. No worries. I figured out a way around it. I just keep trying to set the channel position and when it comes back True I know it's downloaded to that point.