-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathspectrogram.h
54 lines (44 loc) · 1.32 KB
/
spectrogram.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef SPECTROGRAM_H
#define SPECTROGRAM_H
#include <list>
#include <vector>
#include <complex>
class Spectrogram {
public:
Spectrogram(unsigned int _sampleRate,
unsigned int _sampleLength,
unsigned int _samplesPerLine,
unsigned int _numLines);
~Spectrogram();
unsigned int processData(float *buffer,
unsigned int bufferLength);
double getDeltaTime();
double getFootTime();
double getHeadTime();
std::list<std::vector<float> > spectrogramData;
std::list<float> waveEnvelopeMin;
std::list<float> waveEnvelopeMax;
std::list<float> timeList;
std::vector<float> frequencyList;
private:
void removeFoot(unsigned int numLines);
void addLine(float *fourierData,
unsigned int dataLength,
float envmin,
float envmax);
void FFTCompute(std::complex<float> *data,
unsigned int dataLength);
unsigned int sampleRate;
unsigned int sampleLength;
unsigned int samplesPerLine;
unsigned int fftSize;
unsigned int numLines;
float *waveRingBuffer;
unsigned int ringBufferSize;
unsigned int ringBufferInd;
unsigned int sampleCounter;
double headTime;
double footTime;
double deltaTime;
};
#endif // SPECTROGRAM_H