diff options
author | David Robillard <d@drobilla.net> | 2012-10-27 19:25:22 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-10-27 19:25:22 +0000 |
commit | 25b23d1df7083694d2a29ff585231a646f379c96 (patch) | |
tree | 22e0aca6060930ef969fbe28ceb4fd224c0dd14f /src | |
parent | bd8739571d2594bb2223a5e00483627e3209b55a (diff) | |
download | fomp.lv2-25b23d1df7083694d2a29ff585231a646f379c96.tar.gz fomp.lv2-25b23d1df7083694d2a29ff585231a646f379c96.tar.bz2 fomp.lv2-25b23d1df7083694d2a29ff585231a646f379c96.zip |
Convert absolute frequency ports to use Hz.
git-svn-id: http://svn.drobilla.net/lad/trunk/plugins/fomp.lv2@4805 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r-- | src/blvco.cc | 8 | ||||
-rw-r--r-- | src/mvchpf24.cc | 5 | ||||
-rw-r--r-- | src/mvclpf24.cc | 11 |
3 files changed, 16 insertions, 8 deletions
diff --git a/src/blvco.cc b/src/blvco.cc index 8f1c65c..328f4b0 100644 --- a/src/blvco.cc +++ b/src/blvco.cc @@ -44,6 +44,8 @@ static float _pulse [] = }; +static const float lg2midc = log2f(261.63f); + void Ladspa_VCO_pulse1::setport (PortIndex port, PortData *data) { @@ -86,7 +88,7 @@ void Ladspa_VCO_pulse1::runproc (SampleCount len, bool add) linm += n; len -= n; - t = (exp2ap (*freq + _port[OCTN][0] + _port[TUNE][0] + *expm * _port[EXPG][0] + 8.03136) + t = (exp2ap (log2f(*freq) - lg2midc + _port[OCTN][0] + _port[TUNE][0] + *expm * _port[EXPG][0] + 8.03136) + 1e3 * *linm * _port[LING][0]) / _fsam; if (t < 1e-5) t = 1e-5; if (t > 0.5) t = 0.5; @@ -176,7 +178,7 @@ void Ladspa_VCO_saw1::runproc (SampleCount len, bool add) linm += n; len -= n; - t = (exp2ap (*freq + _port[OCTN][0] + _port[TUNE][0] + *expm * _port[EXPG][0] + 8.03136 + d) + t = (exp2ap (log2f(*freq) - lg2midc + _port[OCTN][0] + _port[TUNE][0] + *expm * _port[EXPG][0] + 8.03136 + d) + 1e3 * *linm * _port[LING][0]) / _fsam; if (t < 1e-5) t = 1e-5; if (t > 0.5) t = 0.5; @@ -276,7 +278,7 @@ void Ladspa_VCO_rec1::runproc (SampleCount len, bool add) wavm += n; len -= n; - t = (exp2ap (*freq + _port[OCTN][0] + _port[TUNE][0] + *expm * _port[EXPG][0] + 8.03136 + d) + t = (exp2ap (log2f(*freq) - lg2midc + _port[OCTN][0] + _port[TUNE][0] + *expm * _port[EXPG][0] + 8.03136 + d) + 1e3 * *linm * _port[LING][0]) / _fsam; if (t < 1e-5) t = 1e-5; if (t > 0.5) t = 0.5; diff --git a/src/mvchpf24.cc b/src/mvchpf24.cc index d63155b..96d3097 100644 --- a/src/mvchpf24.cc +++ b/src/mvchpf24.cc @@ -23,6 +23,9 @@ #include "exp2ap.h" +static const float lg2midc = log2f(261.63f); + + void Ladspa_Mvchpf1::setport (PortIndex port, PortData *data) { _port [port] = (float*)data; @@ -65,7 +68,7 @@ void Ladspa_Mvchpf1::runproc (SampleCount len, bool add) p3 += k; len -= k; - t = _fsam / exp2ap (_port [CFMOD][0] * *p3 + *p2 + _port [CFREQ][0] + 9.2f); + t = _fsam / exp2ap (_port [CFMOD][0] * *p3 + *p2 + log2f(_port [CFREQ][0]) - lg2midc + 9.2f); if (t < 2) t = 2; dw = (t - w) / k; diff --git a/src/mvclpf24.cc b/src/mvclpf24.cc index ae0a287..357fd7c 100644 --- a/src/mvclpf24.cc +++ b/src/mvclpf24.cc @@ -23,6 +23,9 @@ #include "exp2ap.h" +static const float lg2midc = log2f(261.63f); + + void Ladspa_Moogvcf1::setport (PortIndex port, PortData *data) { _port [port] = (float*)data; @@ -67,7 +70,7 @@ void Ladspa_Moogvcf1::runproc (SampleCount len, bool add) p4 += k; len -= k; - t = exp2ap (_port [C_FMODG][0] * *p3 + _port [C_FREQ][0] + *p2 + 10.82f) / _fsam; + t = exp2ap (_port [C_FMODG][0] * *p3 + log2f(_port [C_FREQ][0]) - lg2midc + *p2 + 10.82f) / _fsam; if (t < 0.8f) t *= 1 - 0.4f * t - 0.125f * t * t; else { @@ -154,7 +157,7 @@ void Ladspa_Moogvcf2::runproc (SampleCount len, bool add) p4 += k; len -= k; - t = exp2ap (_port [C_FMODG][0] * *p3 + _port [C_FREQ][0] + *p2 + 10.71f) / _fsam; + t = exp2ap (_port [C_FMODG][0] * *p3 + log2f(_port [C_FREQ][0]) - lg2midc + *p2 + 10.71f) / _fsam; if (t < 0.8f) t *= 1 - 0.4f * t - 0.125f * t * t; else { @@ -243,7 +246,7 @@ void Ladspa_Moogvcf3::runproc (SampleCount len, bool add) p4 += k; len -= k; - t = exp2ap (_port [C_FMODG][0] * *p3 + _port [C_FREQ][0] + *p2 + 9.70f) / _fsam; + t = exp2ap (_port [C_FMODG][0] * *p3 + log2f(_port [C_FREQ][0]) - lg2midc + *p2 + 9.70f) / _fsam; if (t < 0.75f) t *= 1.005f - t * (0.624f - t * (0.65f - t * 0.54f)); else { @@ -357,7 +360,7 @@ void Ladspa_Moogvcf4::runproc (SampleCount len, bool add) p4 += k; len -= k; - t = exp2ap (_port [C_FMODG][0] * *p3 + _port [C_FREQ][0] + *p2 + 9.70f) / _fsam; + t = exp2ap (_port [C_FMODG][0] * *p3 + log2f(_port [C_FREQ][0]) - lg2midc + *p2 + 9.70f) / _fsam; if (t < 0.75f) t *= 1.005f - t * (0.624f - t * (0.65f - t * 0.54f)); else { |