Skip to content

Commit

Permalink
Improve Hades tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiashienzsch committed Feb 16, 2024
1 parent c6cc383 commit deb92d7
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 16 deletions.
10 changes: 5 additions & 5 deletions lib/grit/eurorack/hades.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ auto Hades::Amp::prepare(float sampleRate) -> void
auto Hades::Amp::operator()(float sample) -> float
{
switch (_index) {
// case TanhIndex: return _tanh(sample);
// case HardIndex: return _hard(sample);
// case FullWaveIndex: return _fullWave(sample);
// case HalfWaveIndex: return _halfWave(sample);
// case DiodeIndex: return _diode(sample);
case TanhIndex: return _tanh(sample);
case HardIndex: return _hard(sample);
case FullWaveIndex: return _fullWave(sample);
case HalfWaveIndex: return _halfWave(sample);
case DiodeIndex: return _diode(sample);
case FireAmpIndex: return _fireAmp(sample);
case GrindAmpIndex: return _grindAmp(sample);
default: break;
Expand Down
22 changes: 11 additions & 11 deletions lib/grit/eurorack/hades.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,22 +70,22 @@ struct Hades
private:
enum Index : int
{
// TanhIndex = 0,
// HardIndex,
// FullWaveIndex,
// HalfWaveIndex,
// DiodeIndex,
TanhIndex = 0,
HardIndex,
FullWaveIndex,
HalfWaveIndex,
DiodeIndex,
FireAmpIndex,
GrindAmpIndex,
MaxIndex,
};

Index _index{FireAmpIndex};
// TanhClipper<float> _tanh{};
// HardClipper<float> _hard{};
// FullWaveRectifier<float> _fullWave{};
// HalfWaveRectifier<float> _halfWave{};
// DiodeRectifier<float> _diode{};
Index _index{TanhIndex};
TanhClipper<float> _tanh{};
HardClipper<float> _hard{};
FullWaveRectifier<float> _fullWave{};
HalfWaveRectifier<float> _halfWave{};
DiodeRectifier<float> _diode{};
AirWindowsFireAmp<float> _fireAmp{};
AirWindowsGrindAmp<float> _grindAmp{};
};
Expand Down
9 changes: 9 additions & 0 deletions lib/grit/eurorack/hades_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,13 @@ TEST_CASE("grit/audio/eurorack: Hades")
REQUIRE(etl::isfinite(block(1, i)));
}
}

for (auto i{0}; i < 128; ++i) {
hades.nextDistortionAlgorithm();
[[maybe_unused]] auto const cv = hades.process(block, {});
for (auto i{0}; i < blockSize; ++i) {
REQUIRE(etl::isfinite(block(0, i)));
REQUIRE(etl::isfinite(block(1, i)));
}
}
}

0 comments on commit deb92d7

Please sign in to comment.