SetSoundPosition() limitations?

Just starting out? Need help? Post your questions and find answers here.
Lush
User
User
Posts: 20
Joined: Sat Feb 12, 2011 5:58 pm
Location: France

SetSoundPosition() limitations?

Post 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
User avatar
luis
Addict
Addict
Posts: 3895
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: SetSoundPosition() limitations?

Post 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
"Have you tried turning it off and on again ?"
Lush
User
User
Posts: 20
Joined: Sat Feb 12, 2011 5:58 pm
Location: France

Re: SetSoundPosition() limitations?

Post 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() )
User avatar
luis
Addict
Addict
Posts: 3895
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: SetSoundPosition() limitations?

Post by luis »

Yep, exactly.
Probably you should open a bug report (if you are interested in see this fixed :wink: )
"Have you tried turning it off and on again ?"
Lush
User
User
Posts: 20
Joined: Sat Feb 12, 2011 5:58 pm
Location: France

Re: SetSoundPosition() limitations?

Post by Lush »

Thanks luis, bug reported ;)
Post Reply