-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathScopeWrapper.h
68 lines (52 loc) · 1.72 KB
/
ScopeWrapper.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#ifndef SCOPEWRAPPER_H
#define SCOPEWRAPPER_H
#include "scope/scope.h"
#include <deadbeef/deadbeef.h>
#include <QWidget>
#include <QXYSeries>
#if (QT_VERSION < QT_VERSION_CHECK(6,0,0))
using namespace QtCharts;
#endif
class ScopeWrapper : public QObject {
Q_OBJECT
public:
ScopeWrapper(QObject *parent = nullptr);
~ScopeWrapper();
Q_PROPERTY(int fragment_duration READ getFragmentDuration WRITE setFragmentDuration NOTIFY fragmentDurationChanged);
int getFragmentDuration();
void setFragmentDuration(int fragment_duration);
// on mono: only left channgel is visible
Q_PROPERTY(int scope_mode READ getScopeMode WRITE setScopeMode NOTIFY scopeModeChanged);
int getScopeMode();
void setScopeMode(int scope_mode);
Q_PROPERTY(int series_width READ getSeriesWidth NOTIFY seriesWidthChanged);
int getSeriesWidth();
Q_PROPERTY(bool paused READ isPaused WRITE setPaused NOTIFY pausedChanged);
bool isPaused();
Q_PROPERTY(int scale READ getScale WRITE setScale NOTIFY scaleChanged);
int getScale();
void process(const ddb_audio_data_t *data);
public slots:
void setSeries(int num, QtCharts::QAbstractSeries *s);
void setPaused(bool pause);
void setScale(int s);
signals:
void fragmentDurationChanged();
void scopeModeChanged();
void seriesWidthChanged();
void pausedChanged();
void scaleChanged();
private:
void *scope;
QList<QXYSeries *> series;
int m_paused;
int m_scale;
bool m_scale_changed;
bool m_mode_changed;
bool m_fragment_duration_changed;
QVector<QPointF> *data_left = nullptr;
bool waveform_mono_set = false;
QVector<QPointF> *data_right = nullptr;
int channels_last = 0;
};
#endif // SCOPEWRAPPER_H