mirror of
https://github.com/AndroidAudioMods/ViPERFX_RE.git
synced 2025-01-03 16:13:35 +08:00
work on HighShelf
This commit is contained in:
parent
5d83c1356c
commit
b7dae6a4b6
@ -32,6 +32,7 @@ set(FILES
|
||||
src/utils/DepthSurround.cpp
|
||||
src/utils/DynamicBass.cpp
|
||||
src/utils/FixedBiquad.cpp
|
||||
src/utils/HighShelf.cpp
|
||||
src/utils/IIR_1st.cpp
|
||||
src/utils/IIR_NOrder_BW_BP.cpp
|
||||
src/utils/IIR_NOrder_BW_LH.cpp
|
||||
|
31
src/utils/HighShelf.cpp
Normal file
31
src/utils/HighShelf.cpp
Normal file
@ -0,0 +1,31 @@
|
||||
//
|
||||
// Created by mart on 7/28/21.
|
||||
//
|
||||
|
||||
#include <cmath>
|
||||
#include "HighShelf.h"
|
||||
|
||||
float HighShelf::Process(float sample) {
|
||||
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;
|
||||
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) {
|
||||
this->quality = q
|
||||
}
|
||||
|
||||
void HighShelf::SetSamplingRate(uint32_t samplerate) {
|
||||
// TODO
|
||||
}
|
25
src/utils/HighShelf.h
Normal file
25
src/utils/HighShelf.h
Normal file
@ -0,0 +1,25 @@
|
||||
//
|
||||
// Created by mart on 7/28/21.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
|
||||
class HighShelf {
|
||||
public:
|
||||
float Process(float sample);
|
||||
|
||||
void SetFrequency(uint32_t freq);
|
||||
void SetGain(float gain);
|
||||
void SetQuality(float q);
|
||||
void SetSamplingRate(uint32_t samplerate);
|
||||
|
||||
uint32_t frequency, samplerate;
|
||||
float quality, gain;
|
||||
|
||||
float y_2, y_1, x_2, x_1;
|
||||
float b0, b1, b2, a1, a2;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user