SFML community forums

Help => Audio => Topic started by: pdinklag on August 15, 2011, 12:25:56 pm

Title: sf::Music - GetDuration() and GetPlayingOffset()
Post by: pdinklag 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.
Title: sf::Music - GetDuration() and GetPlayingOffset()
Post by: Hiura 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?
Title: sf::Music - GetDuration() and GetPlayingOffset()
Post by: pdinklag 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.
Title: sf::Music - GetDuration() and GetPlayingOffset()
Post by: Laurent on August 19, 2011, 06:44:20 pm
Music::GetDuration() should be ok now.
Title: sf::Music - GetDuration() and GetPlayingOffset()
Post by: pdinklag on August 22, 2011, 02:46:41 pm
Working fine now, thanks! :)