annotate editor/edwaveform.h @ 2294:7f6ba3b32f54

Cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 03 Jul 2019 10:28:43 +0300
parents e2ac08228a0f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
357
1b8362a26692 Work towards Qt based editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 #ifndef EDWAVEFORM_H
1b8362a26692 Work towards Qt based editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2 #define EDWAVEFORM_H
1b8362a26692 Work towards Qt based editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3
1b8362a26692 Work towards Qt based editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
4 #include <QWidget>
384
e5220ff48bc8 Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 376
diff changeset
5 #include <QLabel>
357
1b8362a26692 Work towards Qt based editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
6 #include "dmengine.h"
1b8362a26692 Work towards Qt based editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
7
403
d34922e6a244 Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 400
diff changeset
8 class QEDWaveTrackDisplay : public QWidget
357
1b8362a26692 Work towards Qt based editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9 {
1b8362a26692 Work towards Qt based editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
10 Q_OBJECT
1b8362a26692 Work towards Qt based editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11
1b8362a26692 Work towards Qt based editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
12 public:
403
d34922e6a244 Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 400
diff changeset
13 QEDWaveTrackDisplay(QWidget *parent = 0);
357
1b8362a26692 Work towards Qt based editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
14
391
28a74940f2b6 More work on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 384
diff changeset
15 void setWaveform(void *mdata, int msize, int mformat, int mchannels, int mfreq);
28a74940f2b6 More work on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 384
diff changeset
16 float getScaledWidth();
357
1b8362a26692 Work towards Qt based editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
17 void setScale(const float mscale);
391
28a74940f2b6 More work on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 384
diff changeset
18 int getBps();
28a74940f2b6 More work on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 384
diff changeset
19 float getDuration();
28a74940f2b6 More work on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 384
diff changeset
20 float getTimeScale(float value);
28a74940f2b6 More work on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 384
diff changeset
21 float getTimeFromCoord(float value);
28a74940f2b6 More work on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 384
diff changeset
22 float getTime();
28a74940f2b6 More work on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 384
diff changeset
23 float getOffset();
384
e5220ff48bc8 Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 376
diff changeset
24
e5220ff48bc8 Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 376
diff changeset
25 QSize minimumSizeHint() const
e5220ff48bc8 Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 376
diff changeset
26 {
e5220ff48bc8 Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 376
diff changeset
27 return QSize(100, 60);
e5220ff48bc8 Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 376
diff changeset
28 }
e5220ff48bc8 Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 376
diff changeset
29
e5220ff48bc8 Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 376
diff changeset
30 QSize sizeHint() const
e5220ff48bc8 Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 376
diff changeset
31 {
e5220ff48bc8 Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 376
diff changeset
32 return QSize(600, 60);
e5220ff48bc8 Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 376
diff changeset
33 }
357
1b8362a26692 Work towards Qt based editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
34
391
28a74940f2b6 More work on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 384
diff changeset
35 public slots:
28a74940f2b6 More work on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 384
diff changeset
36 void setTime(const float mtime);
28a74940f2b6 More work on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 384
diff changeset
37 void setOffset(const float moffs);
565
a4666c9e1336 Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
38 void setSelection(const float mstart, const float mend);
a4666c9e1336 Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
39 void clearSelection();
391
28a74940f2b6 More work on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 384
diff changeset
40
28a74940f2b6 More work on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 384
diff changeset
41 signals:
565
a4666c9e1336 Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
42 void selectionChanged(float mstart, float mduration);
391
28a74940f2b6 More work on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 384
diff changeset
43 void timeChanged(float value);
28a74940f2b6 More work on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 384
diff changeset
44 void offsetChanged(float value);
28a74940f2b6 More work on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 384
diff changeset
45
357
1b8362a26692 Work towards Qt based editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
46 protected:
1b8362a26692 Work towards Qt based editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
47 void mousePressEvent(QMouseEvent *event);
1b8362a26692 Work towards Qt based editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
48 void mouseMoveEvent(QMouseEvent *event);
1b8362a26692 Work towards Qt based editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
49 void mouseReleaseEvent(QMouseEvent *event);
1b8362a26692 Work towards Qt based editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
50
1b8362a26692 Work towards Qt based editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
51 void paintEvent(QPaintEvent *event);
1b8362a26692 Work towards Qt based editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
52
1b8362a26692 Work towards Qt based editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
53 private:
565
a4666c9e1336 Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
54 float scale, time, offs, duration; // in milliseconds
400
f44a89a25c97 Fix waveform display from going over buffer limit.
Matti Hamalainen <ccr@tnsp.org>
parents: 393
diff changeset
55 int size, channels, format, freq, sduration;
384
e5220ff48bc8 Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 376
diff changeset
56 void *data;
565
a4666c9e1336 Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
57
a4666c9e1336 Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
58 bool selectionValid;
a4666c9e1336 Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
59 float selectionStart, selectionDuration;
a4666c9e1336 Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
60
a4666c9e1336 Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
61 QPoint selectionPoint, dragPoint;
a4666c9e1336 Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
62 bool selecting, dragging;
a4666c9e1336 Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents: 403
diff changeset
63 float selectionOffs, dragOffs;
384
e5220ff48bc8 Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 376
diff changeset
64 };
e5220ff48bc8 Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 376
diff changeset
65
e5220ff48bc8 Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 376
diff changeset
66
403
d34922e6a244 Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 400
diff changeset
67 class QEDWaveTrackView : public QWidget
384
e5220ff48bc8 Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 376
diff changeset
68 {
e5220ff48bc8 Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 376
diff changeset
69 Q_OBJECT
e5220ff48bc8 Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 376
diff changeset
70
e5220ff48bc8 Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 376
diff changeset
71 private:
403
d34922e6a244 Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 400
diff changeset
72 QEDWaveTrackDisplay *wave;
384
e5220ff48bc8 Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 376
diff changeset
73 QLabel *infoName, *infoData;
e5220ff48bc8 Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 376
diff changeset
74
e5220ff48bc8 Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 376
diff changeset
75 public:
391
28a74940f2b6 More work on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 384
diff changeset
76
403
d34922e6a244 Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 400
diff changeset
77 QEDWaveTrackView(QWidget *parent = 0);
384
e5220ff48bc8 Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 376
diff changeset
78 void setWaveform(void *mdata, int mlen, int mformat, int mchannels, int mfreq);
e5220ff48bc8 Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 376
diff changeset
79 void setName(QString name);
391
28a74940f2b6 More work on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 384
diff changeset
80 void setTime(const float mtime);
28a74940f2b6 More work on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 384
diff changeset
81 void setOffset(const float moffs);
28a74940f2b6 More work on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 384
diff changeset
82 float getScaledWidth();
384
e5220ff48bc8 Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 376
diff changeset
83 void setScale(const float mscale);
391
28a74940f2b6 More work on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 384
diff changeset
84 float getDuration();
28a74940f2b6 More work on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 384
diff changeset
85 float getTime();
28a74940f2b6 More work on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 384
diff changeset
86 float getOffset();
28a74940f2b6 More work on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 384
diff changeset
87
28a74940f2b6 More work on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 384
diff changeset
88 private slots:
28a74940f2b6 More work on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 384
diff changeset
89 void slotTimeChanged(float value);
28a74940f2b6 More work on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 384
diff changeset
90 void slotOffsetChanged(float value);
28a74940f2b6 More work on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 384
diff changeset
91
28a74940f2b6 More work on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 384
diff changeset
92 signals:
28a74940f2b6 More work on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 384
diff changeset
93 void timeChanged(float value);
28a74940f2b6 More work on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 384
diff changeset
94 void offsetChanged(float value);
357
1b8362a26692 Work towards Qt based editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
95 };
1b8362a26692 Work towards Qt based editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
96
1b8362a26692 Work towards Qt based editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
97 #endif