diff options
Diffstat (limited to 'libs/qm-dsp/dsp/tonal/TonalEstimator.h')
-rw-r--r-- | libs/qm-dsp/dsp/tonal/TonalEstimator.h | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/libs/qm-dsp/dsp/tonal/TonalEstimator.h b/libs/qm-dsp/dsp/tonal/TonalEstimator.h index cfb8bba5b6..f555ef9e3b 100644 --- a/libs/qm-dsp/dsp/tonal/TonalEstimator.h +++ b/libs/qm-dsp/dsp/tonal/TonalEstimator.h @@ -27,24 +27,24 @@ class ChromaVector : public std::valarray<double> public: ChromaVector(size_t uSize = 12) : std::valarray<double>() { resize(uSize, 0.0f); } - + virtual ~ChromaVector() {}; - + void printDebug() { for (int i = 0; i < size(); i++) { std::cout << (*this)[i] << ";"; } - + std::cout << std::endl; } - + void normalizeL1() { // normalize the chroma vector (L1 norm) double dSum = 0.0; - + for (size_t i = 0; i < 12; (dSum += std::abs((*this)[i++]))) ; for (size_t i = 0; i < 12; dSum > 0.0000001?((*this)[i] /= dSum):(*this)[i]=0.0, i++) ; @@ -54,8 +54,8 @@ public: { for (size_t i = 0; i < 12; ++i) (*this)[i] = 0.0; } - - + + }; class TCSVector : public std::valarray<double> @@ -63,7 +63,7 @@ class TCSVector : public std::valarray<double> public: TCSVector() : std::valarray<double>() { resize(6, 0.0f); } - + virtual ~TCSVector() {}; void printDebug() @@ -72,19 +72,19 @@ public: { std::cout << (*this)[i] << ";"; } - + std::cout << std::endl; } - + double magnitude() const { double dMag = 0.0; - + for (size_t i = 0; i < 6; i++) { dMag += std::pow((*this)[i], 2.0); } - + return std::sqrt(dMag); } |