From e5d635350e0fad382117cc3fc3be82db7bf824a9 Mon Sep 17 00:00:00 2001 From: Laurent Gomila Date: Fri, 19 Aug 2011 18:44:46 +0200 Subject: [PATCH] Fixed sf::Music::GetDuration() --- src/SFML/Audio/Music.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/SFML/Audio/Music.cpp b/src/SFML/Audio/Music.cpp index 747d79c85..36dc8822f 100644 --- a/src/SFML/Audio/Music.cpp +++ b/src/SFML/Audio/Music.cpp @@ -139,7 +139,8 @@ void Music::OnSeek(Uint32 timeOffset) void Music::Initialize() { // Compute the music duration - myDuration = static_cast(1000 * myFile->GetSamplesCount() / myFile->GetSampleRate() / myFile->GetChannelsCount()); + Uint64 samples = myFile->GetSamplesCount(); + myDuration = static_cast(1000 * samples / myFile->GetSampleRate() / myFile->GetChannelsCount()); // Resize the internal buffer so that it can contain 1 second of audio samples mySamples.resize(myFile->GetSampleRate() * myFile->GetChannelsCount());