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
25
TCSGram::TCSGram
() :
26
m_uNumBins(6)
27
{
28
}
29
30
TCSGram::~TCSGram
()
31
{
32
}
33
34
35
void
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
45
long
TCSGram::getTime
(
size_t
uPosition)
const
46
{
47
return
m_VectorList
[uPosition].first;
48
}
49
50
51
void
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
62
long
TCSGram::getDuration
()
const
63
{
64
size_t
uSize =
m_VectorList
.size();
65
return
static_cast<
long
>
(uSize*
m_dFrameDurationMS
);
66
}
67
68
void
TCSGram::printDebug
()
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
}
MathUtilities.h
TCSgram.h
TCSGram::getTCSVector
void getTCSVector(int, TCSVector &) const
Definition
TCSgram.cpp:35
TCSGram::getTime
long getTime(size_t) const
Definition
TCSgram.cpp:45
TCSGram::TCSGram
TCSGram()
Definition
TCSgram.cpp:25
TCSGram::m_VectorList
vectorlist_t m_VectorList
Definition
TCSgram.h:44
TCSGram::printDebug
void printDebug()
Definition
TCSgram.cpp:68
TCSGram::addTCSVector
void addTCSVector(const TCSVector &)
Definition
TCSgram.cpp:51
TCSGram::~TCSGram
~TCSGram()
Definition
TCSgram.cpp:30
TCSGram::m_dFrameDurationMS
double m_dFrameDurationMS
Definition
TCSgram.h:46
TCSGram::getDuration
long getDuration() const
Definition
TCSgram.cpp:62
TCSVector
Definition
TonalEstimator.h:62
TCSVector::printDebug
void printDebug()
Definition
TonalEstimator.h:69
dsp
tonal
TCSgram.cpp
Generated by
1.9.8