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/blvco.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/blvco.cc')
-rw-r--r-- | src/blvco.cc | 8 |
1 files changed, 5 insertions, 3 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; |