Author Topic: Get bytes remaining in the buffer  (Read 396 times)


  • Posts: 33
Get bytes remaining in the buffer
« on: 18 May '19 - 09:12 »
I am implementing a custom STREAMPROC and updating position manually.

The problem I have is that STREAMPROC calls seem to be called earlier, so when I am getting the position of the streams it is off by a about 20 ms.
So is there a way to get the remaining bytes that are held in the buffer to add that difference to my GetPosition function to get the exact current position?

I also noticed that setting the stream position (inside the STREAMPROC) to
Code: [Select]
pos_current = position - length / 2.0Where length is the length of bytes returned from BASS_ChanneldGetData, the position would be accurate enough.
That length is 25 ms .
« Last Edit: 18 May '19 - 09:47 by Blink123123 »

Ian @ un4seen

  • Administrator
  • Posts: 22327
Re: Get bytes remaining in the buffer
« Reply #1 on: 20 May '19 - 12:53 »
You can get the amount of data (in bytes) that's in the stream's playback buffer from BASS_ChannelGetData with BASS_DATA_AVAILABLE. You can also use BASS_ChannelBytes2Seconds to translate that amount to seconds, if needed.