qm-dsp
1.8
|
00001 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ 00002 00003 /* 00004 QM DSP Library 00005 00006 Centre for Digital Music, Queen Mary, University of London. 00007 This file copyright 2006 Martin Gasser. 00008 00009 This program is free software; you can redistribute it and/or 00010 modify it under the terms of the GNU General Public License as 00011 published by the Free Software Foundation; either version 2 of the 00012 License, or (at your option) any later version. See the file 00013 COPYING included with this distribution for more information. 00014 */ 00015 00016 #ifndef _TCSGram_ 00017 #define _TCSGram_ 00018 00019 #include <vector> 00020 #include <valarray> 00021 #include <utility> 00022 00023 #include "TonalEstimator.h" 00024 00025 typedef std::vector<std::pair<long, TCSVector> > vectorlist_t; 00026 00027 class TCSGram 00028 { 00029 public: 00030 TCSGram(); 00031 ~TCSGram(); 00032 void getTCSVector(int, TCSVector&) const; 00033 void addTCSVector(const TCSVector&); 00034 long getTime(size_t) const; 00035 long getDuration() const; 00036 void printDebug(); 00037 int getSize() const { return m_VectorList.size(); } 00038 void reserve(size_t uSize) { m_VectorList.reserve(uSize); } 00039 void clear() { m_VectorList.clear(); } 00040 void setFrameDuration(const double dFrameDurationMS) { m_dFrameDurationMS = dFrameDurationMS; } 00041 void setNumBins(const unsigned int uNumBins) { m_uNumBins = uNumBins; } 00042 void normalize(); 00043 protected: 00044 vectorlist_t m_VectorList; 00045 unsigned int m_uNumBins; 00046 double m_dFrameDurationMS; 00047 }; 00048 00049 #endif