-
Notifications
You must be signed in to change notification settings - Fork 1
/
soundfeatures.h
40 lines (31 loc) · 1007 Bytes
/
soundfeatures.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef SOUNDFEATURES_H_
#define SOUNDFEATURES_H_
class Peak
{
private:
unsigned int m_PeakSampleIndex;
unsigned int m_AttackSampleIndex;
public:
Peak(unsigned int peakSampleIndex, unsigned int attackSampleIndex)
: m_PeakSampleIndex(peakSampleIndex), m_AttackSampleIndex(attackSampleIndex)
{}
void OffsetBy(unsigned int offset)
{
m_PeakSampleIndex += offset;
m_AttackSampleIndex += offset;
}
struct OffsetByFunctor
{
unsigned int m_Offset;
OffsetByFunctor(unsigned int offset) : m_Offset(offset) {}
void operator()(Peak& peak)
{
peak.OffsetBy(m_Offset);
}
};
void SetPeakSampleIndex(unsigned int peakSampleIndex) { m_PeakSampleIndex = peakSampleIndex; }
void SetAttackSampleIndex(unsigned int attackSampleIndex) { m_AttackSampleIndex = attackSampleIndex; }
unsigned int GetPeakSampleIndex() const { return m_PeakSampleIndex; }
unsigned int GetAttackSampleIndex() const { return m_AttackSampleIndex; }
};
#endif // SOUNDFEATURES_H_