-
Notifications
You must be signed in to change notification settings - Fork 20
/
track.h
50 lines (36 loc) · 921 Bytes
/
track.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
#ifndef TRACK_H
#define TRACK_H
#include "ext/qcustomplot.h"
#include <QAudioBuffer>
// Copied from https://stackoverflow.com/questions/50277132/qt-audio-file-to-wave-like-audacity
class QAudioDecoder;
class Track : public QCustomPlot
{
Q_OBJECT
public:
Track(QWidget *parent = Q_NULLPTR);
~Track();
void setSource(const QAudioBuffer &inbuffer);
public:
bool DoSlide;
void setBuffer();
void plot();
void startPlaying(float TimeInSecs);
public slots:
void TimerTick();
void EndSlide();
private:
void SetTimeLabel(float Cur, float Remaining);
QTimer* timGenericTick;
QTimer* timEndTick;
float TickSet;
float TotSecs;
QCPItemRect* PlayRect;
QCPItemText* SecsTxt;
qreal getPeakValue(const QAudioFormat& format);
QAudioDecoder *decoder;
QAudioBuffer buffer;
QVector<double> samples;
QCPGraph *wavePlot;
};
#endif // TRACK_H