mirror of
https://github.com/SFML/SFML.git
synced 2024-11-25 12:51:05 +08:00
Fixed sf::Music::GetDuration()
This commit is contained in:
parent
1e2aca6e49
commit
e5d635350e
@ -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());
|
||||
|
Loading…
Reference in New Issue
Block a user