Page 1 of 1

SetSoundPosition() limitations?

Posted: Sat Jan 18, 2014 6:31 pm
by Lush
Hello,

I'm using PureBasic 5.21 LTS. I'm trying to set the play position of a song and I can't set it past 25 seconds or so.

When I use higher values, the position retrieved with GetSoundPosition() loops and start from 0 again.

I tried with various .wav and .ogg files but there's no difference.

Am I doing something wrong or is there something wrong with SetSoundPosition() ?

Code: Select all

SetSoundPosition(#song, 24000, #PB_Sound_Millisecond)
Debug GetSoundPosition(#song, #PB_Sound_Millisecond) ; -> 24000

SetSoundPosition(#song, 25000, #PB_Sound_Millisecond)
Debug GetSoundPosition(#song, #PB_Sound_Millisecond) ; -> 652

SetSoundPosition(#song, 26000, #PB_Sound_Millisecond)
Debug GetSoundPosition(#song, #PB_Sound_Millisecond) ; -> 1652
Thanks

Re: SetSoundPosition() limitations?

Posted: Sun Jan 19, 2014 12:16 am
by luis
A bug.

24347 was the max value and then started to wrap it back to 0.

Try 25000 and you get 25000 - 24347 = 653 (actual new position reported)

Try 30000 and you get 30000 - 24347 = 5653 (actual new position reported)

Using frames it works.

Tested on Win 7, PB521 x86

Re: SetSoundPosition() limitations?

Posted: Sun Jan 19, 2014 1:22 am
by Lush
Thanks for testing, luis :)

Using frames and changing my formula from "sec x 1000" to "sec x 44100" seems to do the trick.
(44100 being returned by GetSoundFrequency() )

Re: SetSoundPosition() limitations?

Posted: Sun Jan 19, 2014 1:25 am
by luis
Yep, exactly.
Probably you should open a bug report (if you are interested in see this fixed :wink: )

Re: SetSoundPosition() limitations?

Posted: Sun Jan 19, 2014 2:36 am
by Lush
Thanks luis, bug reported ;)