Author Topic: Bass 2.4.13: BASS_ChannelSlideAttribute/BASS_ATTRIB_VOL - Division by Zero  (Read 174 times)

xandy

  • Posts: 17
The new version doesn't like a "time"-parameter of 0 for BASS_ChannelSlideAttribute anymore, at least with BASS_ATTRIB_VOL it seems.

Use case: Playlist playback with full resume. A global var "slidedur" can be set from the interface to get an extended fade-in on resume, extended fade-in is off when slidedur is set to 0; default value for slidedur is 0 for start of a new file too. For some time (and some 2.4.x versions back) a procedure, which does some house-keeping on the stream and calls BASS_ChannelSlideAttribute with slidedur as time-param, did work. Bass 2.4.13 quits 0-cases with a "division by zero" exception.

Now, it's no big deal to use BASS_ChannelSetAttribute (when slidedur=0) instead. But the behavior has changed, and other people's code may be affected.

Ian @ un4seen

  • Administrator
  • Posts: 20489
Oops. There is indeed a divide by 0 in BASS_ChannelSlideAttribute when time=0. It's a floating-point divide by 0, and the result isn't actually used when time=0, so it won't cause any problem when floating-point exceptions are disabled. They are disabled by default in C/C++, but for languages that don't disable them, here's an update that should fix the problem:

   www.un4seen.com/stuff/bass.zip

Let me know if you still see the problem happening.

xandy

  • Posts: 17
all is well - thank you

Ian @ un4seen

  • Administrator
  • Posts: 20489
Great. For anyone else that has encountered this problem, the update (2.4.13.2) is up on the BASS page now.