32 static CommonSmoothedValueTests <LogRampedValue <float>> commonLogRampedValueTests;
38 :
UnitTest (
"LogRampedValueTests", UnitTestCategories::dsp)
45 Array<double> levels = { -0.12243, -1.21245, -12.2342, -22.4683, -30.0, -61.18753 };
47 for (
auto level : levels)
54 for (
auto range : ranges)
59 slowStart.
reset (numSamples);
60 fastStart.reset (numSamples);
62 slowStart.setLogParameters (level,
true);
63 fastStart.setLogParameters (level,
false);
65 slowStart.setTargetValue (range.getEnd());
66 fastStart.setTargetValue (range.getStart());
70 results.
setSample (0, 0, slowStart.getCurrentValue());
71 results.
setSample (1, 0, fastStart.getCurrentValue());
75 results.
setSample (0, i, slowStart.getNextValue());
76 results.
setSample (1, i, fastStart.getNextValue());
94 static LogRampedValueTests LogRampedValueTests;
A multi-channel buffer containing floating point audio samples.
Type getSample(int channel, int sampleIndex) const noexcept
Returns a sample from the buffer.
int getNumSamples() const noexcept
Returns the number of samples allocated in each of the buffer's channels.
void setSample(int destChannel, int destSample, Type newValue) noexcept
Sets a sample in the buffer.
static Type decibelsToGain(Type decibels, Type minusInfinityDb=Type(defaultMinusInfinitydB))
Converts a dBFS value to its equivalent gain level.
A general-purpose range object, that simply represents any linear range with a start and end point.
This is a base class for classes that perform a unit test.
UnitTest(const String &name, const String &category=String())
Creates a test with the given name and optionally places it in a category.
void beginTest(const String &testName)
Tells the system that a new subsection of tests is beginning.
void expectWithinAbsoluteError(ValueType actual, ValueType expected, ValueType maxAbsoluteError, String failureMessage=String())
Computes the difference between a value and a comparison value, and if it is larger than a specified ...
void runTest() override
Implement this method in your subclass to actually run your tests.
Utility class for logarithmically smoothed linear values.
void reset(double sampleRate, double rampLengthInSeconds) noexcept
Reset to a new sample rate and ramp length.