Replace float/UInt64 durations by a more precise Time class (#388)
Improve Clock class with atomic RestartIfOver method and allows to choose required precision
This commit is contained in:
@@ -105,6 +105,17 @@ namespace Nz
|
||||
return m_source->IsSpatializationEnabled();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Seek the sound to a point in time
|
||||
*
|
||||
* \param offset Time offset to seek
|
||||
*/
|
||||
void SoundEmitter::SeekToPlayingOffset(Time offset)
|
||||
{
|
||||
UInt64 microseconds = static_cast<UInt64>(std::max(offset.AsMicroseconds(), Int64(0)));
|
||||
SeekToSampleOffset(SafeCast<UInt32>(microseconds * GetSampleRate() / 1'000'000));
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets the attenuation
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user