14#include <catch2/catch.hpp>
19 settings.inCompressionThreshDb = -20;
20 settings.outCompressionThreshDb = -10;
25 settings.compressionRatio = std::numeric_limits<float>::infinity();
48 constexpr auto numChannels = 2;
49 constexpr auto blockSize = 44100;
50 constexpr auto signalSize = 2 * blockSize;
52 std::vector<std::vector<float>> buffer(numChannels);
53 std::vector<float*> pointers(numChannels);
54 for (
auto i = 0; i < numChannels; ++i)
57 in.resize(signalSize);
58 std::fill(in.begin(), in.begin() + signalSize / 2, 0.0f);
59 std::fill(in.begin() + signalSize / 2, in.end(), 1.0f);
62 while (progress < signalSize)
64 const auto remaining = signalSize - progress;
65 const auto toProcess =
std::min(remaining, blockSize);
67 buffer.begin(), buffer.end(), pointers.begin(),
68 [progress](std::vector<float>& v) { return v.data() + progress; });
69 const auto p = pointers.data();
70 sut.Process(p, p, toProcess);
71 progress += toProcess;
TEST_CASE("GetMaxCompressionDb", "simple test")
static Settings & settings()
static float GetMaxCompressionDb(const DynamicRangeProcessorSettings &settings)
constexpr auto sampleRate