| 833 | struct LowPassFilter : BiquadFilter |
| 834 | { |
| 835 | LowPassFilter() : BiquadFilter("Low-pass Filter") |
| 836 | { |
| 837 | static constexpr auto cutoffFrequency = 500.f; |
| 838 | |
| 839 | const auto c = 1.f / std::tan(pi * cutoffFrequency / |
| 840 | static_cast<float>(sf::PlaybackDevice::getDeviceSampleRate().value_or(44100))); |
| 841 | |
| 842 | Coefficients coefficients; |
| 843 | |
| 844 | coefficients.a0 = 1.f / (1.f + sqrt2 * c + std::pow(c, 2.f)); |
| 845 | coefficients.a1 = 2.f * coefficients.a0; |
| 846 | coefficients.a2 = coefficients.a0; |
| 847 | coefficients.b1 = 2.f * coefficients.a0 * (1.f - std::pow(c, 2.f)); |
| 848 | coefficients.b2 = coefficients.a0 * (1.f - sqrt2 * c + std::pow(c, 2.f)); |
| 849 | |
| 850 | setCoefficients(coefficients); |
| 851 | } |
| 852 | }; |
| 853 | |
| 854 |
nothing calls this directly
no test coverage detected