qm-dsp 1.8
TCSgram.cpp
Go to the documentation of this file.
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#include "TCSgram.h"
17
18#include <valarray>
19#include <cmath>
20#include <iostream>
21#include <limits>
22
23#include "maths/MathUtilities.h"
24
26 m_uNumBins(6)
27{
28}
29
33
34
35void TCSGram::getTCSVector(int iPosition, TCSVector& rTCSVector) const
36{
37 if (iPosition < 0)
38 rTCSVector = TCSVector();
39 else if (iPosition >= m_VectorList.size())
40 rTCSVector = TCSVector();
41 else
42 rTCSVector = m_VectorList[iPosition].second;
43}
44
45long TCSGram::getTime(size_t uPosition) const
46{
47 return m_VectorList[uPosition].first;
48}
49
50
51void TCSGram::addTCSVector(const TCSVector& rTCSVector)
52{
53 size_t uSize = m_VectorList.size();
54 long lMilliSeconds = static_cast<long>(uSize*m_dFrameDurationMS);
55 std::pair<long, TCSVector> p;
56 p.first = lMilliSeconds;
57 p.second = rTCSVector;
58
59 m_VectorList.push_back(p);
60}
61
63{
64 size_t uSize = m_VectorList.size();
65 return static_cast<long>(uSize*m_dFrameDurationMS);
66}
67
69{
70 vectorlist_t::iterator vectorIterator = m_VectorList.begin();
71
72 while (vectorIterator != m_VectorList.end())
73 {
74 vectorIterator->second.printDebug();
75 vectorIterator++;
76 }
77}
void getTCSVector(int, TCSVector &) const
Definition TCSgram.cpp:35
long getTime(size_t) const
Definition TCSgram.cpp:45
TCSGram()
Definition TCSgram.cpp:25
vectorlist_t m_VectorList
Definition TCSgram.h:44
void printDebug()
Definition TCSgram.cpp:68
void addTCSVector(const TCSVector &)
Definition TCSgram.cpp:51
~TCSGram()
Definition TCSgram.cpp:30
double m_dFrameDurationMS
Definition TCSgram.h:46
long getDuration() const
Definition TCSgram.cpp:62
void printDebug()