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

@@ -6,6 +6,8 @@ std::filesystem::path GetAssetDir();
SCENARIO("SoundBuffer", "[AUDIO][SOUNDBUFFER]")
{
using namespace Nz::Literals;
GIVEN("A sound buffer")
{
WHEN("We load a .flac file")
@@ -15,7 +17,7 @@ SCENARIO("SoundBuffer", "[AUDIO][SOUNDBUFFER]")
THEN("We can ask the informations of the file")
{
CHECK(soundBuffer->GetDuration() == 8192);
CHECK(soundBuffer->GetDuration() == 8192_ms);
CHECK(soundBuffer->GetFormat() == Nz::AudioFormat::I16_Stereo);
CHECK(soundBuffer->GetSampleRate() == 96000);
}
@@ -28,7 +30,7 @@ SCENARIO("SoundBuffer", "[AUDIO][SOUNDBUFFER]")
THEN("We can ask the informations of the file")
{
CHECK(soundBuffer->GetDuration() == 27193);
CHECK(soundBuffer->GetDuration() == 27'193'468_us);
CHECK(soundBuffer->GetFormat() == Nz::AudioFormat::I16_Stereo);
CHECK(soundBuffer->GetSampleRate() == 32000);
}
@@ -41,7 +43,7 @@ SCENARIO("SoundBuffer", "[AUDIO][SOUNDBUFFER]")
THEN("We can ask the informations of the file")
{
CHECK(soundBuffer->GetDuration() == 63059);
CHECK(soundBuffer->GetDuration() == 63'059'591_us);
CHECK(soundBuffer->GetFormat() == Nz::AudioFormat::I16_Stereo);
CHECK(soundBuffer->GetSampleRate() == 44100);
}
@@ -54,7 +56,7 @@ SCENARIO("SoundBuffer", "[AUDIO][SOUNDBUFFER]")
THEN("We can ask the informations of the file")
{
CHECK(soundBuffer->GetDuration() == 2490);
CHECK(soundBuffer->GetDuration() == 2'490'340_us);
CHECK(soundBuffer->GetFormat() == Nz::AudioFormat::I16_Mono);
CHECK(soundBuffer->GetSampleRate() == 44100);
}