| 808 | struct HighPassFilter : BiquadFilter |
| 809 | { |
| 810 | HighPassFilter() : BiquadFilter("High-pass Filter") |
| 811 | { |
| 812 | static constexpr auto cutoffFrequency = 2000.f; |
| 813 | |
| 814 | const auto c = std::tan( |
| 815 | pi * cutoffFrequency / static_cast<float>(sf::PlaybackDevice::getDeviceSampleRate().value_or(44100))); |
| 816 | |
| 817 | Coefficients coefficients; |
| 818 | |
| 819 | coefficients.a0 = 1.f / (1.f + sqrt2 * c + std::pow(c, 2.f)); |
| 820 | coefficients.a1 = -2.f * coefficients.a0; |
| 821 | coefficients.a2 = coefficients.a0; |
| 822 | coefficients.b1 = 2.f * coefficients.a0 * (std::pow(c, 2.f) - 1.f); |
| 823 | coefficients.b2 = coefficients.a0 * (1.f - sqrt2 * c + std::pow(c, 2.f)); |
| 824 | |
| 825 | setCoefficients(coefficients); |
| 826 | } |
| 827 | }; |
| 828 | |
| 829 |
nothing calls this directly
no test coverage detected