Mercurial > hg > match-vamp
changeset 7:b3ec48d9cd2e
* Fixes from Solaris build
author | cannam |
---|---|
date | Fri, 25 Sep 2009 15:21:22 +0000 |
parents | 80fae79c9472 |
children | be38b27374a2 |
files | Matcher.cpp Matcher.h |
diffstat | 2 files changed, 12 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/Matcher.cpp Mon Mar 23 19:47:01 2009 +0000 +++ b/Matcher.cpp Fri Sep 25 15:21:22 2009 +0000 @@ -23,6 +23,10 @@ bool Matcher::silent = true; +const double Matcher::decay = 0.99; +const double Matcher::silenceThreshold = 0.0004; +const int Matcher::MAX_RUN_COUNT = 3; + Matcher::Matcher(float rate, Matcher *p) { std::cerr << "Matcher::Matcher(" << rate << ", " << p << ")" << std::endl; @@ -51,7 +55,7 @@ maxFrames = 0; // stop at EOF hopSize = lrint(sampleRate * hopTime); - fftSize = lrint(pow(2, lrint(log(fftTime * sampleRate) / log(2)))); + fftSize = lrint(pow(2.0, (int)lrint(log(fftTime * sampleRate) / log(2.0)))); blockSize = lrint(blockTime / hopTime); distance = 0; @@ -174,8 +178,8 @@ { double binWidth = sampleRate / fftSize; int crossoverBin = (int)(2 / (pow(2, 1/12.0) - 1)); - int crossoverMidi = lrint(log(crossoverBin*binWidth/440)/ - log(2) * 12 + 69); + int crossoverMidi = lrint(log(crossoverBin*binWidth/440.0)/ + log(2.0) * 12 + 69); // freq = 440 * Math.pow(2, (midi-69)/12.0) / binWidth; int i = 0; while (i <= crossoverBin) { @@ -183,7 +187,7 @@ ++i; } while (i <= fftSize/2) { - double midi = log(i*binWidth/440) / log(2) * 12 + 69; + double midi = log(i*binWidth/440.0) / log(2.0) * 12 + 69; if (midi > 127) midi = 127; freqMap[i++] = crossoverBin + lrint(midi) - crossoverMidi; @@ -207,7 +211,7 @@ while (i <= crossoverBin) freqMap[i++] = 0; while (i <= fftSize/2) { - double midi = log(i*binWidth/440) / log(2) * 12 + 69; + double midi = log(i*binWidth/440.0) / log(2.0) * 12 + 69; freqMap[i++] = (lrint(midi)) % 12 + 1; } freqMapSize = 13;
--- a/Matcher.h Mon Mar 23 19:47:01 2009 +0000 +++ b/Matcher.h Fri Sep 25 15:21:22 2009 +0000 @@ -202,9 +202,9 @@ /** Disable or enable debugging output */ static bool silent; - static const double decay = 0.99; - static const double silenceThreshold = 0.0004; - static const int MAX_RUN_COUNT = 3; + static const double decay; + static const double silenceThreshold; + static const int MAX_RUN_COUNT; friend class Finder; //!!!