Fixed sf::Music::GetDuration()

This commit is contained in:
Laurent Gomila 2011-08-19 18:44:46 +02:00
parent 1e2aca6e49
commit e5d635350e

View File

@ -139,7 +139,8 @@ void Music::OnSeek(Uint32 timeOffset)
void Music::Initialize()
{
// Compute the music duration
myDuration = static_cast<Uint32>(1000 * myFile->GetSamplesCount() / myFile->GetSampleRate() / myFile->GetChannelsCount());
Uint64 samples = myFile->GetSamplesCount();
myDuration = static_cast<Uint32>(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());