Author Topic: BASS_CONFIG_BUFFER  (Read 500 times)

jakob

  • Posts: 105
BASS_CONFIG_BUFFER
« on: 15 Jan '15 - 13:30 »
hi All

we are using BASS_ChannelSetDSP to register a callback that updates the playback position in our GUI.

we are also using BASS_CONFIG_BUFFER with different values because our program is sometimes runing in a Citrix or wts  environment and a buffer thats too small, will give poor sound quality. This is all fine and working.
The problem we are having is that, it looks like for the last buffer that is played back, the callback is not called. The result is that the GUI playback position marker will stop before it resches the end. increasing BASS_CONFIG_BUFFER will increase the problem by making the payback position stop even further from the end.
Do you have a solution for this.

Ian @ un4seen

  • Administrator
  • Posts: 20433
Re: BASS_CONFIG_BUFFER
« Reply #1 on: 15 Jan '15 - 17:47 »
DSP functions are called straight after data is decoded, which may be some time ahead of playback due to buffering. So calling BASS_ChannelGetPosition in a DSPPROC will give a position that is behind the position of the data that the DSPPROC is receiving, unless the BASS_POS_DECODE flag is used (in which case it will actually give the position at the end of the received data). That will explain (assuming you aren't using the BASS_POS_DECODE flag) why your final position reading isn't at the end.

It actually isn't a good idea to use BASS_ChannelSetDSP for GUI update purposes, as doing that can result in a deadlock (depending on what the main thread is doing). It may also delay the buffer update cycles, perhaps resulting in stuttering if the buffer is short. I would recommend using a timer to update the GUI instead.

jakob

  • Posts: 105
Re: BASS_CONFIG_BUFFER
« Reply #2 on: 16 Jan '15 - 08:18 »
okay, thanks for the fast reply :D