83e8c93f8ba560993bab87c3224eff5fc16f3092
[ardour.git] / libs / qm-dsp / dsp / tonal / TCSgram.h
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
2
3 /*
4     QM DSP Library
5
6     Centre for Digital Music, Queen Mary, University of London.
7     This file copyright 2006 Martin Gasser.
8
9     This program is free software; you can redistribute it and/or
10     modify it under the terms of the GNU General Public License as
11     published by the Free Software Foundation; either version 2 of the
12     License, or (at your option) any later version.  See the file
13     COPYING included with this distribution for more information.
14 */
15
16 #ifndef _TCSGram_
17 #define _TCSGram_
18
19 #include <vector>
20 #include <valarray>
21 #include <utility>
22
23 #include "TonalEstimator.h"
24
25 typedef std::vector<std::pair<long, TCSVector> > vectorlist_t;
26
27 class TCSGram
28 {
29 public: 
30         TCSGram();
31         ~TCSGram();
32         void getTCSVector(int, TCSVector&) const;
33         void addTCSVector(const TCSVector&);
34         long getTime(size_t) const;
35         long getDuration() const;
36         void printDebug();
37         int getSize() const { return m_VectorList.size(); }
38         void reserve(size_t uSize) { m_VectorList.reserve(uSize); }
39         void clear() { m_VectorList.clear(); }
40         void setFrameDuration(const double dFrameDurationMS) { m_dFrameDurationMS = dFrameDurationMS; }
41         void setNumBins(const unsigned int uNumBins) { m_uNumBins = uNumBins; }
42         void normalize();
43 protected:
44         vectorlist_t m_VectorList;
45         unsigned int m_uNumBins;
46         double m_dFrameDurationMS;
47 };
48
49 #endif