From ffca05c9f359088e7775fb474486c21e0d3806a2 Mon Sep 17 00:00:00 2001 From: Paul Ferrand Date: Sun, 5 Jan 2020 00:19:08 +0100 Subject: [PATCH] Explicit float literals in tests --- tests/ADSREnvelopeT.cpp | 54 +++++------ tests/AudioBufferT.cpp | 16 ++-- tests/EGDescriptionT.cpp | 8 +- tests/EventEnvelopesT.cpp | 196 +++++++++++++++++++------------------- tests/OnePoleFilterT.cpp | 4 +- tests/SIMDHelpersT.cpp | 66 ++++++------- 6 files changed, 172 insertions(+), 172 deletions(-) diff --git a/tests/ADSREnvelopeT.cpp b/tests/ADSREnvelopeT.cpp index 9afc5407..9da9eae6 100644 --- a/tests/ADSREnvelopeT.cpp +++ b/tests/ADSREnvelopeT.cpp @@ -64,7 +64,7 @@ TEST_CASE("[ADSREnvelope] Attack") sfz::ADSREnvelope envelope; envelope.reset(2, 0); std::array output; - std::array expected { 0.5, 1.0, 1.0, 1.0, 1.0 }; + std::array expected { 0.5f, 1.0f, 1.0f, 1.0f, 1.0f }; for (auto& out : output) out = envelope.getNextValue(); REQUIRE(approxEqual(output, expected)); @@ -80,13 +80,13 @@ TEST_CASE("[ADSREnvelope] Attack again") sfz::ADSREnvelope envelope; envelope.reset(3, 0); std::array output; - std::array expected { 0.33333, 0.66667, 1.0, 1.0, 1.0 }; + std::array expected { 0.33333f, 0.66667f, 1.0f, 1.0f, 1.0f }; for (auto& out : output) out = envelope.getNextValue(); REQUIRE(approxEqual(output, expected)); envelope.reset(3, 0); - absl::c_fill(output, -1.0); + absl::c_fill(output, -1.0f); envelope.getBlock(absl::MakeSpan(output)); REQUIRE(approxEqual(output, expected)); } @@ -97,14 +97,14 @@ TEST_CASE("[ADSREnvelope] Release") envelope.reset(2, 4); envelope.startRelease(2); std::array output; - std::array expected { 0.5, 1.0, 0.08409f, 0.00707f, 0.000594604f, 0.00005f, 0.0f, 0.0f }; + std::array expected { 0.5f, 1.0f, 0.08409f, 0.00707f, 0.000594604f, 0.00005f, 0.0f, 0.0f }; for (auto& out : output) out = envelope.getNextValue(); REQUIRE(approxEqual(output, expected)); envelope.reset(2, 4); envelope.startRelease(2); - absl::c_fill(output, -1.0); + absl::c_fill(output, -1.0f); envelope.getBlock(absl::MakeSpan(output)); REQUIRE(approxEqual(output, expected)); } @@ -115,14 +115,14 @@ TEST_CASE("[ADSREnvelope] Delay") envelope.reset(2, 4, 1.0f, 2); std::array output; envelope.startRelease(4); - std::array expected { 0.0, 0.0, 0.5, 1.0, 0.08409f, 0.00707f, 0.000594604f, 0.00005f, 0.0f, 0.0f }; + std::array expected { 0.0f, 0.0f, 0.5f, 1.0f, 0.08409f, 0.00707f, 0.000594604f, 0.00005f, 0.0f, 0.0f }; for (auto& out : output) out = envelope.getNextValue(); REQUIRE(approxEqual(output, expected)); envelope.reset(2, 4, 1.0f, 2); envelope.startRelease(4); - absl::c_fill(output, -1.0); + absl::c_fill(output, -1.0f); envelope.getBlock(absl::MakeSpan(output)); REQUIRE(approxEqual(output, expected)); } @@ -130,15 +130,15 @@ TEST_CASE("[ADSREnvelope] Delay") TEST_CASE("[ADSREnvelope] Lower sustain") { sfz::ADSREnvelope envelope; - envelope.reset(2, 4, 0.5, 2); + envelope.reset(2, 4, 0.5f, 2); std::array output; - std::array expected { 0.0, 0.0, 0.5, 1.0, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5 }; + std::array expected { 0.0f, 0.0f, 0.5f, 1.0f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f }; for (auto& out : output) out = envelope.getNextValue(); REQUIRE(approxEqual(output, expected)); envelope.reset(2, 4, 0.5, 2); - absl::c_fill(output, -1.0); + absl::c_fill(output, -1.0f); envelope.getBlock(absl::MakeSpan(output)); REQUIRE(approxEqual(output, expected)); } @@ -146,15 +146,15 @@ TEST_CASE("[ADSREnvelope] Lower sustain") TEST_CASE("[ADSREnvelope] Decay") { sfz::ADSREnvelope envelope; - envelope.reset(2, 4, 0.5, 2, 2); + envelope.reset(2, 4, 0.5f, 2, 2); std::array output; - std::array expected { 0.0, 0.0, 0.5, 1.0, 0.707107, 0.5, 0.5, 0.5, 0.5, 0.5 }; + std::array expected { 0.0f, 0.0f, 0.5f, 1.0f, 0.707107f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5 }; for (auto& out : output) out = envelope.getNextValue(); REQUIRE(approxEqual(output, expected)); - envelope.reset(2, 4, 0.5, 2, 2); - absl::c_fill(output, -1.0); + envelope.reset(2, 4, 0.5f, 2, 2); + absl::c_fill(output, -1.0f); envelope.getBlock(absl::MakeSpan(output)); REQUIRE(approxEqual(output, expected)); } @@ -162,15 +162,15 @@ TEST_CASE("[ADSREnvelope] Decay") TEST_CASE("[ADSREnvelope] Hold") { sfz::ADSREnvelope envelope; - envelope.reset(2, 4, 0.5, 2, 2, 2); + envelope.reset(2, 4, 0.5f, 2, 2, 2); std::array output; - std::array expected { 0.0, 0.0, 0.5, 1.0, 1.0, 1.0, 0.707107, 0.5, 0.5, 0.5, 0.5, 0.5 }; + std::array expected { 0.0f, 0.0f, 0.5f, 1.0f, 1.0f, 1.0f, 0.707107f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f }; for (auto& out : output) out = envelope.getNextValue(); REQUIRE(approxEqual(output, expected)); - envelope.reset(2, 4, 0.5, 2, 2, 2); - absl::c_fill(output, -1.0); + envelope.reset(2, 4, 0.5f, 2, 2, 2); + absl::c_fill(output, -1.0f); envelope.getBlock(absl::MakeSpan(output)); REQUIRE(approxEqual(output, expected)); } @@ -178,17 +178,17 @@ TEST_CASE("[ADSREnvelope] Hold") TEST_CASE("[ADSREnvelope] Hold with release") { sfz::ADSREnvelope envelope; - envelope.reset(2, 4, 0.5, 2, 2, 2); + envelope.reset(2, 4, 0.5f, 2, 2, 2); envelope.startRelease(8); std::array output; - std::array expected { 0.0, 0.0, 0.5, 1.0, 1.0, 1.0, 0.707107, 0.5, 0.05, 0.005, 0.0005, 0.00005, 0.0, 0.0 }; + std::array expected { 0.0f, 0.0f, 0.5f, 1.0f, 1.0f, 1.0f, 0.707107f, 0.5f, 0.05f, 0.005f, 0.0005f, 0.00005f, 0.0f, 0.0f }; for (auto& out : output) out = envelope.getNextValue(); REQUIRE(approxEqual(output, expected)); - envelope.reset(2, 4, 0.5, 2, 2, 2); + envelope.reset(2, 4, 0.5f, 2, 2, 2); envelope.startRelease(8); - absl::c_fill(output, -1.0); + absl::c_fill(output, -1.0f); envelope.getBlock(absl::MakeSpan(output)); REQUIRE(approxEqual(output, expected)); } @@ -196,16 +196,16 @@ TEST_CASE("[ADSREnvelope] Hold with release") TEST_CASE("[ADSREnvelope] Hold with release 2") { sfz::ADSREnvelope envelope; - envelope.reset(2, 4, 0.5, 2, 2, 2); + envelope.reset(2, 4, 0.5f, 2, 2, 2); envelope.startRelease(4); std::array output; - std::array expected { 0.0, 0.0, 0.5, 1.0, 0.08409, 0.00707, 0.000594604, 0.00005, 0.0, 0.0, 0.0, 0.0 }; + std::array expected { 0.0f, 0.0f, 0.5f, 1.0f, 0.08409f, 0.00707f, 0.000594604f, 0.00005f, 0.0f, 0.0f, 0.0f, 0.0 }; for (auto& out : output) out = envelope.getNextValue(); REQUIRE(approxEqual(output, expected)); - envelope.reset(2, 4, 0.5, 2, 2, 2); + envelope.reset(2, 4, 0.5f, 2, 2, 2); envelope.startRelease(4); - absl::c_fill(output, -1.0); + absl::c_fill(output, -1.0f); envelope.getBlock(absl::MakeSpan(output)); REQUIRE(approxEqual(output, expected)); -} \ No newline at end of file +} diff --git a/tests/AudioBufferT.cpp b/tests/AudioBufferT.cpp index a2f8f55b..ebd0b61d 100644 --- a/tests/AudioBufferT.cpp +++ b/tests/AudioBufferT.cpp @@ -61,15 +61,15 @@ TEST_CASE("[AudioBuffer] Access") const int size { 5 }; sfz::AudioBuffer buffer(2, size); for (size_t frameIdx = 0; frameIdx < buffer.getNumFrames(); ++frameIdx) { - buffer.getSample(0, frameIdx) = static_cast(buffer.getNumFrames()) + frameIdx; - buffer.getSample(1, frameIdx) = static_cast(buffer.getNumFrames()) - frameIdx; + buffer.getSample(0, frameIdx) = static_cast(buffer.getNumFrames()) + frameIdx; + buffer.getSample(1, frameIdx) = static_cast(buffer.getNumFrames()) - frameIdx; } for (size_t frameIdx = 0; frameIdx < buffer.getNumFrames(); ++frameIdx) { - REQUIRE(buffer.getSample(0, frameIdx) == static_cast(buffer.getNumFrames()) + frameIdx); - REQUIRE(buffer(0, frameIdx) == static_cast(buffer.getNumFrames()) + frameIdx); - REQUIRE(buffer.getSample(1, frameIdx) == static_cast(buffer.getNumFrames()) - frameIdx); - REQUIRE(buffer(1, frameIdx) == static_cast(buffer.getNumFrames()) - frameIdx); + REQUIRE(buffer.getSample(0, frameIdx) == static_cast(buffer.getNumFrames()) + frameIdx); + REQUIRE(buffer(0, frameIdx) == static_cast(buffer.getNumFrames()) + frameIdx); + REQUIRE(buffer.getSample(1, frameIdx) == static_cast(buffer.getNumFrames()) - frameIdx); + REQUIRE(buffer(1, frameIdx) == static_cast(buffer.getNumFrames()) - frameIdx); } } @@ -98,5 +98,5 @@ TEST_CASE("[AudioSpan] Constructions") sfz::AudioSpan manualSpan { { buffer.channelWriter(0), buffer.channelWriter(1) }, buffer.getNumFrames() }; sfz::AudioSpan manualConstSpan { { buffer.channelReader(0), buffer.channelReader(1) }, buffer.getNumFrames() }; sfz::AudioSpan manualSpan2 { {buffer.getSpan(0), buffer.getSpan(1) } }; - sfz::AudioSpan manualConstSpan2 { {buffer.getConstSpan(0), buffer.getConstSpan(1) } }; -} \ No newline at end of file + sfz::AudioSpan manualConstSpan2 { { buffer.getConstSpan(0), buffer.getConstSpan(1) } }; +} diff --git a/tests/EGDescriptionT.cpp b/tests/EGDescriptionT.cpp index aaaf48b7..aaceb179 100644 --- a/tests/EGDescriptionT.cpp +++ b/tests/EGDescriptionT.cpp @@ -31,7 +31,7 @@ TEST_CASE("[EGDescription] Attack range") sfz::EGDescription eg; sfz::SfzCCArray ccArray { 0 }; eg.attack = 1; - eg.vel2attack = -1.27; + eg.vel2attack = -1.27f; eg.ccAttack = { 63, 1.27f }; REQUIRE( eg.getAttack(ccArray, 0) == 1.0f ); REQUIRE( eg.getAttack(ccArray, 127) == 0.0f ); @@ -47,7 +47,7 @@ TEST_CASE("[EGDescription] Delay range") sfz::EGDescription eg; sfz::SfzCCArray ccArray { 0 }; eg.delay = 1; - eg.vel2delay = -1.27; + eg.vel2delay = -1.27f; eg.ccDelay = { 63, 1.27f }; REQUIRE( eg.getDelay(ccArray, 0) == 1.0f ); REQUIRE( eg.getDelay(ccArray, 127) == 0.0f ); @@ -79,7 +79,7 @@ TEST_CASE("[EGDescription] Release range") sfz::EGDescription eg; sfz::SfzCCArray ccArray { 0 }; eg.release = 1; - eg.vel2release = -1.27; + eg.vel2release = -1.27f; eg.ccRelease = { 63, 1.27f }; REQUIRE( eg.getRelease(ccArray, 0) == 1.0f ); REQUIRE( eg.getRelease(ccArray, 127) == 0.0f ); @@ -95,7 +95,7 @@ TEST_CASE("[EGDescription] Hold range") sfz::EGDescription eg; sfz::SfzCCArray ccArray { 0 }; eg.hold = 1; - eg.vel2hold = -1.27; + eg.vel2hold = -1.27f; eg.ccHold = { 63, 1.27f }; REQUIRE( eg.getHold(ccArray, 0) == 1.0f ); REQUIRE( eg.getHold(ccArray, 127) == 0.0f ); diff --git a/tests/EventEnvelopesT.cpp b/tests/EventEnvelopesT.cpp index 10fc2c0d..6c968f5c 100644 --- a/tests/EventEnvelopesT.cpp +++ b/tests/EventEnvelopesT.cpp @@ -51,7 +51,7 @@ TEST_CASE("[LinearEnvelope] Basic state") { sfz::LinearEnvelope envelope; std::array output; - std::array expected { 0.0, 0.0, 0.0, 0.0, 0.0 }; + std::array expected { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }; envelope.getBlock(absl::MakeSpan(output)); REQUIRE(output == expected); } @@ -59,9 +59,9 @@ TEST_CASE("[LinearEnvelope] Basic state") TEST_CASE("[LinearEnvelope] Basic event") { sfz::LinearEnvelope envelope; - envelope.registerEvent(4, 1.0); + envelope.registerEvent(4, 1.0f); std::array output; - std::array expected { 0.25, 0.5, 0.75, 1.0, 1.0, 1.0, 1.0, 1.0 }; + std::array expected { 0.25f, 0.5f, 0.75f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f }; envelope.getBlock(absl::MakeSpan(output)); REQUIRE(output == expected); } @@ -69,10 +69,10 @@ TEST_CASE("[LinearEnvelope] Basic event") TEST_CASE("[LinearEnvelope] 2 events, close") { sfz::LinearEnvelope envelope; - envelope.registerEvent(4, 1.0); - envelope.registerEvent(5, 2.0); + envelope.registerEvent(4, 1.0f); + envelope.registerEvent(5, 2.0f); std::array output; - std::array expected { 0.25, 0.5, 0.75, 1.0, 2.0, 2.0, 2.0, 2.0 }; + std::array expected { 0.25f, 0.5f, 0.75f, 1.0f, 2.0f, 2.0f, 2.0f, 2.0f }; envelope.getBlock(absl::MakeSpan(output)); REQUIRE(output == expected); } @@ -80,10 +80,10 @@ TEST_CASE("[LinearEnvelope] 2 events, close") TEST_CASE("[LinearEnvelope] 2 events, far") { sfz::LinearEnvelope envelope; - envelope.registerEvent(2, 1.0); - envelope.registerEvent(6, 2.0); + envelope.registerEvent(2, 1.0f); + envelope.registerEvent(6, 2.0f); std::array output; - std::array expected { 0.5, 1, 1.25, 1.5, 1.75, 2.0, 2.0, 2.0 }; + std::array expected { 0.5f, 1.0f, 1.25f, 1.5f, 1.75f, 2.0f, 2.0f, 2.0f }; envelope.getBlock(absl::MakeSpan(output)); REQUIRE(output == expected); } @@ -91,10 +91,10 @@ TEST_CASE("[LinearEnvelope] 2 events, far") TEST_CASE("[LinearEnvelope] 2 events, reversed") { sfz::LinearEnvelope envelope; - envelope.registerEvent(6, 2.0); - envelope.registerEvent(2, 1.0); + envelope.registerEvent(6, 2.0f); + envelope.registerEvent(2, 1.0f); std::array output; - std::array expected { 0.5, 1, 1.25, 1.5, 1.75, 2.0, 2.0, 2.0 }; + std::array expected { 0.5f, 1.0f, 1.25f, 1.5f, 1.75f, 2.0f, 2.0f, 2.0f }; envelope.getBlock(absl::MakeSpan(output)); REQUIRE(output == expected); } @@ -102,11 +102,11 @@ TEST_CASE("[LinearEnvelope] 2 events, reversed") TEST_CASE("[LinearEnvelope] 3 events, overlapping") { sfz::LinearEnvelope envelope; - envelope.registerEvent(2, 1.0); - envelope.registerEvent(6, 2.0); - envelope.registerEvent(6, 3.0); + envelope.registerEvent(2, 1.0f); + envelope.registerEvent(6, 2.0f); + envelope.registerEvent(6, 3.0f); std::array output; - std::array expected { 0.5, 1, 1.25, 1.5, 1.75, 2.0, 3.0, 3.0 }; + std::array expected { 0.5f, 1.0f, 1.25f, 1.5f, 1.75f, 2.0f, 3.0f, 3.0f }; envelope.getBlock(absl::MakeSpan(output)); REQUIRE(output == expected); } @@ -114,11 +114,11 @@ TEST_CASE("[LinearEnvelope] 3 events, overlapping") TEST_CASE("[LinearEnvelope] 3 events, out of block") { sfz::LinearEnvelope envelope; - envelope.registerEvent(2, 1.0); - envelope.registerEvent(6, 2.0); - envelope.registerEvent(10, 3.0); + envelope.registerEvent(2, 1.0f); + envelope.registerEvent(6, 2.0f); + envelope.registerEvent(10, 3.0f); std::array output; - std::array expected { 0.5, 1, 1.25, 1.5, 1.75, 2.0, 2.5, 3.0 }; + std::array expected { 0.5f, 1.0f, 1.25f, 1.5f, 1.75f, 2.0f, 2.5f, 3.0f }; envelope.getBlock(absl::MakeSpan(output)); REQUIRE(output == expected); } @@ -126,11 +126,11 @@ TEST_CASE("[LinearEnvelope] 3 events, out of block") TEST_CASE("[LinearEnvelope] 3 events, out of block, with another block call") { sfz::LinearEnvelope envelope; - envelope.registerEvent(2, 1.0); - envelope.registerEvent(6, 2.0); - envelope.registerEvent(10, 3.0); + envelope.registerEvent(2, 1.0f); + envelope.registerEvent(6, 2.0f); + envelope.registerEvent(10, 3.0f); std::array output; - std::array expected { 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0 }; + std::array expected { 3.0f, 3.0f, 3.0f, 3.0f, 3.0f, 3.0f, 3.0f, 3.0f }; envelope.getBlock(absl::MakeSpan(output)); envelope.getBlock(absl::MakeSpan(output)); REQUIRE(output == expected); @@ -139,10 +139,10 @@ TEST_CASE("[LinearEnvelope] 3 events, out of block, with another block call") TEST_CASE("[LinearEnvelope] 2 events, with another block call") { sfz::LinearEnvelope envelope; - envelope.registerEvent(2, 1.0); - envelope.registerEvent(6, 2.0); + envelope.registerEvent(2, 1.0f); + envelope.registerEvent(6, 2.0f); std::array output; - std::array expected { 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0 }; + std::array expected { 2.0f, 2.0f, 2.0f, 2.0f, 2.0f, 2.0f, 2.0f, 2.0f }; envelope.getBlock(absl::MakeSpan(output)); envelope.getBlock(absl::MakeSpan(output)); REQUIRE(output == expected); @@ -152,10 +152,10 @@ TEST_CASE("[LinearEnvelope] 2 events, function") { sfz::LinearEnvelope envelope; envelope.setFunction([](auto x) { return 2 * x; }); - envelope.registerEvent(2, 1.0); - envelope.registerEvent(6, 2.0); + envelope.registerEvent(2, 1.0f); + envelope.registerEvent(6, 2.0f); std::array output; - std::array expected { 1, 2, 2.5, 3, 3.5, 4.0, 4.0, 4.0 }; + std::array expected { 1.0f, 2.0f, 2.5f, 3.0f, 3.5f, 4.0f, 4.0f, 4.0f }; envelope.getBlock(absl::MakeSpan(output)); REQUIRE(output == expected); } @@ -163,10 +163,10 @@ TEST_CASE("[LinearEnvelope] 2 events, function") TEST_CASE("[LinearEnvelope] Get quantized") { sfz::LinearEnvelope envelope; - envelope.registerEvent(2, 1.0); - envelope.registerEvent(6, 2.0); + envelope.registerEvent(2, 1.0f); + envelope.registerEvent(6, 2.0f); std::array output; - std::array expected { 0.0, 1.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0 }; + std::array expected { 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 2.0f, 2.0f, 2.0f }; envelope.getQuantizedBlock(absl::MakeSpan(output), 1.0f); REQUIRE(output == expected); } @@ -174,10 +174,10 @@ TEST_CASE("[LinearEnvelope] Get quantized") TEST_CASE("[LinearEnvelope] Get quantized with unquantized targets") { sfz::LinearEnvelope envelope; - envelope.registerEvent(2, 1.1); - envelope.registerEvent(6, 1.9); + envelope.registerEvent(2, 1.1f); + envelope.registerEvent(6, 1.9f); std::array output; - std::array expected { 0.0, 1.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0 }; + std::array expected { 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 2.0f, 2.0f, 2.0f }; envelope.getQuantizedBlock(absl::MakeSpan(output), 1.0f); REQUIRE(output == expected); } @@ -185,10 +185,10 @@ TEST_CASE("[LinearEnvelope] Get quantized with unquantized targets") TEST_CASE("[LinearEnvelope] Get quantized with 2 steps") { sfz::LinearEnvelope envelope; - envelope.registerEvent(2, 1.0); - envelope.registerEvent(6, 3.0); + envelope.registerEvent(2, 1.0f); + envelope.registerEvent(6, 3.0f); std::array output; - std::array expected { 0.0, 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 3.0 }; + std::array expected { 0.0f, 1.0f, 1.0f, 2.0f, 2.0f, 3.0f, 3.0f, 3.0f }; envelope.getQuantizedBlock(absl::MakeSpan(output), 1.0f); REQUIRE(output == expected); } @@ -196,12 +196,12 @@ TEST_CASE("[LinearEnvelope] Get quantized with 2 steps") TEST_CASE("[LinearEnvelope] Get quantized with 2 steps and an unquantized out of block step") { sfz::LinearEnvelope envelope; - envelope.registerEvent(2, 1.0); - envelope.registerEvent(6, 3.0); - envelope.registerEvent(10, 4.2); + envelope.registerEvent(2, 1.0f); + envelope.registerEvent(6, 3.0f); + envelope.registerEvent(10, 4.2f); std::array output; - std::array expected { 0.0, 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 3.0 }; - std::array expected2 { 4.0, 4.0, 4.0,4.0, 4.0, 4.0, 4.0, 4.0 }; + std::array expected { 0.0f, 1.0f, 1.0f, 2.0f, 2.0f, 3.0f, 3.0f, 3.0f }; + std::array expected2 { 4.0f, 4.0f, 4.0f,4.0f, 4.0f, 4.0f, 4.0f, 4.0f }; envelope.getQuantizedBlock(absl::MakeSpan(output), 1.0f); REQUIRE(output == expected); envelope.getQuantizedBlock(absl::MakeSpan(output), 1.0f); @@ -212,11 +212,11 @@ TEST_CASE("[LinearEnvelope] Get quantized with 2 steps and an unquantized out of TEST_CASE("[LinearEnvelope] Going down quantized with 2 steps") { sfz::LinearEnvelope envelope; - envelope.reset(3.0); - envelope.registerEvent(2, 2.0); - envelope.registerEvent(6, 0.0); + envelope.reset(3.0f); + envelope.registerEvent(2, 2.0f); + envelope.registerEvent(6, 0.0f); std::array output; - std::array expected { 3.0, 2.0, 2.0, 1.0, 1.0, 0.0, 0.0, 0.0 }; + std::array expected { 3.0f, 2.0f, 2.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f }; envelope.getQuantizedBlock(absl::MakeSpan(output), 1.0f); REQUIRE(output == expected); } @@ -224,11 +224,11 @@ TEST_CASE("[LinearEnvelope] Going down quantized with 2 steps") TEST_CASE("[LinearEnvelope] Get quantized with 2 steps and starting unquantized") { sfz::LinearEnvelope envelope; - envelope.reset(0.1); - envelope.registerEvent(3, 1.0); - envelope.registerEvent(7, 3.0); + envelope.reset(0.1f); + envelope.registerEvent(3, 1.0f); + envelope.registerEvent(7, 3.0f); std::array output; - std::array expected { 0.1, 0.1, 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 }; + std::array expected { 0.1f, 0.1f, 1.0f, 1.0f, 2.0f, 2.0f, 3.0f, 3.0f }; envelope.getQuantizedBlock(absl::MakeSpan(output), 1.0f); REQUIRE(output == expected); } @@ -237,11 +237,11 @@ TEST_CASE("[LinearEnvelope] Get quantized with 2 steps and starting unquantized" TEST_CASE("[LinearEnvelope] Going down quantized with 2 steps and starting unquantized") { sfz::LinearEnvelope envelope; - envelope.reset(3.6); - envelope.registerEvent(4, 1.0); + envelope.reset(3.6f); + envelope.registerEvent(4, 1.0f); envelope.registerEvent(7, 0.0); std::array output; - std::array expected { 3.6, 3.0, 2.0, 2.0, 1.0, 1.0, 0.0, 0.0 }; + std::array expected { 3.6f, 3.0f, 2.0f, 2.0f, 1.0f, 1.0f, 0.0f, 0.0f }; envelope.getQuantizedBlock(absl::MakeSpan(output), 1.0f); REQUIRE(output == expected); } @@ -249,10 +249,10 @@ TEST_CASE("[LinearEnvelope] Going down quantized with 2 steps and starting unqua TEST_CASE("[LinearEnvelope] Get quantized with unclean events") { sfz::LinearEnvelope envelope; - envelope.registerEvent(2, 1.2); - envelope.registerEvent(6, 2.5); + envelope.registerEvent(2, 1.2f); + envelope.registerEvent(6, 2.5f); std::array output; - std::array expected { 0.0, 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 3.0 }; + std::array expected { 0.0f, 1.0f, 1.0f, 2.0f, 2.0f, 3.0f, 3.0f, 3.0f }; envelope.getQuantizedBlock(absl::MakeSpan(output), 1.0f); REQUIRE(output == expected); } @@ -260,12 +260,12 @@ TEST_CASE("[LinearEnvelope] Get quantized with unclean events") TEST_CASE("[LinearEnvelope] Get quantized 3 events, one out of block") { sfz::LinearEnvelope envelope; - envelope.registerEvent(2, 1.0); - envelope.registerEvent(6, 2.0); - envelope.registerEvent(10, 3.0); + envelope.registerEvent(2, 1.0f); + envelope.registerEvent(6, 2.0f); + envelope.registerEvent(10, 3.0f); std::array output; - std::array expected { 0.0, 1.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0 }; - std::array expected2 { 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0 }; + std::array expected { 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 2.0f, 2.0f, 2.0f }; + std::array expected2 { 3.0f, 3.0f, 3.0f, 3.0f, 3.0f, 3.0f, 3.0f, 3.0f }; envelope.getQuantizedBlock(absl::MakeSpan(output), 1.0f); REQUIRE(output == expected); envelope.getQuantizedBlock(absl::MakeSpan(output), 1.0f); @@ -277,7 +277,7 @@ TEST_CASE("[MultiplicativeEnvelope] Basic state") { sfz::MultiplicativeEnvelope envelope; std::array output; - std::array expected { 1.0, 1.0, 1.0, 1.0, 1.0 }; + std::array expected { 1.0f, 1.0f, 1.0f, 1.0f, 1.0f }; envelope.getBlock(absl::MakeSpan(output)); REQUIRE(output == expected); } @@ -285,9 +285,9 @@ TEST_CASE("[MultiplicativeEnvelope] Basic state") TEST_CASE("[MultiplicativeEnvelope] Basic event") { sfz::MultiplicativeEnvelope envelope; - envelope.registerEvent(4, 2.0); + envelope.registerEvent(4, 2.0f); std::array output; - std::array expected { 1.1892, 1.4142, 1.68176, 2.0, 2.0, 2.0, 2.0, 2.0 }; + std::array expected { 1.1892f, 1.4142f, 1.68176f, 2.0f, 2.0f, 2.0f, 2.0f, 2.0f }; envelope.getBlock(absl::MakeSpan(output)); REQUIRE(approxEqual(output, expected)); } @@ -295,10 +295,10 @@ TEST_CASE("[MultiplicativeEnvelope] Basic event") TEST_CASE("[MultiplicativeEnvelope] 2 events") { sfz::MultiplicativeEnvelope envelope; - envelope.registerEvent(4, 2.0); - envelope.registerEvent(5, 4.0); + envelope.registerEvent(4, 2.0f); + envelope.registerEvent(5, 4.0f); std::array output; - std::array expected { 1.1892, 1.4142, 1.68176, 2.0, 4.0, 4.0, 4.0, 4.0 }; + std::array expected { 1.1892f, 1.4142f, 1.68176f, 2.0f, 4.0f, 4.0f, 4.0f, 4.0f }; envelope.getBlock(absl::MakeSpan(output)); REQUIRE(approxEqual(output, expected)); } @@ -306,10 +306,10 @@ TEST_CASE("[MultiplicativeEnvelope] 2 events") TEST_CASE("[MultiplicativeEnvelope] 2 events, far") { sfz::MultiplicativeEnvelope envelope; - envelope.registerEvent(2, 2.0); - envelope.registerEvent(6, 4.0); + envelope.registerEvent(2, 2.0f); + envelope.registerEvent(6, 4.0f); std::array output; - std::array expected { 1.4142, 2.0, 2.37841, 2.82843, 3.36358, 4.0, 4.0, 4.0 }; + std::array expected { 1.4142f, 2.0f, 2.37841f, 2.82843f, 3.36358f, 4.0f, 4.0f, 4.0f }; envelope.getBlock(absl::MakeSpan(output)); REQUIRE(approxEqual(output, expected)); } @@ -317,10 +317,10 @@ TEST_CASE("[MultiplicativeEnvelope] 2 events, far") TEST_CASE("[MultiplicativeEnvelope] Get quantized with 2 steps") { sfz::MultiplicativeEnvelope envelope; - envelope.registerEvent(2, 2.0); - envelope.registerEvent(6, 4.0); + envelope.registerEvent(2, 2.0f); + envelope.registerEvent(6, 4.0f); std::array output; - std::array expected { 1.0, 2.0, 2.0, 2.0, 2.0, 4.0, 4.0, 4.0 }; + std::array expected { 1.0f, 2.0f, 2.0f, 2.0f, 2.0f, 4.0f, 4.0f, 4.0f }; envelope.getQuantizedBlock(absl::MakeSpan(output), 2.0f); REQUIRE(output == expected); } @@ -328,12 +328,12 @@ TEST_CASE("[MultiplicativeEnvelope] Get quantized with 2 steps") TEST_CASE("[MultiplicativeEnvelope] Get quantized with an unquantized out of range step") { sfz::MultiplicativeEnvelope envelope; - envelope.registerEvent(2, 2.0); - envelope.registerEvent(6, 4.0); - envelope.registerEvent(10, 8.2); + envelope.registerEvent(2, 2.0f); + envelope.registerEvent(6, 4.0f); + envelope.registerEvent(10, 8.2f); std::array output; - std::array expected { 1.0, 2.0, 2.0, 2.0, 2.0, 4.0, 4.0, 4.0 }; - std::array expected2 { 8.0, 8.0, 8.0, 8.0, 8.0, 8.0, 8.0, 8.0 }; + std::array expected { 1.0f, 2.0f, 2.0f, 2.0f, 2.0f, 4.0f, 4.0f, 4.0f }; + std::array expected2 { 8.0f, 8.0f, 8.0f, 8.0f, 8.0f, 8.0f, 8.0f, 8.0f }; envelope.getQuantizedBlock(absl::MakeSpan(output), 2.0f); REQUIRE(output == expected); envelope.getQuantizedBlock(absl::MakeSpan(output), 2.0f); @@ -343,11 +343,11 @@ TEST_CASE("[MultiplicativeEnvelope] Get quantized with an unquantized out of ran TEST_CASE("[MultiplicativeEnvelope] Going down quantized with 2 steps") { sfz::MultiplicativeEnvelope envelope; - envelope.reset(4.0); - envelope.registerEvent(2, 2.0); - envelope.registerEvent(6, 0.5); + envelope.reset(4.0f); + envelope.registerEvent(2, 2.0f); + envelope.registerEvent(6, 0.5f); std::array output; - std::array expected { 4.0, 2.0, 2.0, 1.0, 1.0, 0.5, 0.5, 0.5 }; + std::array expected { 4.0f, 2.0f, 2.0f, 1.0f, 1.0f, 0.5f, 0.5f, 0.5f }; envelope.getQuantizedBlock(absl::MakeSpan(output), 2.0f); REQUIRE(output == expected); } @@ -355,10 +355,10 @@ TEST_CASE("[MultiplicativeEnvelope] Going down quantized with 2 steps") TEST_CASE("[MultiplicativeEnvelope] Get quantized with unclean events") { sfz::MultiplicativeEnvelope envelope; - envelope.registerEvent(2, 1.2); - envelope.registerEvent(6, 2.5); + envelope.registerEvent(2, 1.2f); + envelope.registerEvent(6, 2.5f); std::array output; - std::array expected { 1.0, 1.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0 }; + std::array expected { 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 2.0f, 2.0f, 2.0f }; envelope.getQuantizedBlock(absl::MakeSpan(output), 2.0f); REQUIRE(output == expected); } @@ -366,11 +366,11 @@ TEST_CASE("[MultiplicativeEnvelope] Get quantized with unclean events") TEST_CASE("[MultiplicativeEnvelope] Get quantized with 2 steps and starting unquantized") { sfz::MultiplicativeEnvelope envelope; - envelope.reset(0.9); - envelope.registerEvent(3, 1.0); - envelope.registerEvent(7, 4.0); + envelope.reset(0.9f); + envelope.registerEvent(3, 1.0f); + envelope.registerEvent(7, 4.0f); std::array output; - std::array expected { 0.9, 0.9, 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 }; + std::array expected { 0.9f, 0.9f, 1.0f, 1.0f, 2.0f, 2.0f, 4.0f, 4.0f }; envelope.getQuantizedBlock(absl::MakeSpan(output), 2.0f); REQUIRE(output == expected); } @@ -379,11 +379,11 @@ TEST_CASE("[MultiplicativeEnvelope] Get quantized with 2 steps and starting unqu TEST_CASE("[MultiplicativeEnvelope] Going down quantized with 2 steps and starting unquantized") { sfz::MultiplicativeEnvelope envelope; - envelope.reset(4.6); - envelope.registerEvent(4, 1.0); - envelope.registerEvent(7, 0.25); + envelope.reset(4.6f); + envelope.registerEvent(4, 1.0f); + envelope.registerEvent(7, 0.25f); std::array output; - std::array expected { 4.6, 2.0, 1.0, 1.0, 0.5, 0.5, 0.25, 0.25 }; + std::array expected { 4.6f, 2.0f, 1.0f, 1.0f, 0.5f, 0.5f, 0.25f, 0.25f }; envelope.getQuantizedBlock(absl::MakeSpan(output), 2.0f); REQUIRE(output == expected); } @@ -394,13 +394,13 @@ TEST_CASE("[MultiplicativeEnvelope] Pitch envelope basic function") sfz::MultiplicativeEnvelope envelope; envelope.setFunction([](float pitchValue){ const auto normalizedBend = sfz::normalizeBend(pitchValue); - const auto bendInCents = normalizedBend * 200; + const auto bendInCents = normalizedBend * 200.0f; return sfz::centsFactor(bendInCents); }); - envelope.reset(0); + envelope.reset(0.0f); envelope.getBlock(absl::MakeSpan(output)); REQUIRE(output[255] == 1.0_a); - envelope.registerEvent(252, -6020); + envelope.registerEvent(252, -6020.0f); envelope.getBlock(absl::MakeSpan(output)); REQUIRE(output[255] == Approx(0.9168).epsilon(0.01)); } diff --git a/tests/OnePoleFilterT.cpp b/tests/OnePoleFilterT.cpp index 378271db..d4ffeaa1 100644 --- a/tests/OnePoleFilterT.cpp +++ b/tests/OnePoleFilterT.cpp @@ -73,7 +73,7 @@ void testLowpass(const fs::path& inputNumpyFile, const fs::path& outputNumpyFile REQUIRE(approxEqual(outputData, expectedData)); filter.reset(); - std::fill(outputData.begin(), outputData.end(), 0.0); + std::fill(outputData.begin(), outputData.end(), 0.0f); std::vector gains(size); std::fill(gains.begin(), gains.end(), gain); filter.processLowpassVariableGain(inputData, absl::MakeSpan(outputData), gains); @@ -108,7 +108,7 @@ void testHighpass(const fs::path& inputNumpyFile, const fs::path& outputNumpyFil REQUIRE(approxEqual(outputData, expectedData)); filter.reset(); - std::fill(outputData.begin(), outputData.end(), 0.0); + std::fill(outputData.begin(), outputData.end(), 0.0f); std::vector gains(size); std::fill(gains.begin(), gains.end(), gain); filter.processHighpassVariableGain(inputData, absl::MakeSpan(outputData), gains); diff --git a/tests/SIMDHelpersT.cpp b/tests/SIMDHelpersT.cpp index a0e798fc..8be6dec2 100644 --- a/tests/SIMDHelpersT.cpp +++ b/tests/SIMDHelpersT.cpp @@ -33,7 +33,7 @@ using namespace Catch::literals; constexpr int smallBufferSize { 3 }; constexpr int bigBufferSize { 4095 }; constexpr int medBufferSize { 127 }; -constexpr double fillValue { 1.3 }; +constexpr float fillValue { 1.3f }; template inline bool approxEqualMargin(absl::Span lhs, absl::Span rhs, Type eps = 1e-3) @@ -334,7 +334,7 @@ TEST_CASE("[Helpers] Interleaved write SIMD vs Scalar") std::array outputScalar; std::array outputSIMD; std::iota(leftInput.begin(), leftInput.end(), 0.0f); - std::iota(rightInput.begin(), rightInput.end(), medBufferSize); + std::iota(rightInput.begin(), rightInput.end(), static_cast(medBufferSize)); sfz::writeInterleaved(leftInput, rightInput, absl::MakeSpan(outputScalar)); sfz::writeInterleaved(leftInput, rightInput, absl::MakeSpan(outputSIMD)); REQUIRE(outputScalar == outputSIMD); @@ -414,7 +414,7 @@ TEST_CASE("[Helpers] Gain, spans and inplace (SIMD)") TEST_CASE("[Helpers] SFZ looping index") { - std::array jumps { 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f }; // 1.1 2.3 3.6 5.0 6.5 8.1 + std::array jumps { 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f }; // 1.1 2.3 3.6 5.0f 6.5 8.1 std::array indices; std::array leftCoeffs; std::array rightCoeffs; @@ -429,7 +429,7 @@ TEST_CASE("[Helpers] SFZ looping index") TEST_CASE("[Helpers] SFZ looping index (SIMD)") { - std::array jumps { 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f }; // 1.1 2.3 3.6 5.0 6.5 8.1 + std::array jumps { 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f }; // 1.1 2.3 3.6 5.0f 6.5 8.1 std::array indices; std::array leftCoeffs; std::array rightCoeffs; @@ -458,13 +458,13 @@ TEST_CASE("[Helpers] SFZ looping index (SIMD)") // sfz::loopingSFZIndex(jumps, absl::MakeSpan(leftCoeffs), absl::MakeSpan(rightCoeffs), absl::MakeSpan(indices), 1.0f, medBufferSize, 1); // sfz::loopingSFZIndex(jumps, absl::MakeSpan(leftCoeffsSIMD), absl::MakeSpan(rightCoeffsSIMD), absl::MakeSpan(indicesSIMD), 1.0f, medBufferSize, 1); // for (int i = 0; i < bigBufferSize; ++i) -// REQUIRE( ((static_cast(indices[i]) + rightCoeffs[i] == Approx(static_cast(indicesSIMD[i]) + rightCoeffsSIMD[i]).margin(1e-2)) +// REQUIRE( ((static_cast(indices[i]) + rightCoeffs[i] == Approx(static_cast(indicesSIMD[i]) + rightCoeffsSIMD[i]).margin(1e-2)) // || (static_cast(indices[i]) + rightCoeffs[i] == Approx(static_cast(indicesSIMD[i]) + rightCoeffsSIMD[i] - static_cast(medBufferSize)).margin(2e-2))) ); // } TEST_CASE("[Helpers] SFZ saturating index") { - std::array jumps { 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f }; // 1.1 2.3 3.6 5.0 6.5 8.1 + std::array jumps { 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f }; // 1.1 2.3 3.6 5.0f 6.5 8.1 std::array indices; std::array leftCoeffs; std::array rightCoeffs; @@ -479,7 +479,7 @@ TEST_CASE("[Helpers] SFZ saturating index") TEST_CASE("[Helpers] SFZ saturating index (SIMD)") { - std::array jumps { 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f }; // 1.1 2.3 3.6 5.0 6.5 8.1 + std::array jumps { 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f }; // 1.1 2.3 3.6 5.0f 6.5 8.1 std::array indices; std::array leftCoeffs; std::array rightCoeffs; @@ -558,7 +558,7 @@ TEST_CASE("[Helpers] Multiplicative Ramp") std::array output; std::array expected { v, v * v, v * v * v, v * v * v * v, v * v * v * v * v, v * v * v * v * v * v }; sfz::multiplicativeRamp(absl::MakeSpan(output), start, v); - REQUIRE(output == expected); + REQUIRE(approxEqual(output, expected)); } TEST_CASE("[Helpers] Multiplicative Ramp (SIMD)") @@ -568,7 +568,7 @@ TEST_CASE("[Helpers] Multiplicative Ramp (SIMD)") std::array output; std::array expected { v, v * v, v * v * v, v * v * v * v, v * v * v * v * v, v * v * v * v * v * v }; sfz::multiplicativeRamp(absl::MakeSpan(output), start, v); - REQUIRE(output == expected); + REQUIRE(approxEqual(output, expected)); } TEST_CASE("[Helpers] Multiplicative Ramp (SIMD vs scalar)") @@ -595,7 +595,7 @@ TEST_CASE("[Helpers] Add") { std::array input { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f }; std::array output { 1.0f, 1.0f, 1.0f, 1.0f, 1.0f }; - std::array expected { 2.0, 3.0, 4.0, 5.0, 6.0 }; + std::array expected { 2.0f, 3.0f, 4.0f, 5.0f, 6.0f }; sfz::add(input, absl::MakeSpan(output)); REQUIRE(output == expected); } @@ -604,7 +604,7 @@ TEST_CASE("[Helpers] Add (SIMD)") { std::array input { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f }; std::array output { 1.0f, 1.0f, 1.0f, 1.0f, 1.0f }; - std::array expected { 2.0, 3.0, 4.0, 5.0, 6.0 }; + std::array expected { 2.0f, 3.0f, 4.0f, 5.0f, 6.0f }; sfz::add(input, absl::MakeSpan(output)); REQUIRE(output == expected); } @@ -614,9 +614,9 @@ TEST_CASE("[Helpers] Add (SIMD vs scalar)") std::vector input(bigBufferSize); std::vector outputScalar(bigBufferSize); std::vector outputSIMD(bigBufferSize); - absl::c_iota(input, 0.0); - absl::c_fill(outputScalar, 0.0); - absl::c_fill(outputSIMD, 0.0); + absl::c_iota(input, 0.0f); + absl::c_fill(outputScalar, 0.0f); + absl::c_fill(outputSIMD, 0.0f); sfz::add(input, absl::MakeSpan(outputScalar)); sfz::add(input, absl::MakeSpan(outputSIMD)); @@ -627,7 +627,7 @@ TEST_CASE("[Helpers] Subtract") { std::array input { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f }; std::array output { 1.0f, 1.0f, 1.0f, 1.0f, 1.0f }; - std::array expected { 0.0, -1.0, -2.0, -3.0, -4.0 }; + std::array expected { 0.0f, -1.0f, -2.0f, -3.0f, -4.0f }; sfz::subtract(input, absl::MakeSpan(output)); REQUIRE(output == expected); } @@ -635,7 +635,7 @@ TEST_CASE("[Helpers] Subtract") TEST_CASE("[Helpers] Subtract 2") { std::array output { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f }; - std::array expected { 0.0, 1.0, 2.0, 3.0, 4.0 }; + std::array expected { 0.0f, 1.0f, 2.0f, 3.0f, 4.0f }; sfz::subtract(1.0f, absl::MakeSpan(output)); REQUIRE(output == expected); } @@ -645,7 +645,7 @@ TEST_CASE("[Helpers] Subtract (SIMD)") { std::array input { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f }; std::array output { 1.0f, 1.0f, 1.0f, 1.0f, 1.0f }; - std::array expected { 0.0, -1.0, -2.0, -3.0, -4.0 }; + std::array expected { 0.0f, -1.0f, -2.0f, -3.0f, -4.0f }; sfz::subtract(input, absl::MakeSpan(output)); REQUIRE(output == expected); } @@ -655,9 +655,9 @@ TEST_CASE("[Helpers] Subtract (SIMD vs scalar)") std::vector input(bigBufferSize); std::vector outputScalar(bigBufferSize); std::vector outputSIMD(bigBufferSize); - absl::c_iota(input, 0.0); - absl::c_fill(outputScalar, 0.0); - absl::c_fill(outputSIMD, 0.0); + absl::c_iota(input, 0.0f); + absl::c_fill(outputScalar, 0.0f); + absl::c_fill(outputSIMD, 0.0f); sfz::subtract(input, absl::MakeSpan(outputScalar)); sfz::subtract(input, absl::MakeSpan(outputSIMD)); @@ -668,8 +668,8 @@ TEST_CASE("[Helpers] Subtract 2 (SIMD vs scalar)") { std::vector outputScalar(bigBufferSize); std::vector outputSIMD(bigBufferSize); - absl::c_iota(outputScalar, 0.0); - absl::c_iota(outputSIMD, 0.0); + absl::c_iota(outputScalar, 0.0f); + absl::c_iota(outputSIMD, 0.0f); sfz::subtract(1.2f, absl::MakeSpan(outputScalar)); sfz::subtract(1.2f, absl::MakeSpan(outputSIMD)); @@ -697,9 +697,9 @@ TEST_CASE("[Helpers] copy (SIMD vs scalar)") std::vector input(bigBufferSize); std::vector outputScalar(bigBufferSize); std::vector outputSIMD(bigBufferSize); - absl::c_iota(input, 0.0); - absl::c_fill(outputScalar, 0.0); - absl::c_fill(outputSIMD, 0.0); + absl::c_iota(input, 0.0f); + absl::c_fill(outputScalar, 0.0f); + absl::c_fill(outputSIMD, 0.0f); sfz::add(input, absl::MakeSpan(outputScalar)); sfz::add(input, absl::MakeSpan(outputSIMD)); @@ -716,7 +716,7 @@ TEST_CASE("[Helpers] Mean") TEST_CASE("[Helpers] Mean (SIMD vs scalar)") { std::vector input(bigBufferSize); - absl::c_iota(input, 0.0); + absl::c_iota(input, 0.0f); REQUIRE(sfz::mean(input) == Approx(sfz::mean(input)).margin(0.001)); } @@ -730,14 +730,14 @@ TEST_CASE("[Helpers] Mean Squared") TEST_CASE("[Helpers] Mean Squared (SIMD vs scalar)") { std::vector input(medBufferSize); - absl::c_iota(input, 0.0); + absl::c_iota(input, 0.0f); REQUIRE(sfz::meanSquared(input) == sfz::meanSquared(input)); } TEST_CASE("[Helpers] Cumulative sum ") { - std::array input { 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f }; // 1.1 2.3 3.6 5.0 6.5 8.1 - std::array output; + std::array input { 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f }; // 1.1 2.3 3.6 5.0f 6.5 8.1 + std::array output; std::array expected { 1.1f, 2.3f, 3.6f, 5.0f, 6.5f, 8.1f }; sfz::cumsum(input, absl::MakeSpan(output)); REQUIRE(approxEqual(output, expected)); @@ -748,7 +748,7 @@ TEST_CASE("[Helpers] Cumulative sum (SIMD vs Scalar)") std::vector input(bigBufferSize); std::vector outputScalar(bigBufferSize); std::vector outputSIMD(bigBufferSize); - sfz::linearRamp(absl::MakeSpan(input), 0.0, 0.1); + sfz::linearRamp(absl::MakeSpan(input), 0.0f, 0.1f); sfz::cumsum(input, absl::MakeSpan(outputScalar)); sfz::cumsum(input, absl::MakeSpan(outputSIMD)); REQUIRE(approxEqual(outputScalar, outputSIMD)); @@ -757,7 +757,7 @@ TEST_CASE("[Helpers] Cumulative sum (SIMD vs Scalar)") TEST_CASE("[Helpers] Diff ") { std::array input { 1.1f, 2.3f, 3.6f, 5.0f, 6.5f, 8.1f }; - std::array output; + std::array output; std::array expected { 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f }; sfz::diff(input, absl::MakeSpan(output)); REQUIRE(approxEqual(output, expected)); @@ -768,8 +768,8 @@ TEST_CASE("[Helpers] Diff (SIMD vs Scalar)") std::vector input(bigBufferSize); std::vector outputScalar(bigBufferSize); std::vector outputSIMD(bigBufferSize); - sfz::linearRamp(absl::MakeSpan(input), 0.0, 0.1); + sfz::linearRamp(absl::MakeSpan(input), 0.0f, 0.1f); sfz::diff(input, absl::MakeSpan(outputScalar)); sfz::diff(input, absl::MakeSpan(outputSIMD)); REQUIRE(approxEqual(outputScalar, outputSIMD)); -} \ No newline at end of file +}