Mercurial > hg > dmlib
annotate editor/edwaveform.cpp @ 2394:147d40b708ea
Copy improvements to the platform 32/64bit logic from th-libs.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 09 Jan 2020 20:59:20 +0200 |
parents | e2ac08228a0f |
children |
rev | line source |
---|---|
357 | 1 #include <QtGui> |
384
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
2 #include <SDL_audio.h> |
357 | 3 #include "edwaveform.h" |
4 | |
5 | |
403
d34922e6a244
Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
400
diff
changeset
|
6 QEDWaveTrackDisplay::QEDWaveTrackDisplay(QWidget *parent) : QWidget(parent) |
357 | 7 { |
384
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
8 data = NULL; |
391 | 9 size = 0; |
384
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
10 format = AUDIO_S16SYS; |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
11 channels = 1; |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
12 freq = 1; |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
13 scale = 1.0f; |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
14 time = offs = 0; |
391 | 15 duration = 0; |
400
f44a89a25c97
Fix waveform display from going over buffer limit.
Matti Hamalainen <ccr@tnsp.org>
parents:
398
diff
changeset
|
16 sduration = 0; |
384
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
17 |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
18 setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); |
357 | 19 } |
20 | |
21 | |
403
d34922e6a244
Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
400
diff
changeset
|
22 void QEDWaveTrackDisplay::setWaveform(void *mdata, int msize, int mformat, int mchannels, int mfreq) |
357 | 23 { |
384
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
24 data = mdata; |
391 | 25 size = msize; |
384
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
26 format = mformat; |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
27 channels = mchannels; |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
28 freq = mfreq; |
391 | 29 |
30 int bps = getBps(); | |
31 if (bps != 0) | |
400
f44a89a25c97
Fix waveform display from going over buffer limit.
Matti Hamalainen <ccr@tnsp.org>
parents:
398
diff
changeset
|
32 { |
f44a89a25c97
Fix waveform display from going over buffer limit.
Matti Hamalainen <ccr@tnsp.org>
parents:
398
diff
changeset
|
33 // Duration in milliseconds |
f44a89a25c97
Fix waveform display from going over buffer limit.
Matti Hamalainen <ccr@tnsp.org>
parents:
398
diff
changeset
|
34 duration = ((float) (size / bps) / (float) freq) * 1000.0f; |
f44a89a25c97
Fix waveform display from going over buffer limit.
Matti Hamalainen <ccr@tnsp.org>
parents:
398
diff
changeset
|
35 |
f44a89a25c97
Fix waveform display from going over buffer limit.
Matti Hamalainen <ccr@tnsp.org>
parents:
398
diff
changeset
|
36 // Duration in samples |
f44a89a25c97
Fix waveform display from going over buffer limit.
Matti Hamalainen <ccr@tnsp.org>
parents:
398
diff
changeset
|
37 sduration = msize / bps; |
f44a89a25c97
Fix waveform display from going over buffer limit.
Matti Hamalainen <ccr@tnsp.org>
parents:
398
diff
changeset
|
38 } |
391 | 39 else |
400
f44a89a25c97
Fix waveform display from going over buffer limit.
Matti Hamalainen <ccr@tnsp.org>
parents:
398
diff
changeset
|
40 { |
f44a89a25c97
Fix waveform display from going over buffer limit.
Matti Hamalainen <ccr@tnsp.org>
parents:
398
diff
changeset
|
41 duration = 0; |
f44a89a25c97
Fix waveform display from going over buffer limit.
Matti Hamalainen <ccr@tnsp.org>
parents:
398
diff
changeset
|
42 sduration = 0; |
f44a89a25c97
Fix waveform display from going over buffer limit.
Matti Hamalainen <ccr@tnsp.org>
parents:
398
diff
changeset
|
43 } |
391 | 44 |
357 | 45 update(); |
46 } | |
47 | |
48 | |
403
d34922e6a244
Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
400
diff
changeset
|
49 int QEDWaveTrackDisplay::getBps() |
357 | 50 { |
391 | 51 int bps = channels; |
52 switch (format) | |
53 { | |
54 case AUDIO_S16SYS: | |
55 case AUDIO_U16SYS: | |
56 bps *= sizeof(quint16); | |
57 break; | |
58 case AUDIO_S8: | |
59 case AUDIO_U8: | |
60 bps *= sizeof(quint8); | |
61 break; | |
62 } | |
63 return bps; | |
64 } | |
65 | |
66 | |
403
d34922e6a244
Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
400
diff
changeset
|
67 float QEDWaveTrackDisplay::getDuration() |
391 | 68 { |
69 return duration; | |
70 } | |
71 | |
72 | |
403
d34922e6a244
Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
400
diff
changeset
|
73 float QEDWaveTrackDisplay::getTimeScale(float value) |
391 | 74 { |
75 return (value * scale * (float) freq) / 1000.0f; | |
357 | 76 } |
77 | |
78 | |
403
d34922e6a244
Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
400
diff
changeset
|
79 float QEDWaveTrackDisplay::getTimeFromCoord(float value) |
357 | 80 { |
391 | 81 return value * scale; |
357 | 82 } |
83 | |
84 | |
403
d34922e6a244
Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
400
diff
changeset
|
85 void QEDWaveTrackDisplay::setTime(const float mtime) |
391 | 86 { |
87 if (time != mtime && mtime >= 0 && mtime < duration) | |
88 { | |
89 time = mtime; | |
90 emit timeChanged(time); | |
91 } | |
92 } | |
93 | |
94 | |
403
d34922e6a244
Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
400
diff
changeset
|
95 void QEDWaveTrackDisplay::setOffset(const float moffs) |
391 | 96 { |
97 if (offs != moffs && moffs >= 0 && moffs < getDuration()) | |
98 { | |
99 offs = moffs; | |
100 emit offsetChanged(offs); | |
101 } | |
102 } | |
103 | |
104 | |
403
d34922e6a244
Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
400
diff
changeset
|
105 void QEDWaveTrackDisplay::setScale(const float mscale) |
357 | 106 { |
107 if (mscale > 0.05) | |
108 scale = mscale; | |
565
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
109 emit scaleChanged(scale); |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
110 } |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
111 |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
112 |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
113 void QEDWaveTrackDisplay::setSelection(const float mstart, const float mend) |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
114 { |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
115 if (mstart >= 0 && mend >= 0 && fabs(mend - mstart) > 0) |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
116 { |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
117 selectionValid = true; |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
118 if (mend > mstart) |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
119 { |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
120 selectionStart = mstart; |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
121 selectionDuration = mend - mstart + 1; |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
122 } |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
123 else |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
124 { |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
125 selectionStart = mend; |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
126 selectionDuration = mstart - mend + 1; |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
127 } |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
128 emit selectionChanged(selectionStart, selectionDuration); |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
129 } |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
130 } |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
131 |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
132 |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
133 void QEDWaveTrackDisplay::clearSelection() |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
134 { |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
135 selectionValid = false; |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
136 selectionStart = 0; |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
137 selectionDuration = 0; |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
138 emit selectionChanged(selectionStart, selectionDuration); |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
139 } |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
140 |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
141 |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
142 bool QEDTimelineTrackDisplay::getSelection(float *mstart, float *mduration) |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
143 { |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
144 if (selectionValid) |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
145 { |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
146 *mstart = selectionStart; |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
147 *mduration = selectionDuration; |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
148 } |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
149 return selectionValid; |
357 | 150 } |
151 | |
152 | |
403
d34922e6a244
Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
400
diff
changeset
|
153 float QEDWaveTrackDisplay::getScaledWidth() |
391 | 154 { |
155 return getTimeScale(width()); | |
156 } | |
157 | |
158 | |
403
d34922e6a244
Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
400
diff
changeset
|
159 float QEDWaveTrackDisplay::getTime() |
384
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
160 { |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
161 return time; |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
162 } |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
163 |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
164 |
403
d34922e6a244
Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
400
diff
changeset
|
165 float QEDWaveTrackDisplay::getOffset() |
384
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
166 { |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
167 return offs; |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
168 } |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
169 |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
170 |
403
d34922e6a244
Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
400
diff
changeset
|
171 void QEDWaveTrackDisplay::paintEvent(QPaintEvent *) |
357 | 172 { |
173 QColor waveColor(0, 150, 0); | |
400
f44a89a25c97
Fix waveform display from going over buffer limit.
Matti Hamalainen <ccr@tnsp.org>
parents:
398
diff
changeset
|
174 QColor waveCenterLine(100, 100, 100); |
391 | 175 QColor markerColor(255,255,255); |
384
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
176 QColor bgColor(0, 0, 0);//255, 255, 255); |
357 | 177 |
178 QPainter painter(this); | |
179 painter.setRenderHint(QPainter::Antialiasing); | |
384
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
180 painter.fillRect(QRect(0, 0, width(), height()), bgColor); |
357 | 181 |
384
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
182 if (data != NULL) |
357 | 183 { |
384
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
184 int voffs = 0; |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
185 |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
186 painter.save(); |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
187 painter.translate(0, height() / 2); |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
188 |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
189 painter.setPen(waveCenterLine); |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
190 painter.drawLine(0, 0, width(), 0); |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
191 |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
192 switch (format) |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
193 { |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
194 case AUDIO_S16SYS: |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
195 painter.scale(1.0f, (float) height() / 32768.0f); |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
196 break; |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
197 case AUDIO_U16SYS: |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
198 voffs = -32768; |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
199 painter.scale(1.0f, height() / 32768.0f); |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
200 break; |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
201 |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
202 case AUDIO_S8: |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
203 painter.scale(1.0f, height() / 128.0f); |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
204 break; |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
205 case AUDIO_U8: |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
206 voffs = -128; |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
207 painter.scale(1.0f, height() / 128.0f); |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
208 break; |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
209 } |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
210 |
391 | 211 painter.scale(1.0f, 0.5f); |
384
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
212 painter.setPen(waveColor); |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
213 |
391 | 214 float mscale = (scale * (float)freq) / 1000.0f; |
384
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
215 int prevY = 0, prevX = 0; |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
216 if (format == AUDIO_S16SYS || format == AUDIO_U16SYS) |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
217 { |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
218 qint16 *buf = (qint16 *) data; |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
219 for (int xc = 0; xc < width(); xc++) |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
220 { |
400
f44a89a25c97
Fix waveform display from going over buffer limit.
Matti Hamalainen <ccr@tnsp.org>
parents:
398
diff
changeset
|
221 int moffs = (int) (((offs + xc) * mscale)); |
f44a89a25c97
Fix waveform display from going over buffer limit.
Matti Hamalainen <ccr@tnsp.org>
parents:
398
diff
changeset
|
222 if (moffs >= sduration) break; |
f44a89a25c97
Fix waveform display from going over buffer limit.
Matti Hamalainen <ccr@tnsp.org>
parents:
398
diff
changeset
|
223 int value = buf[moffs * channels] + voffs; |
384
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
224 painter.drawLine(prevX, prevY, xc, value); |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
225 prevY = value; |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
226 prevX = xc; |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
227 } |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
228 } |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
229 else |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
230 if (format == AUDIO_S8 || format == AUDIO_U8) |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
231 { |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
232 qint8 *buf = (qint8 *) data; |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
233 for (int xc = 0; xc < width(); xc++) |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
234 { |
400
f44a89a25c97
Fix waveform display from going over buffer limit.
Matti Hamalainen <ccr@tnsp.org>
parents:
398
diff
changeset
|
235 int moffs = (int) (((offs + xc) * mscale)); |
f44a89a25c97
Fix waveform display from going over buffer limit.
Matti Hamalainen <ccr@tnsp.org>
parents:
398
diff
changeset
|
236 if (moffs >= sduration) break; |
f44a89a25c97
Fix waveform display from going over buffer limit.
Matti Hamalainen <ccr@tnsp.org>
parents:
398
diff
changeset
|
237 int value = buf[moffs * channels] + voffs; |
384
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
238 painter.drawLine(prevX, prevY, xc, value); |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
239 prevY = value; |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
240 prevX = xc; |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
241 } |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
242 } |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
243 |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
244 painter.restore(); |
357 | 245 } |
246 | |
391 | 247 float xc = getTimeScale(time - offs), wd = getTimeScale(width()); |
248 if (xc >= 0 && xc <= wd) | |
357 | 249 { |
391 | 250 xc = time - offs; |
251 painter.scale(scale, 1.0f); | |
357 | 252 painter.setPen(markerColor); |
253 painter.drawLine(xc, 0, xc, height()); | |
254 } | |
255 } | |
256 | |
257 | |
403
d34922e6a244
Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
400
diff
changeset
|
258 void QEDWaveTrackDisplay::mousePressEvent(QMouseEvent *ev) |
357 | 259 { |
565
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
260 switch (ev->button()) |
357 | 261 { |
565
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
262 case Qt::LeftButton: |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
263 selectionPoint = ev->pos(); |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
264 selectionOffs = offs; |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
265 selecting = false; |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
266 break; |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
267 |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
268 case Qt::RightButton: |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
269 dragPoint = ev->pos(); |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
270 dragOffs = offs; |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
271 dragging = false; |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
272 break; |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
273 |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
274 default: |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
275 break; |
357 | 276 } |
277 } | |
278 | |
279 | |
403
d34922e6a244
Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
400
diff
changeset
|
280 void QEDWaveTrackDisplay::mouseMoveEvent(QMouseEvent *ev) |
357 | 281 { |
565
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
282 if ((ev->buttons() & Qt::LeftButton) && ev->pos().x() != selPoint.x()) |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
283 { |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
284 selecting = true; |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
285 setSelection(selectionOffs + (ev->pos().x() - selectionPoint.x()) / scale); |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
286 } |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
287 if ((ev->buttons() & Qt::RightButton) && ev->pos().x() != dragPoint.x()) |
391 | 288 { |
289 dragging = true; | |
290 setOffset(dragOffs - (ev->pos().x() - dragPoint.x()) / scale); | |
291 } | |
357 | 292 } |
293 | |
294 | |
403
d34922e6a244
Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
400
diff
changeset
|
295 void QEDWaveTrackDisplay::mouseReleaseEvent(QMouseEvent *ev) |
357 | 296 { |
391 | 297 if (ev->button() == Qt::LeftButton) |
357 | 298 { |
565
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
299 if (selecting) |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
300 { |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
301 selecting = false; |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
302 setSelection(selOffs + (ev->pos().x() - selPoint.x()) / scale); |
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
303 } |
357 | 304 } |
391 | 305 else |
306 if (ev->button() == Qt::RightButton && !dragging) | |
307 { | |
308 setTime(offs + getTimeFromCoord(ev->pos().x())); | |
309 } | |
357 | 310 } |
384
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
311 |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
312 |
403
d34922e6a244
Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
400
diff
changeset
|
313 QEDWaveTrackView::QEDWaveTrackView(QWidget *parent) : QWidget(parent) |
384
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
314 { |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
315 QHBoxLayout *mainLayout = new QHBoxLayout(this); |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
316 mainLayout->setMargin(0); |
403
d34922e6a244
Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
400
diff
changeset
|
317 wave = new QEDWaveTrackDisplay(this); |
384
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
318 |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
319 QFrame *infoLayoutContainer = new QFrame(this); |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
320 infoLayoutContainer->setFrameStyle(QFrame::StyledPanel | QFrame::Plain); |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
321 infoLayoutContainer->setLineWidth(2); |
398 | 322 infoLayoutContainer->setFixedWidth(200); |
384
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
323 |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
324 QVBoxLayout *infoLayout = new QVBoxLayout(infoLayoutContainer); |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
325 infoLayout->setMargin(0); |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
326 infoName = new QLabel("Audio"); |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
327 infoName->setStyleSheet("QLabel { background-color: black; color: white; padding: 2px; }"); |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
328 infoLayout->addWidget(infoName); |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
329 |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
330 infoData = new QLabel(); |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
331 infoData->setStyleSheet("QLabel { padding: 2px; }"); |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
332 infoLayout->addWidget(infoData); |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
333 |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
334 mainLayout->addWidget(infoLayoutContainer); |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
335 mainLayout->addWidget(wave); |
391 | 336 |
337 connect(wave, SIGNAL(timeChanged(float)), this, SLOT(slotTimeChanged(float))); | |
338 connect(wave, SIGNAL(offsetChanged(float)), this, SLOT(slotOffsetChanged(float))); | |
565
a4666c9e1336
Moar work on the editor (broken).
Matti Hamalainen <ccr@tnsp.org>
parents:
403
diff
changeset
|
339 connect(wave, SIGNAL(selectionChanged(float,float)), this, SLOT(slotSelectionChanged(float,float))); |
384
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
340 } |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
341 |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
342 |
403
d34922e6a244
Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
400
diff
changeset
|
343 void QEDWaveTrackView::setWaveform(void *mdata, int msize, int mformat, int mchannels, int mfreq) |
384
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
344 { |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
345 QString fmt; |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
346 switch (mformat) |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
347 { |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
348 case AUDIO_S16SYS: fmt = "16bit (S)"; break; |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
349 case AUDIO_U16SYS: fmt = "16bit (U)"; break; |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
350 case AUDIO_S8: fmt = "8bit (S)"; break; |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
351 case AUDIO_U8: fmt = "8bit (U)"; break; |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
352 default: fmt = "?"; break; |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
353 } |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
354 infoData->setText(QString("<b>%1</b>, <b>%2</b> ch, <b>%3</b> Hz").arg(fmt).arg(mchannels).arg(mfreq)); |
391 | 355 wave->setWaveform(mdata, msize, mformat, mchannels, mfreq); |
384
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
356 update(); |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
357 } |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
358 |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
359 |
403
d34922e6a244
Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
400
diff
changeset
|
360 void QEDWaveTrackView::setName(QString name) |
384
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
361 { |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
362 infoName->setText(name); |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
363 update(); |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
364 } |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
365 |
391 | 366 |
403
d34922e6a244
Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
400
diff
changeset
|
367 void QEDWaveTrackView::setTime(const float mtime) |
384
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
368 { |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
369 wave->setTime(mtime); |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
370 } |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
371 |
391 | 372 |
403
d34922e6a244
Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
400
diff
changeset
|
373 void QEDWaveTrackView::setOffset(const float moffs) |
384
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
374 { |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
375 wave->setOffset(moffs); |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
376 } |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
377 |
391 | 378 |
403
d34922e6a244
Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
400
diff
changeset
|
379 void QEDWaveTrackView::setScale(const float mscale) |
384
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
380 { |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
381 wave->setScale(mscale); |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
382 } |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
383 |
391 | 384 |
403
d34922e6a244
Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
400
diff
changeset
|
385 float QEDWaveTrackView::getTime() |
384
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
386 { |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
387 return wave->getTime(); |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
388 } |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
389 |
391 | 390 |
403
d34922e6a244
Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
400
diff
changeset
|
391 float QEDWaveTrackView::getOffset() |
384
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
392 { |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
393 return wave->getOffset(); |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
394 } |
391 | 395 |
396 | |
403
d34922e6a244
Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
400
diff
changeset
|
397 float QEDWaveTrackView::getScaledWidth() |
391 | 398 { |
399 return wave->getScaledWidth(); | |
400 } | |
401 | |
402 | |
403
d34922e6a244
Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
400
diff
changeset
|
403 void QEDWaveTrackView::slotTimeChanged(float value) |
391 | 404 { |
405 emit timeChanged(value); | |
406 } | |
407 | |
408 | |
403
d34922e6a244
Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
400
diff
changeset
|
409 void QEDWaveTrackView::slotOffsetChanged(float value) |
391 | 410 { |
411 emit offsetChanged(value); | |
412 } | |
413 | |
414 | |
403
d34922e6a244
Even more work towards the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
400
diff
changeset
|
415 float QEDWaveTrackView::getDuration() |
391 | 416 { |
417 return wave->getDuration(); | |
418 } |