summaryrefslogtreecommitdiff
path: root/libs/plugins
diff options
context:
space:
mode:
authorDamien Zammit <damien@zamaudio.com>2016-07-15 01:53:32 +1000
committerDamien Zammit <damien@zamaudio.com>2016-07-15 01:54:50 +1000
commitfdfff818509cb8e7b7753cf40336cb3d112b4e7c (patch)
treef0d15703f5890bfc114091535c0fc7a6386815fd /libs/plugins
parentd8a97789c10c8fb264b5c31ed1334471bbda1772 (diff)
a-EQ: Remove LPF/HPF completely from this plugin
Diffstat (limited to 'libs/plugins')
-rw-r--r--libs/plugins/a-eq.lv2/a-eq.c130
-rw-r--r--libs/plugins/a-eq.lv2/a-eq.ttl.in72
2 files changed, 32 insertions, 170 deletions
diff --git a/libs/plugins/a-eq.lv2/a-eq.c b/libs/plugins/a-eq.lv2/a-eq.c
index 8083d4742d..380e1ba3e5 100644
--- a/libs/plugins/a-eq.lv2/a-eq.c
+++ b/libs/plugins/a-eq.lv2/a-eq.c
@@ -39,8 +39,7 @@
#endif
typedef enum {
- AEQ_SHELFTOGL = 0,
- AEQ_FREQL,
+ AEQ_FREQL = 0,
AEQ_GAINL,
AEQ_FREQ1,
AEQ_GAIN1,
@@ -54,7 +53,6 @@ typedef enum {
AEQ_FREQ4,
AEQ_GAIN4,
AEQ_BW4,
- AEQ_SHELFTOGH,
AEQ_FREQH,
AEQ_GAINH,
AEQ_MASTER,
@@ -96,8 +94,6 @@ static void linear_svf_reset(struct linear_svf *self)
}
typedef struct {
- float* shelftogl;
- float* shelftogh;
float* f0[BANDS];
float* g[BANDS];
float* bw[BANDS];
@@ -114,8 +110,6 @@ typedef struct {
float v_bw[BANDS];
float v_f0[BANDS];
float v_filtog[BANDS];
- float v_shelftogl;
- float v_shelftogh;
float v_master;
bool need_expose;
@@ -164,9 +158,6 @@ connect_port(LV2_Handle instance,
Aeq* aeq = (Aeq*)instance;
switch ((PortIndex)port) {
- case AEQ_SHELFTOGL:
- aeq->shelftogl = (float*)data;
- break;
case AEQ_FREQL:
aeq->f0[0] = (float*)data;
break;
@@ -209,9 +200,6 @@ connect_port(LV2_Handle instance,
case AEQ_BW4:
aeq->bw[4] = (float*)data;
break;
- case AEQ_SHELFTOGH:
- aeq->shelftogh = (float*)data;
- break;
case AEQ_FREQH:
aeq->f0[5] = (float*)data;
break;
@@ -261,42 +249,6 @@ activate(LV2_Handle instance)
// SVF filters
// http://www.cytomic.com/files/dsp/SvfLinearTrapOptimised2.pdf
-static void linear_svf_set_hp(struct linear_svf *self, float sample_rate, float cutoff, float resonance)
-{
- double f0 = (double)cutoff;
- double q = (double)resonance;
- double sr = (double)sample_rate;
-
- self->g = tan(M_PI * (f0 / sr));
- self->k = 1.0 / q;
-
- self->a[0] = 1.0 / (1.0 + self->g * (self->g + self->k));
- self->a[1] = self->g * self->a[0];
- self->a[2] = self->g * self->a[1];
-
- self->m[0] = 1.0;
- self->m[1] = -self->k;
- self->m[2] = -1.0;
-}
-
-static void linear_svf_set_lp(struct linear_svf *self, float sample_rate, float cutoff, float resonance)
-{
- double f0 = (double)cutoff;
- double q = (double)resonance;
- double sr = (double)sample_rate;
-
- self->g = tan(M_PI * (f0 / sr));
- self->k = 1.0 / q;
-
- self->a[0] = 1.0 / (1.0 + self->g * (self->g + self->k));
- self->a[1] = self->g * self->a[0];
- self->a[2] = self->g * self->a[1];
-
- self->m[0] = 0.0;
- self->m[1] = 0.0;
- self->m[2] = 1.0;
-}
-
static void linear_svf_set_peq(struct linear_svf *self, float gdb, float sample_rate, float cutoff, float bandwidth)
{
double f0 = (double)cutoff;
@@ -379,11 +331,7 @@ static void set_params(LV2_Handle instance, int band) {
switch (band) {
case 0:
- if (aeq->v_shelftogl > 0.5) {
- linear_svf_set_lowshelf(&aeq->v_filter[0], aeq->v_g[0], aeq->srate, aeq->v_f0[0], 0.7071068);
- } else {
- linear_svf_set_hp(&aeq->v_filter[0], aeq->srate, aeq->v_f0[0], 0.7071068);
- }
+ linear_svf_set_lowshelf(&aeq->v_filter[0], aeq->v_g[0], aeq->srate, aeq->v_f0[0], 0.7071068);
break;
case 1:
case 2:
@@ -392,11 +340,7 @@ static void set_params(LV2_Handle instance, int band) {
linear_svf_set_peq(&aeq->v_filter[band], aeq->v_g[band], aeq->srate, aeq->v_f0[band], aeq->v_bw[band]);
break;
case 5:
- if (aeq->v_shelftogh > 0.5) {
- linear_svf_set_highshelf(&aeq->v_filter[5], aeq->v_g[5], aeq->srate, aeq->v_f0[5], 0.7071068);
- } else {
- linear_svf_set_lp(&aeq->v_filter[5], aeq->srate, aeq->v_f0[5], 0.7071068);
- }
+ linear_svf_set_highshelf(&aeq->v_filter[5], aeq->v_g[5], aeq->srate, aeq->v_f0[5], 0.7071068);
break;
}
}
@@ -447,14 +391,6 @@ run(LV2_Handle instance, uint32_t n_samples)
aeq->v_bw[i] += tau * (*aeq->bw[i] - aeq->v_bw[i]);
aeq->need_expose = true;
}
- if (!is_eq(aeq->v_shelftogl, *aeq->shelftogl)) {
- aeq->v_shelftogl = *(aeq->shelftogl);
- aeq->need_expose = true;
- }
- if (!is_eq(aeq->v_shelftogh, *aeq->shelftogh)) {
- aeq->v_shelftogh = *(aeq->shelftogh);
- aeq->need_expose = true;
- }
if (!is_eq(aeq->v_master, *aeq->master)) {
aeq->v_master = *(aeq->master);
aeq->need_expose = true;
@@ -491,38 +427,6 @@ calc_peq(Aeq* self, int i, double omega) {
}
static double
-calc_lowpass(Aeq* self, double omega) {
- double complex H = 0.0;
- double complex z = cexp(I * omega);
- double complex zz = cexp(2. * I * omega);
- double complex zm = z - 1.0;
- double complex zp = z + 1.0;
- double complex zzm = zz - 1.0;
-
- double g = self->v_filter[5].g;
- double k = self->v_filter[5].k;
-
- H = (g*g*zp*zp) / (zm*zm + g*g*zp*zp + g*k*zzm);
- return cabs(H);
-}
-
-static double
-calc_highpass(Aeq* self, double omega) {
- double complex H = 0.0;
- double complex z = cexp(I * omega);
- double complex zz = cexp(2. * I * omega);
- double complex zm = z - 1.0;
- double complex zp = z + 1.0;
- double complex zzm = zz - 1.0;
-
- double g = self->v_filter[0].g;
- double k = self->v_filter[0].k;
-
- H = zm*zm / (zm*zm + g*g*zp*zp + g*k*zzm);
- return cabs(H);
-}
-
-static double
calc_lowshelf(Aeq* self, double omega) {
double complex H = 0.0;
double complex z = cexp(I * omega);
@@ -569,35 +473,17 @@ eq_curve (Aeq* self, float f) {
double SR = (double)self->srate;
double omega = f * 2. * M_PI / SR;
- // low
- if (self->v_shelftogl) {
- // lowshelf
- response *= calc_lowshelf(self, omega);
- } else {
- // hp:
- response *= calc_highpass(self, omega);
- }
+ // lowshelf
+ response *= calc_lowshelf(self, omega);
- // peq1:
+ // peq 1 - 4:
response *= calc_peq(self, 1, omega);
-
- // peq2:
response *= calc_peq(self, 2, omega);
-
- // peq3:
response *= calc_peq(self, 3, omega);
-
- // peq4:
response *= calc_peq(self, 4, omega);
- // high
- if (self->v_shelftogh) {
- // highshelf:
- response *= calc_highshelf(self, omega);
- } else {
- // lp:
- response *= calc_lowpass(self, omega);
- }
+ // highshelf:
+ response *= calc_highshelf(self, omega);
return (float)response;
}
diff --git a/libs/plugins/a-eq.lv2/a-eq.ttl.in b/libs/plugins/a-eq.lv2/a-eq.ttl.in
index b7b4f50452..43656f9630 100644
--- a/libs/plugins/a-eq.lv2/a-eq.ttl.in
+++ b/libs/plugins/a-eq.lv2/a-eq.ttl.in
@@ -32,18 +32,6 @@ unit:hz0
lv2:port [
a lv2:InputPort, lv2:ControlPort ;
lv2:index 0 ;
- lv2:name "Shelf L" ;
- lv2:symbol "shelftogl" ;
- lv2:default 1.000000 ;
- lv2:minimum 0.000000 ;
- lv2:maximum 1.000000 ;
- lv2:portProperty lv2:toggled ;
- lv2:portProperty <http://lv2plug.in/ns/ext/port-props#causesArtifacts> ;
- lv2:portProperty <http://lv2plug.in/ns/ext/port-props#notAutomatic> ;
- ],
- [
- a lv2:InputPort, lv2:ControlPort ;
- lv2:index 1 ;
lv2:name "Frequency L" ;
lv2:symbol "freql" ;
lv2:default 160.000000 ;
@@ -54,7 +42,7 @@ unit:hz0
],
[
a lv2:InputPort, lv2:ControlPort ;
- lv2:index 2 ;
+ lv2:index 1 ;
lv2:name "Gain L" ;
lv2:symbol "gl" ;
lv2:default 0.000000 ;
@@ -64,7 +52,7 @@ unit:hz0
],
[
a lv2:InputPort, lv2:ControlPort ;
- lv2:index 3 ;
+ lv2:index 2 ;
lv2:name "Frequency 1" ;
lv2:symbol "freq1" ;
lv2:default 300.000000 ;
@@ -75,7 +63,7 @@ unit:hz0
],
[
a lv2:InputPort, lv2:ControlPort ;
- lv2:index 4 ;
+ lv2:index 3 ;
lv2:name "Gain 1" ;
lv2:symbol "g1" ;
lv2:default 0.000000 ;
@@ -85,7 +73,7 @@ unit:hz0
],
[
a lv2:InputPort, lv2:ControlPort ;
- lv2:index 5 ;
+ lv2:index 4 ;
lv2:name "Bandwidth 1" ;
lv2:symbol "bw1" ;
lv2:default 1.000000 ;
@@ -95,7 +83,7 @@ unit:hz0
],
[
a lv2:InputPort, lv2:ControlPort ;
- lv2:index 6 ;
+ lv2:index 5 ;
lv2:name "Frequency 2" ;
lv2:symbol "freq2" ;
lv2:default 1000.000000 ;
@@ -106,7 +94,7 @@ unit:hz0
],
[
a lv2:InputPort, lv2:ControlPort ;
- lv2:index 7 ;
+ lv2:index 6 ;
lv2:name "Gain 2" ;
lv2:symbol "g2" ;
lv2:default 0.000000 ;
@@ -116,7 +104,7 @@ unit:hz0
],
[
a lv2:InputPort, lv2:ControlPort ;
- lv2:index 8 ;
+ lv2:index 7 ;
lv2:name "Bandwidth 2" ;
lv2:symbol "bw2" ;
lv2:default 1.000000 ;
@@ -126,7 +114,7 @@ unit:hz0
],
[
a lv2:InputPort, lv2:ControlPort ;
- lv2:index 9 ;
+ lv2:index 8 ;
lv2:name "Frequency 3" ;
lv2:symbol "freq3" ;
lv2:default 2500.000000 ;
@@ -137,7 +125,7 @@ unit:hz0
],
[
a lv2:InputPort, lv2:ControlPort ;
- lv2:index 10 ;
+ lv2:index 9 ;
lv2:name "Gain 3" ;
lv2:symbol "g3" ;
lv2:default 0.000000 ;
@@ -147,7 +135,7 @@ unit:hz0
],
[
a lv2:InputPort, lv2:ControlPort ;
- lv2:index 11 ;
+ lv2:index 10 ;
lv2:name "Bandwidth 3" ;
lv2:symbol "bw3" ;
lv2:default 1.000000 ;
@@ -157,7 +145,7 @@ unit:hz0
],
[
a lv2:InputPort, lv2:ControlPort ;
- lv2:index 12 ;
+ lv2:index 11 ;
lv2:name "Frequency 4" ;
lv2:symbol "freq4" ;
lv2:default 6000.000000 ;
@@ -168,7 +156,7 @@ unit:hz0
],
[
a lv2:InputPort, lv2:ControlPort ;
- lv2:index 13 ;
+ lv2:index 12 ;
lv2:name "Gain 4" ;
lv2:symbol "g4" ;
lv2:default 0.000000 ;
@@ -178,7 +166,7 @@ unit:hz0
],
[
a lv2:InputPort, lv2:ControlPort ;
- lv2:index 14 ;
+ lv2:index 13 ;
lv2:name "Bandwidth 4" ;
lv2:symbol "bw4" ;
lv2:default 1.000000 ;
@@ -188,19 +176,7 @@ unit:hz0
],
[
a lv2:InputPort, lv2:ControlPort ;
- lv2:index 15 ;
- lv2:name "Shelf H" ;
- lv2:symbol "shelftogh" ;
- lv2:default 1.000000 ;
- lv2:minimum 0.000000 ;
- lv2:maximum 1.000000 ;
- lv2:portProperty lv2:toggled ;
- lv2:portProperty <http://lv2plug.in/ns/ext/port-props#causesArtifacts> ;
- lv2:portProperty <http://lv2plug.in/ns/ext/port-props#notAutomatic> ;
- ],
- [
- a lv2:InputPort, lv2:ControlPort ;
- lv2:index 16 ;
+ lv2:index 14 ;
lv2:name "Frequency H" ;
lv2:symbol "freqh" ;
lv2:default 9000.000000 ;
@@ -211,7 +187,7 @@ unit:hz0
],
[
a lv2:InputPort, lv2:ControlPort ;
- lv2:index 17 ;
+ lv2:index 15 ;
lv2:name "Gain H" ;
lv2:symbol "gh" ;
lv2:default 0.000000 ;
@@ -221,7 +197,7 @@ unit:hz0
],
[
a lv2:InputPort, lv2:ControlPort ;
- lv2:index 18 ;
+ lv2:index 16 ;
lv2:name "Master Gain" ;
lv2:symbol "master" ;
lv2:default 0.000000 ;
@@ -230,7 +206,7 @@ unit:hz0
],
[
a lv2:InputPort, lv2:ControlPort ;
- lv2:index 19 ;
+ lv2:index 17 ;
lv2:name "Filter L" ;
lv2:symbol "filtogl" ;
lv2:default 1.000000 ;
@@ -240,7 +216,7 @@ unit:hz0
],
[
a lv2:InputPort, lv2:ControlPort ;
- lv2:index 20 ;
+ lv2:index 18 ;
lv2:name "Filter 1" ;
lv2:symbol "filtog1" ;
lv2:default 1.000000 ;
@@ -250,7 +226,7 @@ unit:hz0
],
[
a lv2:InputPort, lv2:ControlPort ;
- lv2:index 21 ;
+ lv2:index 19 ;
lv2:name "Filter 2" ;
lv2:symbol "filtog2" ;
lv2:default 1.000000 ;
@@ -260,7 +236,7 @@ unit:hz0
],
[
a lv2:InputPort, lv2:ControlPort ;
- lv2:index 22 ;
+ lv2:index 20 ;
lv2:name "Filter 3" ;
lv2:symbol "filtog3" ;
lv2:default 1.000000 ;
@@ -270,7 +246,7 @@ unit:hz0
],
[
a lv2:InputPort, lv2:ControlPort ;
- lv2:index 23 ;
+ lv2:index 21 ;
lv2:name "Filter 4" ;
lv2:symbol "filtog4" ;
lv2:default 1.000000 ;
@@ -280,7 +256,7 @@ unit:hz0
],
[
a lv2:InputPort, lv2:ControlPort ;
- lv2:index 24 ;
+ lv2:index 22 ;
lv2:name "Filter H" ;
lv2:symbol "filtogh" ;
lv2:default 1.000000 ;
@@ -291,14 +267,14 @@ unit:hz0
lv2:port [
a lv2:InputPort, lv2:AudioPort ;
- lv2:index 25 ;
+ lv2:index 23 ;
lv2:symbol "in_1" ;
lv2:name "Audio Input 1" ;
] ;
lv2:port [
a lv2:OutputPort, lv2:AudioPort ;
- lv2:index 26 ;
+ lv2:index 24 ;
lv2:symbol "out_1" ;
lv2:name "Audio Output 1" ;
] ;