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/mvclpf24.cc | |
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/mvclpf24.cc')
-rw-r--r-- | src/mvclpf24.cc | 11 |
1 files changed, 7 insertions, 4 deletions
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 { |