Fixed sf::SoundBuffer returning wrong duration for sounds containing more than ~4.3 million samples

This commit is contained in:
Laurent Gomila 2013-10-11 19:21:31 +02:00
parent db77b76d91
commit 2ff58edd9a

View File

@ -253,7 +253,7 @@ bool SoundBuffer::update(unsigned int channelCount, unsigned int sampleRate)
alCheck(alBufferData(m_buffer, format, &m_samples[0], size, sampleRate)); alCheck(alBufferData(m_buffer, format, &m_samples[0], size, sampleRate));
// Compute the duration // Compute the duration
m_duration = milliseconds(1000 * m_samples.size() / sampleRate / channelCount); m_duration = seconds(static_cast<float>(m_samples.size()) / sampleRate / channelCount);
return true; return true;
} }