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:
Jérôme Leclercq
2022-12-29 21:31:46 +01:00
committed by GitHub
parent 1de5f65536
commit dd421a6385
84 changed files with 1278 additions and 663 deletions

View File

@@ -130,7 +130,7 @@ namespace Nz
mp3dec_ex_close(&m_decoder);
}
UInt32 GetDuration() const override
Time GetDuration() const override
{
return m_duration;
}
@@ -214,7 +214,7 @@ namespace Nz
m_format = *formatOpt;
m_duration = static_cast<UInt32>(1000ULL * m_decoder.samples / (m_decoder.info.hz * m_decoder.info.channels));
m_duration = Time::Microseconds(1'000'000LL * m_decoder.samples / (m_decoder.info.hz * m_decoder.info.channels));
m_sampleCount = m_decoder.samples;
m_sampleRate = m_decoder.info.hz;
@@ -275,7 +275,7 @@ namespace Nz
AudioFormat m_format;
mp3dec_ex_t m_decoder;
mp3dec_io_t m_io;
UInt32 m_duration;
Time m_duration;
UInt32 m_sampleRate;
UInt64 m_readSampleCount;
UInt64 m_sampleCount;