small fixes

This commit is contained in:
Martmists 2021-07-28 18:22:50 +02:00
parent 7898ffef45
commit 7fabac795e
2 changed files with 7 additions and 7 deletions

View File

@ -14,25 +14,25 @@ DynamicBass::DynamicBass() {
this->lowFreqX = 120; this->lowFreqX = 120;
this->highFreqX = 80; this->highFreqX = 80;
this->lowFreqY = 40; this->lowFreqY = 40;
this->highFreqY = this->samplerate / 4.f; this->highFreqY = (float)this->samplerate / 4.f;
this->filterX.SetPassFilter(this->lowFreqX, this->highFreqX); this->filterX.SetPassFilter(this->lowFreqX, this->highFreqX);
this->filterY.SetPassFilter(this->lowFreqY, this->highFreqY); this->filterY.SetPassFilter(this->lowFreqY, this->highFreqY);
this->lowPass.SetLowPassParameter(55.f, this->samplerate, this->qPeak / 666.f + 0.5f) this->lowPass.SetLowPassParameter(55.f, this->samplerate, this->qPeak / 666.f + 0.5f);
} }
void DynamicBass::Reset() { void DynamicBass::Reset() {
this->filterX.Reset(); this->filterX.Reset();
this->filterY.Reset(); this->filterY.Reset();
this->lowPass.SetLowPassParameter(55.f, this->samplerate, this->qPeak / 666.f + 0.5f) this->lowPass.SetLowPassParameter(55.f, this->samplerate, this->qPeak / 666.f + 0.5f);
} }
void DynamicBass::FilterSamples(float *samples, uint32_t size) { void DynamicBass::FilterSamples(float *samples, uint32_t size) {
if (this->lowFreqX <= 120) { if (this->lowFreqX <= 120) {
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
int left = samples[2*i]; float left = samples[2*i];
int right = samples[2*i+1]; float right = samples[2*i+1];
int avg = this->lowPass.ProcessSample(left + right); float avg = this->lowPass.ProcessSample(left + right);
samples[2*i] = left + avg; samples[2*i] = left + avg;
samples[2*i+1] = right + avg; samples[2*i+1] = right + avg;
} }

View File

@ -23,7 +23,7 @@ public:
uint32_t lowFreqX, highFreqX; uint32_t lowFreqX, highFreqX;
uint32_t lowFreqY, highFreqY; uint32_t lowFreqY, highFreqY;
uint32_t samplerate; uint32_t samplerate;
uint32_t qPeak; float qPeak;
float bassGain; float bassGain;
float sideGainX, sideGainY; float sideGainX, sideGainY;