annotate dsp/tonal/TCSgram.cpp @ 515:08bcc06c38ec tip master

Remove fast-math
author Chris Cannam <cannam@all-day-breakfast.com>
date Tue, 28 Jan 2020 15:27:37 +0000
parents cbe668c7d724
children
rev   line source
c@225 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
c@225 2
c@225 3 /*
c@225 4 QM DSP Library
c@225 5
c@225 6 Centre for Digital Music, Queen Mary, University of London.
c@225 7 This file copyright 2006 Martin Gasser.
c@309 8
c@309 9 This program is free software; you can redistribute it and/or
c@309 10 modify it under the terms of the GNU General Public License as
c@309 11 published by the Free Software Foundation; either version 2 of the
c@309 12 License, or (at your option) any later version. See the file
c@309 13 COPYING included with this distribution for more information.
c@225 14 */
c@225 15
c@225 16 #include "TCSgram.h"
c@225 17
c@225 18 #include <valarray>
c@225 19 #include <cmath>
c@225 20 #include <iostream>
c@225 21 #include <limits>
c@225 22
c@241 23 #include "maths/MathUtilities.h"
c@225 24
c@225 25 TCSGram::TCSGram() :
cannam@482 26 m_uNumBins(6)
c@225 27 {
c@225 28 }
c@225 29
c@225 30 TCSGram::~TCSGram()
c@225 31 {
c@225 32 }
c@225 33
c@225 34
c@225 35 void TCSGram::getTCSVector(int iPosition, TCSVector& rTCSVector) const
c@225 36 {
cannam@482 37 if (iPosition < 0) {
cannam@482 38 rTCSVector = TCSVector();
cannam@482 39 } else if (iPosition >= int(m_VectorList.size())) {
cannam@482 40 rTCSVector = TCSVector();
cannam@482 41 } else {
cannam@482 42 rTCSVector = m_VectorList[iPosition].second;
cannam@482 43 }
c@225 44 }
c@225 45
c@225 46 long TCSGram::getTime(size_t uPosition) const
c@225 47 {
cannam@482 48 return m_VectorList[uPosition].first;
c@225 49 }
c@225 50
c@225 51
c@225 52 void TCSGram::addTCSVector(const TCSVector& rTCSVector)
c@225 53 {
cannam@482 54 size_t uSize = m_VectorList.size();
cannam@482 55 long lMilliSeconds = static_cast<long>(uSize*m_dFrameDurationMS);
cannam@482 56 std::pair<long, TCSVector> p;
cannam@482 57 p.first = lMilliSeconds;
cannam@482 58 p.second = rTCSVector;
cannam@482 59
cannam@482 60 m_VectorList.push_back(p);
c@225 61 }
c@225 62
c@225 63 long TCSGram::getDuration() const
c@225 64 {
cannam@482 65 size_t uSize = m_VectorList.size();
cannam@482 66 return static_cast<long>(uSize*m_dFrameDurationMS);
c@225 67 }
c@225 68
c@225 69 void TCSGram::printDebug()
c@225 70 {
cannam@482 71 vectorlist_t::iterator vectorIterator = m_VectorList.begin();
cannam@482 72
cannam@482 73 while (vectorIterator != m_VectorList.end()) {
cannam@482 74 vectorIterator->second.printDebug();
cannam@482 75 vectorIterator++;
cannam@482 76 }
c@225 77 }