fix issues in gcc

This commit is contained in:
Ondřej Novák 2025-02-18 16:00:00 +01:00
parent e631f339dd
commit 8ef23fe366
2 changed files with 4 additions and 4 deletions

View file

@ -2,12 +2,12 @@
#include <vector> #include <vector>
#include "sound_filter.h" #include "sound_filter.h"
static constexpr float M_PI = 3.1415926535f; static constexpr float pi_number = 3.1415926535f;
Biquad::Biquad() : b0(1), b1(0), b2(0), a1(0), a2(0), z1(0), z2(0) {} Biquad::Biquad() : b0(1), b1(0), b2(0), a1(0), a2(0), z1(0), z2(0) {}
void Biquad::setLowShelf(float gainDB, float cutoff, float sampleRate) { void Biquad::setLowShelf(float gainDB, float cutoff, float sampleRate) {
const float A = std::pow(10.0f, gainDB / 40.0f); const float A = std::pow(10.0f, gainDB / 40.0f);
const float omega = 2.0f * float(M_PI) * cutoff / sampleRate; const float omega = 2.0f * float(pi_number) * cutoff / sampleRate;
const float sn = std::sin(omega); const float sn = std::sin(omega);
const float cs = std::cos(omega); const float cs = std::cos(omega);
const float S = 1.0f; // shelf slope (1.0 is a typical choice) const float S = 1.0f; // shelf slope (1.0 is a typical choice)
@ -33,7 +33,7 @@ void Biquad::setLowShelf(float gainDB, float cutoff, float sampleRate) {
void Biquad::setHighShelf(float gainDB, float cutoff, float sampleRate) { void Biquad::setHighShelf(float gainDB, float cutoff, float sampleRate) {
const float A = std::pow(10.0f, gainDB / 40.0f); const float A = std::pow(10.0f, gainDB / 40.0f);
const float omega = 2.0f * float(M_PI) * cutoff / sampleRate; const float omega = 2.0f * float(pi_number) * cutoff / sampleRate;
const float sn = std::sin(omega); const float sn = std::sin(omega);
const float cs = std::cos(omega); const float cs = std::cos(omega);
const float S = 1.0f; // shelf slope const float S = 1.0f; // shelf slope

View file

@ -14,7 +14,7 @@ public:
void setHighShelf(float gainDB, float cutoff, float sampleRate); void setHighShelf(float gainDB, float cutoff, float sampleRate);
// Process a single sample (Direct Form II Transposed) // Process a single sample (Direct Form II Transposed)
inline float process(float in); float process(float in);
// (Optional) Reset the filter state (e.g. when starting a new buffer) // (Optional) Reset the filter state (e.g. when starting a new buffer)
void reset(); void reset();