2021-07-28 23:50:34 +02:00
|
|
|
#include <cmath>
|
|
|
|
#include "HighShelf.h"
|
|
|
|
|
|
|
|
float HighShelf::Process(float sample) {
|
2022-08-23 00:26:44 +02:00
|
|
|
float out = sample * this->b0 + this->x_1 * this->b1 + this->x_2 * this->b2 + this->y_1 * this->a1 +
|
|
|
|
this->y_2 * this->a2;
|
2021-07-28 23:50:34 +02:00
|
|
|
this->y_2 = this->y_1;
|
|
|
|
this->y_1 = out;
|
|
|
|
this->x_2 = this->x_1;
|
|
|
|
this->x_1 = sample;
|
|
|
|
return out;
|
|
|
|
}
|
|
|
|
|
|
|
|
void HighShelf::SetFrequency(uint32_t freq) {
|
|
|
|
this->frequency = freq;
|
|
|
|
}
|
|
|
|
|
|
|
|
void HighShelf::SetGain(float gain) {
|
|
|
|
this->gain = 20.f * log10f(gain);
|
|
|
|
}
|
|
|
|
|
|
|
|
void HighShelf::SetQuality(float q) {
|
2021-07-29 17:00:39 +02:00
|
|
|
this->quality = q;
|
2021-07-28 23:50:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void HighShelf::SetSamplingRate(uint32_t samplerate) {
|
2021-10-26 04:36:34 +02:00
|
|
|
this->samplerate = samplerate;
|
2021-07-28 23:50:34 +02:00
|
|
|
}
|