Fix poor setPlayingOffset precision (missing float conversion)

This commit is contained in:
vittorioromeo 2024-06-16 20:19:50 +02:00 committed by Vittorio Romeo
parent 66ecf34356
commit 16e9ae131d

View File

@ -158,7 +158,7 @@ struct SoundStream::Impl : priv::MiniaudioUtils::SoundBase
if (impl.sampleRate != 0) if (impl.sampleRate != 0)
{ {
owner->onSeek(seconds(static_cast<float>(frameIndex / impl.sampleRate))); owner->onSeek(seconds(static_cast<float>(frameIndex) / static_cast<float>(impl.sampleRate)));
} }
else else
{ {
@ -360,7 +360,7 @@ void SoundStream::setPlayingOffset(Time timeOffset)
m_impl->sampleBufferCursor = 0; m_impl->sampleBufferCursor = 0;
m_impl->samplesProcessed = frameIndex * m_impl->channelCount; m_impl->samplesProcessed = frameIndex * m_impl->channelCount;
onSeek(seconds(static_cast<float>(frameIndex / m_impl->sampleRate))); onSeek(seconds(static_cast<float>(frameIndex) / static_cast<float>(m_impl->sampleRate)));
} }