diff options
author | David Robillard <d@drobilla.net> | 2010-02-22 21:34:05 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2010-02-22 21:34:05 +0000 |
commit | d5b12c38851c53791d95c212baffb091f802c10a (patch) | |
tree | af2d86a616065c064d9b484ac1365979f266737a /src/mdaDetune.cpp | |
parent | 23d245ab8840d5518a691835e243eba705a6838b (diff) | |
download | mda.lv2-d5b12c38851c53791d95c212baffb091f802c10a.tar.gz mda.lv2-d5b12c38851c53791d95c212baffb091f802c10a.tar.bz2 mda.lv2-d5b12c38851c53791d95c212baffb091f802c10a.zip |
Merge with upstream r9.
git-svn-id: http://svn.drobilla.net/lad/trunk/mda-lv2@2475 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/mdaDetune.cpp')
-rw-r--r-- | src/mdaDetune.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/mdaDetune.cpp b/src/mdaDetune.cpp index 8fe7704..925d401 100644 --- a/src/mdaDetune.cpp +++ b/src/mdaDetune.cpp @@ -78,6 +78,29 @@ void mdaDetune::setProgram(LvzInt32 program) if ((unsigned int)program < NPROGS) { curProgram = program; + + // update + float * param = programs[curProgram].param; + semi = 3.0f * param[0] * param[0] * param[0]; + dpos2 = (float)pow(1.0594631f, semi); + dpos1 = 1.0f / dpos2; + + wet = (float)pow(10.0f, 2.0f * param[2] - 1.0f); + dry = wet - wet * param[1] * param[1]; + wet = (wet + wet - wet * param[1]) * param[1]; + + LvzInt32 tmp = 1 << (8 + (LvzInt32)(4.9f * param[3])); + + if(tmp!=buflen) //recalculate crossfade window + { + buflen = tmp; + if (buflen > BUFMAX) buflen = BUFMAX; + bufres = 1000.0f * (float)buflen / getSampleRate(); + + LvzInt32 i; //hanning half-overlap-and-add + double p=0.0, dp=6.28318530718/buflen; + for(i=0;i<buflen;i++) { win[i] = (float)(0.5 - 0.5 * cos(p)); p+=dp; } + } } } |