Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: sf::Music - GetDuration() and GetPlayingOffset()  (Read 3813 times)

0 Members and 1 Guest are viewing this topic.

pdinklag

  • Sr. Member
  • ****
  • Posts: 330
  • JSFML Developer
    • View Profile
    • JSFML Website
sf::Music - GetDuration() and GetPlayingOffset()
« on: August 15, 2011, 12:25:56 pm »
I'm confused by the return values of these two functions. GetDuration() does not return the actual stream's duration, and GetPlayingOffset() seems to "rotate" in some weird way.

I'm dealing with an ogg vorbis file that streams for 1:15 minutes, so I'm expecting a duration of roughly 75000ms, however, GetDuration() returns 26744ms for me. GetPlayingOffset() seems to return the true offset for a while. However, it goes beyond the duration that gets returned, and when it reaches ~50000ms, it gets reset back to zero and starts counting up again.

During all of the time, the music plays just well, it's just the duration and the playing offset methods that yield weird values.

I'm using an SFML 2.0 C++ build as of late July. The file in question is http://stuff.pdinklag.de/overworld1.ogg (please don't redistribute, worked on this all morning :P).

EDIT: The update as of August 8th fixes the playing offset rotating, but not the wrong duration being returned.
JSFML - The Java binding to SFML.

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
sf::Music - GetDuration() and GetPlayingOffset()
« Reply #1 on: August 15, 2011, 02:13:33 pm »
Quote
I'm using an SFML 2.0 C++ build as of late July.

Laurent fixed something related on August 8. (See https://github.com/SFML/SFML/commit/7f11d16f3ba8ae85403625e01c9d295a9e4dc8d1)

Does it fix your problem?
SFML / OS X developer

pdinklag

  • Sr. Member
  • ****
  • Posts: 330
  • JSFML Developer
    • View Profile
    • JSFML Website
sf::Music - GetDuration() and GetPlayingOffset()
« Reply #2 on: August 15, 2011, 04:06:20 pm »
Quote from: "Hiura"
Quote
I'm using an SFML 2.0 C++ build as of late July.

Laurent fixed something related on August 8.
[...]
Does it fix your problem?

Ah! I didn't update to a later version yet because I didn't feel like implementing the Texture class for JSFML yet.  :roll:

That fix does indeed fix the playing offset rotating. The duration is still wrong, however.
JSFML - The Java binding to SFML.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
sf::Music - GetDuration() and GetPlayingOffset()
« Reply #3 on: August 19, 2011, 06:44:20 pm »
Music::GetDuration() should be ok now.
Laurent Gomila - SFML developer

pdinklag

  • Sr. Member
  • ****
  • Posts: 330
  • JSFML Developer
    • View Profile
    • JSFML Website
sf::Music - GetDuration() and GetPlayingOffset()
« Reply #4 on: August 22, 2011, 02:46:41 pm »
Working fine now, thanks! :)
JSFML - The Java binding to SFML.

 

anything