summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJP Cimalando <jp-dev@inbox.ru>2018-12-06 07:20:14 +0100
committerDamien Zammit <damien@zamaudio.com>2018-12-18 19:46:59 +1100
commit5257b0113d6bb7462380086a7e8e4e2fe89302e8 (patch)
tree23f3fd5e906439095ee42405e381d70d4e793fb2
parent9050e4d40d35e133ffb3f9c5a9ce11f0b69d588c (diff)
ZamEQ31: disable the bands outside of filterable range
-rw-r--r--plugins/ZamGEQ31/ZamGEQ31Plugin.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/plugins/ZamGEQ31/ZamGEQ31Plugin.cpp b/plugins/ZamGEQ31/ZamGEQ31Plugin.cpp
index b6cd816..f8e3958 100644
--- a/plugins/ZamGEQ31/ZamGEQ31Plugin.cpp
+++ b/plugins/ZamGEQ31/ZamGEQ31Plugin.cpp
@@ -518,7 +518,7 @@ void ZamGEQ31Plugin::setParameterValue(uint32_t index, float value)
void ZamGEQ31Plugin::geq(int i, float srate, float g)
{
int mm;
- float w, omegaB, omegaM, glinear, alpham;
+ float w, omegaU, omegaL, omegaB, omegaM, glinear, alpham;
// 2dB tolerance
//const int stack[29] = { 2, 1, 1, 1, 1, 1, 1, 1,
// 1, 1, 1, 1, 1, 1, 1, 1,
@@ -531,9 +531,19 @@ void ZamGEQ31Plugin::geq(int i, float srate, float g)
9, 9, 9, 9, 9, 9, 9, 10,
11, 12, 15, 20, 20 };
+ const float omegaLimit = 0.95 * M_PI;
+
w = 2. * M_PI / srate;
- omegaB = w * (omegaU[i] - omegaL[i]);
- omegaM = 2. * atan(sqrt(tan(w*omegaU[i]/2.) * tan(w*omegaL[i]/2.)));
+ omegaU = w * this->omegaU[i];
+ omegaL = w * this->omegaL[i];
+
+ if (omegaU > omegaLimit) {
+ m[i] = 0;
+ return;
+ }
+
+ omegaB = omegaU - omegaL;
+ omegaM = 2. * atan(sqrt(tan(omegaU/2.) * tan(omegaL/2.)));
glinear = from_dB(g);
m[i] = 2. * stack[i];