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());