Merge lp:~vrince/mixxx/waveform-2.0_pure-gl into lp:~mixxxdevelopers/mixxx/trunk
- waveform-2.0_pure-gl
- Merge into trunk
Status: | Merged | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Merged at revision: | 3167 | ||||||||||||||||||||||||
Proposed branch: | lp:~vrince/mixxx/waveform-2.0_pure-gl | ||||||||||||||||||||||||
Merge into: | lp:~mixxxdevelopers/mixxx/trunk | ||||||||||||||||||||||||
Diff against target: |
3454 lines (+1509/-1139) 39 files modified
mixxx/build/depends.py (+12/-3) mixxx/res/skins/Deere1280x800-WXGA/skin.xml (+10/-448) mixxx/src/engine/cuecontrol.cpp (+0/-2) mixxx/src/engine/cuecontrol.h (+2/-0) mixxx/src/skin/legacyskinparser.cpp (+2/-3) mixxx/src/waveform/renderers/glslwaveformrenderersignal.cpp (+21/-7) mixxx/src/waveform/renderers/glslwaveformrenderersignal.h (+4/-8) mixxx/src/waveform/renderers/glwaveformrendererfilteredsignal.cpp (+177/-324) mixxx/src/waveform/renderers/glwaveformrendererfilteredsignal.h (+4/-34) mixxx/src/waveform/renderers/glwaveformrenderersimplesignal.cpp (+120/-185) mixxx/src/waveform/renderers/glwaveformrenderersimplesignal.h (+4/-21) mixxx/src/waveform/renderers/qtwaveformrendererfilteredsignal.cpp (+346/-0) mixxx/src/waveform/renderers/qtwaveformrendererfilteredsignal.h (+36/-0) mixxx/src/waveform/renderers/qtwaveformrenderersimplesignal.cpp (+223/-0) mixxx/src/waveform/renderers/qtwaveformrenderersimplesignal.h (+31/-0) mixxx/src/waveform/renderers/waveformmark.cpp (+0/-4) mixxx/src/waveform/renderers/waveformrendererendoftrack.cpp (+4/-0) mixxx/src/waveform/renderers/waveformrendererfilteredsignal.cpp (+107/-34) mixxx/src/waveform/renderers/waveformrendererfilteredsignal.h (+7/-12) mixxx/src/waveform/renderers/waveformrenderersignalbase.cpp (+83/-0) mixxx/src/waveform/renderers/waveformrenderersignalbase.h (+38/-0) mixxx/src/waveform/renderers/waveformrendermark.cpp (+43/-5) mixxx/src/waveform/renderers/waveformrendermark.h (+1/-0) mixxx/src/waveform/renderers/waveformwidgetrenderer.cpp (+9/-3) mixxx/src/waveform/renderers/waveformwidgetrenderer.h (+1/-1) mixxx/src/waveform/waveformwidgetfactory.cpp (+31/-23) mixxx/src/waveform/widgets/glsimplewaveformwidget.cpp (+2/-6) mixxx/src/waveform/widgets/glsimplewaveformwidget.h (+0/-3) mixxx/src/waveform/widgets/glslwaveformwidget.cpp (+4/-4) mixxx/src/waveform/widgets/glslwaveformwidget.h (+1/-1) mixxx/src/waveform/widgets/glwaveformwidget.cpp (+3/-2) mixxx/src/waveform/widgets/qtsimplewaveformwidget.cpp (+57/-0) mixxx/src/waveform/widgets/qtsimplewaveformwidget.h (+30/-0) mixxx/src/waveform/widgets/qtwaveformwidget.cpp (+56/-0) mixxx/src/waveform/widgets/qtwaveformwidget.h (+30/-0) mixxx/src/waveform/widgets/softwarewaveformwidget.cpp (+3/-2) mixxx/src/waveform/widgets/softwarewaveformwidget.h (+1/-1) mixxx/src/waveform/widgets/waveformwidgettype.h (+3/-1) mixxx/src/widget/wwaveformviewer.cpp (+3/-2) |
||||||||||||||||||||||||
To merge this branch: | bzr merge lp:~vrince/mixxx/waveform-2.0_pure-gl | ||||||||||||||||||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
RJ Skerry-Ryan | Pending | ||
Review via email: mp+105570@code.launchpad.net |
Commit message
Description of the change
Add pure OpenGL line-based waveform to get back 1.10 rendering performances and try to make 1.11 usable.
Fix end of track for track not long enougth.
Albert Santoni (gamegod) wrote : | # |
Thomas Vincent (vrince) wrote : | # |
In GLSL version I don't even need VBO, waveform data is stored in a
texture. But we can switch to VBO.
For the pure-gl version I wanted to make a version that work for any
configure even old ones (Opengl < 1.5).
But of course we can test if ARB_vertex_
send data in a continuous chunk.
Should be faster and CPU depend should decrease.
Tom
2012/5/13 Albert Santoni <email address hidden>:
> Hey Thomas,
>
> Have you considered using display lists or VBOs for the waveform
> instead of immediate mode? I expect that would give you a fairly
> significant drop in CPU usage. (Maybe you're already using VBOs for
> the GLSL code?)
>
> Thanks,
> Albert
>
> --
> https:/
> You are the owner of lp:~vrince/mixxx/waveform-2.0_pure-gl.
- 2787. By Thomas Vincent
-
Add central waveform axe (and 'AxesColor' in skin) in all waveform renderer. Line is display under the signal.
Use 'AxesColor' to draw vertical line too. - 2788. By Thomas Vincent
-
Some comments
- 2789. By Thomas Vincent
-
Waveform interactive zoom in accessible everywhere in the waveform viewer
- 2790. By Thomas Vincent
-
Add DefaulMark support (see example in <visual> of Deere1280x800 skin)
Add protection again multiple declaration of hotcue in skin - 2791. By Thomas Vincent
-
Change defaul zoom to 3 (33%)
Fix zoom propagation of wavfeom type change
Preview Diff
1 | === modified file 'mixxx/build/depends.py' |
2 | --- mixxx/build/depends.py 2012-05-14 20:47:43 +0000 |
3 | +++ mixxx/build/depends.py 2012-05-17 02:22:20 +0000 |
4 | @@ -521,20 +521,29 @@ |
5 | "waveform/renderers/waveformrenderbeat.cpp", |
6 | "waveform/renderers/waveformrendererendoftrack.cpp", |
7 | "waveform/renderers/waveformrendererpreroll.cpp", |
8 | + |
9 | "waveform/renderers/waveformrendererfilteredsignal.cpp", |
10 | + "waveform/renderers/qtwaveformrendererfilteredsignal.cpp", |
11 | + "waveform/renderers/qtwaveformrenderersimplesignal.cpp", |
12 | "waveform/renderers/glwaveformrendererfilteredsignal.cpp", |
13 | + "waveform/renderers/glwaveformrenderersimplesignal.cpp", |
14 | "waveform/renderers/glslwaveformrenderersignal.cpp", |
15 | + |
16 | "waveform/renderers/waveformsignalcolors.cpp", |
17 | - "waveform/renderers/glwaveformrenderersimplesignal.cpp", |
18 | + |
19 | + "waveform/renderers/waveformrenderersignalbase.cpp", |
20 | "waveform/renderers/waveformmark.cpp", |
21 | "waveform/renderers/waveformmarkrange.cpp", |
22 | |
23 | "waveform/widgets/waveformwidgetabstract.cpp", |
24 | - "waveform/widgets/glwaveformwidget.cpp", |
25 | "waveform/widgets/emptywaveformwidget.cpp", |
26 | "waveform/widgets/softwarewaveformwidget.cpp", |
27 | + "waveform/widgets/qtwaveformwidget.cpp", |
28 | + "waveform/widgets/qtsimplewaveformwidget.cpp", |
29 | + "waveform/widgets/glwaveformwidget.cpp", |
30 | + "waveform/widgets/glsimplewaveformwidget.cpp", |
31 | + |
32 | "waveform/widgets/glslwaveformwidget.cpp", |
33 | - "waveform/widgets/glsimplewaveformwidget.cpp", |
34 | |
35 | "skin/imginvert.cpp", |
36 | "skin/imgloader.cpp", |
37 | |
38 | === modified file 'mixxx/res/skins/Deere1280x800-WXGA/skin.xml' |
39 | --- mixxx/res/skins/Deere1280x800-WXGA/skin.xml 2012-05-08 07:21:23 +0000 |
40 | +++ mixxx/res/skins/Deere1280x800-WXGA/skin.xml 2012-05-17 02:22:20 +0000 |
41 | @@ -3668,6 +3668,11 @@ |
42 | represented by a button in the current skin. Mixxx 1.8.x-1.9.0 support up to 32 hotcues. v1.9.1+ supports up to 36. |
43 | Current skins uses up to 6 buttons per channel. |
44 | --> |
45 | + <DefaultMark> |
46 | + <Align>center</Align> |
47 | + <Color>#AE5CFF</Color> |
48 | + <TextColor>#FFFFFF</TextColor> |
49 | + </DefaultMark> |
50 | <Mark> |
51 | <Control>hotcue_1_position</Control> |
52 | <Pixmap>marker_hotcue1_1.png</Pixmap> |
53 | @@ -3701,230 +3706,6 @@ |
54 | <TextColor>#FFFFFF</TextColor> |
55 | </Mark> |
56 | <Mark> |
57 | - <Control>hotcue_5_position</Control> |
58 | - <Text> HOTCUE 5 </Text> |
59 | - <Align>center</Align> |
60 | - <Color>#AE5CFF</Color> |
61 | - <TextColor>#FFFFFF</TextColor> |
62 | - </Mark> |
63 | - <Mark> |
64 | - <Control>hotcue_6_position</Control> |
65 | - <Text> HOTCUE 6 </Text> |
66 | - <Align>center</Align> |
67 | - <Color>#AE5CFF</Color> |
68 | - <TextColor>#FFFFFF</TextColor> |
69 | - </Mark> |
70 | - <Mark> |
71 | - <Control>hotcue_7_position</Control> |
72 | - <Text> HOTCUE 7 </Text> |
73 | - <Align>center</Align> |
74 | - <Color>#AE5CFF</Color> |
75 | - <TextColor>#FFFFFF</TextColor> |
76 | - </Mark> |
77 | - <Mark> |
78 | - <Control>hotcue_8_position</Control> |
79 | - <Text> HOTCUE 8 </Text> |
80 | - <Align>center</Align> |
81 | - <Color>#AE5CFF</Color> |
82 | - <TextColor>#FFFFFF</TextColor> |
83 | - </Mark> |
84 | - <Mark> |
85 | - <Control>hotcue_9_position</Control> |
86 | - <Text> HOTCUE 9 </Text> |
87 | - <Align>center</Align> |
88 | - <Color>#AE5CFF</Color> |
89 | - <TextColor>#FFFFFF</TextColor> |
90 | - </Mark> |
91 | - <Mark> |
92 | - <Control>hotcue_10_position</Control> |
93 | - <Text> HOTCUE 10 </Text> |
94 | - <Align>center</Align> |
95 | - <Color>#AE5CFF</Color> |
96 | - <TextColor>#FFFFFF</TextColor> |
97 | - </Mark> |
98 | - <Mark> |
99 | - <Control>hotcue_11_position</Control> |
100 | - <Text> HOTCUE 11 </Text> |
101 | - <Align>center</Align> |
102 | - <Color>#AE5CFF</Color> |
103 | - <TextColor>#FFFFFF</TextColor> |
104 | - </Mark> |
105 | - <Mark> |
106 | - <Control>hotcue_12_position</Control> |
107 | - <Text> HOTCUE 12 </Text> |
108 | - <Align>center</Align> |
109 | - <Color>#AE5CFF</Color> |
110 | - <TextColor>#FFFFFF</TextColor> |
111 | - </Mark> |
112 | - <Mark> |
113 | - <Control>hotcue_13_position</Control> |
114 | - <Text> HOTCUE 13 </Text> |
115 | - <Align>center</Align> |
116 | - <Color>#AE5CFF</Color> |
117 | - <TextColor>#FFFFFF</TextColor> |
118 | - </Mark> |
119 | - <Mark> |
120 | - <Control>hotcue_14_position</Control> |
121 | - <Text> HOTCUE 14 </Text> |
122 | - <Align>center</Align> |
123 | - <Color>#AE5CFF</Color> |
124 | - <TextColor>#FFFFFF</TextColor> |
125 | - </Mark> |
126 | - <Mark> |
127 | - <Control>hotcue_15_position</Control> |
128 | - <Text> HOTCUE 15 </Text> |
129 | - <Align>center</Align> |
130 | - <Color>#AE5CFF</Color> |
131 | - <TextColor>#FFFFFF</TextColor> |
132 | - </Mark> |
133 | - <Mark> |
134 | - <Control>hotcue_16_position</Control> |
135 | - <Text> HOTCUE 16 </Text> |
136 | - <Align>center</Align> |
137 | - <Color>#AE5CFF</Color> |
138 | - <TextColor>#FFFFFF</TextColor> |
139 | - </Mark> |
140 | - <Mark> |
141 | - <Control>hotcue_17_position</Control> |
142 | - <Text> HOTCUE 17 </Text> |
143 | - <Align>center</Align> |
144 | - <Color>#AE5CFF</Color> |
145 | - <TextColor>#FFFFFF</TextColor> |
146 | - </Mark> |
147 | - <Mark> |
148 | - <Control>hotcue_18_position</Control> |
149 | - <Text> HOTCUE 18 </Text> |
150 | - <Align>center</Align> |
151 | - <Color>#AE5CFF</Color> |
152 | - <TextColor>#FFFFFF</TextColor> |
153 | - </Mark> |
154 | - <Mark> |
155 | - <Control>hotcue_19_position</Control> |
156 | - <Text> HOTCUE 19 </Text> |
157 | - <Align>center</Align> |
158 | - <Color>#AE5CFF</Color> |
159 | - <TextColor>#FFFFFF</TextColor> |
160 | - </Mark> |
161 | - <Mark> |
162 | - <Control>hotcue_20_position</Control> |
163 | - <Text> HOTCUE 20 </Text> |
164 | - <Align>center</Align> |
165 | - <Color>#AE5CFF</Color> |
166 | - <TextColor>#FFFFFF</TextColor> |
167 | - </Mark> |
168 | - <Mark> |
169 | - <Control>hotcue_21_position</Control> |
170 | - <Text> HOTCUE 21 </Text> |
171 | - <Align>center</Align> |
172 | - <Color>#AE5CFF</Color> |
173 | - <TextColor>#FFFFFF</TextColor> |
174 | - </Mark> |
175 | - <Mark> |
176 | - <Control>hotcue_22_position</Control> |
177 | - <Text> HOTCUE 22 </Text> |
178 | - <Align>center</Align> |
179 | - <Color>#AE5CFF</Color> |
180 | - <TextColor>#FFFFFF</TextColor> |
181 | - </Mark> |
182 | - <Mark> |
183 | - <Control>hotcue_23_position</Control> |
184 | - <Text> HOTCUE 23 </Text> |
185 | - <Align>center</Align> |
186 | - <Color>#AE5CFF</Color> |
187 | - <TextColor>#FFFFFF</TextColor> |
188 | - </Mark> |
189 | - <Mark> |
190 | - <Control>hotcue_24_position</Control> |
191 | - <Text> HOTCUE 24 </Text> |
192 | - <Align>center</Align> |
193 | - <Color>#AE5CFF</Color> |
194 | - <TextColor>#FFFFFF</TextColor> |
195 | - </Mark> |
196 | - <Mark> |
197 | - <Control>hotcue_25_position</Control> |
198 | - <Text> HOTCUE 25 </Text> |
199 | - <Align>center</Align> |
200 | - <Color>#AE5CFF</Color> |
201 | - <TextColor>#FFFFFF</TextColor> |
202 | - </Mark> |
203 | - <Mark> |
204 | - <Control>hotcue_26_position</Control> |
205 | - <Text> HOTCUE 26 </Text> |
206 | - <Align>center</Align> |
207 | - <Color>#AE5CFF</Color> |
208 | - <TextColor>#FFFFFF</TextColor> |
209 | - </Mark> |
210 | - <Mark> |
211 | - <Control>hotcue_27_position</Control> |
212 | - <Text> HOTCUE 27 </Text> |
213 | - <Align>center</Align> |
214 | - <Color>#AE5CFF</Color> |
215 | - <TextColor>#FFFFFF</TextColor> |
216 | - </Mark> |
217 | - <Mark> |
218 | - <Control>hotcue_28_position</Control> |
219 | - <Text> HOTCUE 28 </Text> |
220 | - <Align>center</Align> |
221 | - <Color>#AE5CFF</Color> |
222 | - <TextColor>#FFFFFF</TextColor> |
223 | - </Mark> |
224 | - <Mark> |
225 | - <Control>hotcue_29_position</Control> |
226 | - <Text> HOTCUE 29 </Text> |
227 | - <Align>center</Align> |
228 | - <Color>#AE5CFF</Color> |
229 | - <TextColor>#FFFFFF</TextColor> |
230 | - </Mark> |
231 | - <Mark> |
232 | - <Control>hotcue_30_position</Control> |
233 | - <Text> HOTCUE 30 </Text> |
234 | - <Align>center</Align> |
235 | - <Color>#AE5CFF</Color> |
236 | - <TextColor>#FFFFFF</TextColor> |
237 | - </Mark> |
238 | - <Mark> |
239 | - <Control>hotcue_31_position</Control> |
240 | - <Text> HOTCUE 31 </Text> |
241 | - <Align>center</Align> |
242 | - <Color>#AE5CFF</Color> |
243 | - <TextColor>#FFFFFF</TextColor> |
244 | - </Mark> |
245 | - <Mark> |
246 | - <Control>hotcue_32_position</Control> |
247 | - <Text> HOTCUE 32 </Text> |
248 | - <Align>center</Align> |
249 | - <Color>#AE5CFF</Color> |
250 | - <TextColor>#FFFFFF</TextColor> |
251 | - </Mark> |
252 | - <Mark> |
253 | - <Control>hotcue_33_position</Control> |
254 | - <Text> HOTCUE 33 </Text> |
255 | - <Align>center</Align> |
256 | - <Color>#AE5CFF</Color> |
257 | - <TextColor>#FFFFFF</TextColor> |
258 | - </Mark> |
259 | - <Mark> |
260 | - <Control>hotcue_34_position</Control> |
261 | - <Text> HOTCUE 34 </Text> |
262 | - <Align>center</Align> |
263 | - <Color>#AE5CFF</Color> |
264 | - <TextColor>#FFFFFF</TextColor> |
265 | - </Mark> |
266 | - <Mark> |
267 | - <Control>hotcue_35_position</Control> |
268 | - <Text> HOTCUE 35 </Text> |
269 | - <Align>center</Align> |
270 | - <Color>#AE5CFF</Color> |
271 | - <TextColor>#FFFFFF</TextColor> |
272 | - </Mark> |
273 | - <Mark> |
274 | - <Control>hotcue_36_position</Control> |
275 | - <Text> HOTCUE 36 </Text> |
276 | - <Align>center</Align> |
277 | - <Color>#AE5CFF</Color> |
278 | - <TextColor>#FFFFFF</TextColor> |
279 | - </Mark> |
280 | - <Mark> |
281 | <Control>cue_point</Control> |
282 | <Pixmap>marker_cue1.png</Pixmap> |
283 | <Text> CUE </Text> |
284 | @@ -4946,230 +4727,11 @@ |
285 | <Color>#00FF00</Color> |
286 | <TextColor>#FFFFFF</TextColor> |
287 | </Mark> |
288 | - <Mark> |
289 | - <Control>hotcue_5_position</Control> |
290 | - <Text> HOTCUE 5 </Text> |
291 | - <Align>center</Align> |
292 | - <Color>#AE5CFF</Color> |
293 | - <TextColor>#FFFFFF</TextColor> |
294 | - </Mark> |
295 | - <Mark> |
296 | - <Control>hotcue_6_position</Control> |
297 | - <Text> HOTCUE 6 </Text> |
298 | - <Align>center</Align> |
299 | - <Color>#AE5CFF</Color> |
300 | - <TextColor>#FFFFFF</TextColor> |
301 | - </Mark> |
302 | - <Mark> |
303 | - <Control>hotcue_7_position</Control> |
304 | - <Text> HOTCUE 7 </Text> |
305 | - <Align>center</Align> |
306 | - <Color>#AE5CFF</Color> |
307 | - <TextColor>#FFFFFF</TextColor> |
308 | - </Mark> |
309 | - <Mark> |
310 | - <Control>hotcue_8_position</Control> |
311 | - <Text> HOTCUE 8 </Text> |
312 | - <Align>center</Align> |
313 | - <Color>#AE5CFF</Color> |
314 | - <TextColor>#FFFFFF</TextColor> |
315 | - </Mark> |
316 | - <Mark> |
317 | - <Control>hotcue_9_position</Control> |
318 | - <Text> HOTCUE 9 </Text> |
319 | - <Align>center</Align> |
320 | - <Color>#AE5CFF</Color> |
321 | - <TextColor>#FFFFFF</TextColor> |
322 | - </Mark> |
323 | - <Mark> |
324 | - <Control>hotcue_10_position</Control> |
325 | - <Text> HOTCUE 10 </Text> |
326 | - <Align>center</Align> |
327 | - <Color>#AE5CFF</Color> |
328 | - <TextColor>#FFFFFF</TextColor> |
329 | - </Mark> |
330 | - <Mark> |
331 | - <Control>hotcue_11_position</Control> |
332 | - <Text> HOTCUE 11 </Text> |
333 | - <Align>center</Align> |
334 | - <Color>#AE5CFF</Color> |
335 | - <TextColor>#FFFFFF</TextColor> |
336 | - </Mark> |
337 | - <Mark> |
338 | - <Control>hotcue_12_position</Control> |
339 | - <Text> HOTCUE 12 </Text> |
340 | - <Align>center</Align> |
341 | - <Color>#AE5CFF</Color> |
342 | - <TextColor>#FFFFFF</TextColor> |
343 | - </Mark> |
344 | - <Mark> |
345 | - <Control>hotcue_13_position</Control> |
346 | - <Text> HOTCUE 13 </Text> |
347 | - <Align>center</Align> |
348 | - <Color>#AE5CFF</Color> |
349 | - <TextColor>#FFFFFF</TextColor> |
350 | - </Mark> |
351 | - <Mark> |
352 | - <Control>hotcue_14_position</Control> |
353 | - <Text> HOTCUE 14 </Text> |
354 | - <Align>center</Align> |
355 | - <Color>#AE5CFF</Color> |
356 | - <TextColor>#FFFFFF</TextColor> |
357 | - </Mark> |
358 | - <Mark> |
359 | - <Control>hotcue_15_position</Control> |
360 | - <Text> HOTCUE 15 </Text> |
361 | - <Align>center</Align> |
362 | - <Color>#AE5CFF</Color> |
363 | - <TextColor>#FFFFFF</TextColor> |
364 | - </Mark> |
365 | - <Mark> |
366 | - <Control>hotcue_16_position</Control> |
367 | - <Text> HOTCUE 16 </Text> |
368 | - <Align>center</Align> |
369 | - <Color>#AE5CFF</Color> |
370 | - <TextColor>#FFFFFF</TextColor> |
371 | - </Mark> |
372 | - <Mark> |
373 | - <Control>hotcue_17_position</Control> |
374 | - <Text> HOTCUE 17 </Text> |
375 | - <Align>center</Align> |
376 | - <Color>#AE5CFF</Color> |
377 | - <TextColor>#FFFFFF</TextColor> |
378 | - </Mark> |
379 | - <Mark> |
380 | - <Control>hotcue_18_position</Control> |
381 | - <Text> HOTCUE 18 </Text> |
382 | - <Align>center</Align> |
383 | - <Color>#AE5CFF</Color> |
384 | - <TextColor>#FFFFFF</TextColor> |
385 | - </Mark> |
386 | - <Mark> |
387 | - <Control>hotcue_19_position</Control> |
388 | - <Text> HOTCUE 19 </Text> |
389 | - <Align>center</Align> |
390 | - <Color>#AE5CFF</Color> |
391 | - <TextColor>#FFFFFF</TextColor> |
392 | - </Mark> |
393 | - <Mark> |
394 | - <Control>hotcue_20_position</Control> |
395 | - <Text> HOTCUE 20 </Text> |
396 | - <Align>center</Align> |
397 | - <Color>#AE5CFF</Color> |
398 | - <TextColor>#FFFFFF</TextColor> |
399 | - </Mark> |
400 | - <Mark> |
401 | - <Control>hotcue_21_position</Control> |
402 | - <Text> HOTCUE 21 </Text> |
403 | - <Align>center</Align> |
404 | - <Color>#AE5CFF</Color> |
405 | - <TextColor>#FFFFFF</TextColor> |
406 | - </Mark> |
407 | - <Mark> |
408 | - <Control>hotcue_22_position</Control> |
409 | - <Text> HOTCUE 22 </Text> |
410 | - <Align>center</Align> |
411 | - <Color>#AE5CFF</Color> |
412 | - <TextColor>#FFFFFF</TextColor> |
413 | - </Mark> |
414 | - <Mark> |
415 | - <Control>hotcue_23_position</Control> |
416 | - <Text> HOTCUE 23 </Text> |
417 | - <Align>center</Align> |
418 | - <Color>#AE5CFF</Color> |
419 | - <TextColor>#FFFFFF</TextColor> |
420 | - </Mark> |
421 | - <Mark> |
422 | - <Control>hotcue_24_position</Control> |
423 | - <Text> HOTCUE 24 </Text> |
424 | - <Align>center</Align> |
425 | - <Color>#AE5CFF</Color> |
426 | - <TextColor>#FFFFFF</TextColor> |
427 | - </Mark> |
428 | - <Mark> |
429 | - <Control>hotcue_25_position</Control> |
430 | - <Text> HOTCUE 25 </Text> |
431 | - <Align>center</Align> |
432 | - <Color>#AE5CFF</Color> |
433 | - <TextColor>#FFFFFF</TextColor> |
434 | - </Mark> |
435 | - <Mark> |
436 | - <Control>hotcue_26_position</Control> |
437 | - <Text> HOTCUE 26 </Text> |
438 | - <Align>center</Align> |
439 | - <Color>#AE5CFF</Color> |
440 | - <TextColor>#FFFFFF</TextColor> |
441 | - </Mark> |
442 | - <Mark> |
443 | - <Control>hotcue_27_position</Control> |
444 | - <Text> HOTCUE 27 </Text> |
445 | - <Align>center</Align> |
446 | - <Color>#AE5CFF</Color> |
447 | - <TextColor>#FFFFFF</TextColor> |
448 | - </Mark> |
449 | - <Mark> |
450 | - <Control>hotcue_28_position</Control> |
451 | - <Text> HOTCUE 28 </Text> |
452 | - <Align>center</Align> |
453 | - <Color>#AE5CFF</Color> |
454 | - <TextColor>#FFFFFF</TextColor> |
455 | - </Mark> |
456 | - <Mark> |
457 | - <Control>hotcue_29_position</Control> |
458 | - <Text> HOTCUE 29 </Text> |
459 | - <Align>center</Align> |
460 | - <Color>#AE5CFF</Color> |
461 | - <TextColor>#FFFFFF</TextColor> |
462 | - </Mark> |
463 | - <Mark> |
464 | - <Control>hotcue_30_position</Control> |
465 | - <Text> HOTCUE 30 </Text> |
466 | - <Align>center</Align> |
467 | - <Color>#AE5CFF</Color> |
468 | - <TextColor>#FFFFFF</TextColor> |
469 | - </Mark> |
470 | - <Mark> |
471 | - <Control>hotcue_31_position</Control> |
472 | - <Text> HOTCUE 31 </Text> |
473 | - <Align>center</Align> |
474 | - <Color>#AE5CFF</Color> |
475 | - <TextColor>#FFFFFF</TextColor> |
476 | - </Mark> |
477 | - <Mark> |
478 | - <Control>hotcue_32_position</Control> |
479 | - <Text> HOTCUE 32 </Text> |
480 | - <Align>center</Align> |
481 | - <Color>#AE5CFF</Color> |
482 | - <TextColor>#FFFFFF</TextColor> |
483 | - </Mark> |
484 | - <Mark> |
485 | - <Control>hotcue_33_position</Control> |
486 | - <Text> HOTCUE 33 </Text> |
487 | - <Align>center</Align> |
488 | - <Color>#AE5CFF</Color> |
489 | - <TextColor>#FFFFFF</TextColor> |
490 | - </Mark> |
491 | - <Mark> |
492 | - <Control>hotcue_34_position</Control> |
493 | - <Text> HOTCUE 34 </Text> |
494 | - <Align>center</Align> |
495 | - <Color>#AE5CFF</Color> |
496 | - <TextColor>#FFFFFF</TextColor> |
497 | - </Mark> |
498 | - <Mark> |
499 | - <Control>hotcue_35_position</Control> |
500 | - <Text> HOTCUE 35 </Text> |
501 | - <Align>center</Align> |
502 | - <Color>#AE5CFF</Color> |
503 | - <TextColor>#FFFFFF</TextColor> |
504 | - </Mark> |
505 | - <Mark> |
506 | - <Control>hotcue_36_position</Control> |
507 | - <Text> HOTCUE 36 </Text> |
508 | - <Align>center</Align> |
509 | - <Color>#AE5CFF</Color> |
510 | - <TextColor>#FFFFFF</TextColor> |
511 | - </Mark> |
512 | + <DefaultMark> |
513 | + <Align>center</Align> |
514 | + <Color>#AE5CFF</Color> |
515 | + <TextColor>#FFFFFF</TextColor> |
516 | + </DefaultMark> |
517 | <Mark> |
518 | <Control>cue_point</Control> |
519 | <Pixmap>marker_cue1.png</Pixmap> |
520 | |
521 | === modified file 'mixxx/src/engine/cuecontrol.cpp' |
522 | --- mixxx/src/engine/cuecontrol.cpp 2012-04-27 07:47:21 +0000 |
523 | +++ mixxx/src/engine/cuecontrol.cpp 2012-05-17 02:22:20 +0000 |
524 | @@ -12,8 +12,6 @@ |
525 | #include "cachingreader.h" |
526 | #include "mathstuff.h" |
527 | |
528 | -#define NUM_HOT_CUES 37 |
529 | - |
530 | CueControl::CueControl(const char * _group, |
531 | ConfigObject<ConfigValue> * _config) : |
532 | EngineControl(_group, _config), |
533 | |
534 | === modified file 'mixxx/src/engine/cuecontrol.h' |
535 | --- mixxx/src/engine/cuecontrol.h 2011-12-10 18:36:04 +0000 |
536 | +++ mixxx/src/engine/cuecontrol.h 2012-05-17 02:22:20 +0000 |
537 | @@ -11,6 +11,8 @@ |
538 | #include "configobject.h" |
539 | #include "trackinfoobject.h" |
540 | |
541 | +#define NUM_HOT_CUES 37 |
542 | + |
543 | class ControlObject; |
544 | class ControlPushButton; |
545 | class Cue; |
546 | |
547 | === modified file 'mixxx/src/skin/legacyskinparser.cpp' |
548 | --- mixxx/src/skin/legacyskinparser.cpp 2012-05-15 21:42:29 +0000 |
549 | +++ mixxx/src/skin/legacyskinparser.cpp 2012-05-17 02:22:20 +0000 |
550 | @@ -431,7 +431,8 @@ |
551 | |
552 | WWaveformViewer* viewer = new WWaveformViewer(pSafeChannelStr, m_pConfig, m_pParent); |
553 | viewer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
554 | - WaveformWidgetFactory::instance()->setWaveformWidget(viewer, node); |
555 | + WaveformWidgetFactory* factory = WaveformWidgetFactory::instance(); |
556 | + factory->setWaveformWidget(viewer, node); |
557 | |
558 | //qDebug() << "::parseVisual: parent" << m_pParent << m_pParent->size(); |
559 | //qDebug() << "::parseVisual: viewer" << viewer << viewer->size(); |
560 | @@ -439,8 +440,6 @@ |
561 | viewer->installEventFilter(m_pKeyboard); |
562 | viewer->installEventFilter(m_pControllerManager->getControllerLearningEventFilter()); |
563 | |
564 | - // Hook up the wheel Control Object to the Visual Controller |
565 | - |
566 | // Connect control proxy to widget, so delete can be handled by the QT object tree |
567 | ControlObjectThreadWidget * p = new ControlObjectThreadWidget( |
568 | ControlObject::getControl(ConfigKey(channelStr, "wheel"))/*, viewer*/); |
569 | |
570 | === modified file 'mixxx/src/waveform/renderers/glslwaveformrenderersignal.cpp' |
571 | --- mixxx/src/waveform/renderers/glslwaveformrenderersignal.cpp 2012-04-05 03:21:25 +0000 |
572 | +++ mixxx/src/waveform/renderers/glslwaveformrenderersignal.cpp 2012-05-17 02:22:20 +0000 |
573 | @@ -2,13 +2,14 @@ |
574 | #include "waveformwidgetrenderer.h" |
575 | |
576 | #include "waveform/waveform.h" |
577 | +#include "waveform/waveformwidgetfactory.h" |
578 | |
579 | #include "mathstuff.h" |
580 | |
581 | #include <QGLFramebufferObject> |
582 | |
583 | GLSLWaveformRendererSignal::GLSLWaveformRendererSignal(WaveformWidgetRenderer* waveformWidgetRenderer) : |
584 | - WaveformRendererAbstract(waveformWidgetRenderer) { |
585 | + WaveformRendererSignalBase(waveformWidgetRenderer) { |
586 | |
587 | m_signalMaxShaderProgram = 0; |
588 | m_frameShaderProgram = 0; |
589 | @@ -204,7 +205,7 @@ |
590 | //qDebug() << bufferWidth; |
591 | } |
592 | |
593 | -void GLSLWaveformRendererSignal::init(){ |
594 | +void GLSLWaveformRendererSignal::onInit(){ |
595 | |
596 | if(!m_signalMaxShaderProgram) |
597 | m_signalMaxShaderProgram = new QGLShaderProgram(); |
598 | @@ -221,8 +222,8 @@ |
599 | loadTexture(); |
600 | } |
601 | |
602 | -void GLSLWaveformRendererSignal::setup(const QDomNode& node) { |
603 | - m_colors.setup(node); |
604 | +void GLSLWaveformRendererSignal::onSetup(const QDomNode& /*node*/) { |
605 | + |
606 | } |
607 | |
608 | void GLSLWaveformRendererSignal::onSetTrack(){ |
609 | @@ -346,8 +347,8 @@ |
610 | float scale = (float)m_framebuffer->width()/(2.0*(float)m_waveformRenderer->getWidth()); |
611 | scale /= (1.0+m_waveformRenderer->getRateAdjust()); |
612 | |
613 | - //NOTE: (vrince) try to move the camera to limit the stepping effect of actula versus current position centering |
614 | - //The following code must be paired with the shader hat compute signal value in texture/gemometry world |
615 | + //NOTE: (vrince) try to move the camera to limit the stepping effect of actual versus current position centering |
616 | + //The following code must be paired with the shader that compute signal value in texture/gemometry world |
617 | /*const int visualSamplePerPixel = m_signalFrameBufferRatio * m_waveformRenderer->getZoomFactor(); |
618 | const int nearestCurrentIndex = int(floor(indexPosition)); |
619 | const float actualIndexPosition = indexPosition - float(nearestCurrentIndex%(2*visualSamplePerPixel)); |
620 | @@ -355,9 +356,22 @@ |
621 | const float range = float(visualSamplePerPixel * m_waveformRenderer->getWidth()); |
622 | const float deltaInGeometry = deltaPosition / range;*/ |
623 | |
624 | + WaveformWidgetFactory* factory = WaveformWidgetFactory::instance(); |
625 | + double visualGain = factory->getVisualGain(WaveformWidgetFactory::All); |
626 | + visualGain *= m_waveformRenderer->getGain(); |
627 | |
628 | glTranslatef( 0.0, 0.0, 0.0); |
629 | - glScalef(scale, 1.0, 1.0); |
630 | + glScalef(scale, visualGain, 1.0); |
631 | + |
632 | + /* |
633 | + //TODO: (vrince) make this line work sometime |
634 | + glBegin(GL_LINES); { |
635 | + glColor4f(m_axesColor.redF(),m_axesColor.greenF(),m_axesColor.blueF(),m_axesColor.alphaF()); |
636 | + glVertex2f(0,0); |
637 | + glVertex2f(m_waveformRenderer->getWidth(),0); |
638 | + } |
639 | + glEnd(); |
640 | + */ |
641 | |
642 | //paint buffer into viewport |
643 | { |
644 | |
645 | === modified file 'mixxx/src/waveform/renderers/glslwaveformrenderersignal.h' |
646 | --- mixxx/src/waveform/renderers/glslwaveformrenderersignal.h 2012-03-27 00:54:20 +0000 |
647 | +++ mixxx/src/waveform/renderers/glslwaveformrenderersignal.h 2012-05-17 02:22:20 +0000 |
648 | @@ -1,20 +1,19 @@ |
649 | #ifndef GLWAVEFORMRENDERERSIGNALSHADER_H |
650 | #define GLWAVEFORMRENDERERSIGNALSHADER_H |
651 | |
652 | -#include "waveformrendererabstract.h" |
653 | -#include "waveformsignalcolors.h" |
654 | +#include "waveformrenderersignalbase.h" |
655 | |
656 | #include <QGLFramebufferObject> |
657 | #include <QGLShaderProgram> |
658 | #include <QtOpenGL> |
659 | |
660 | -class GLSLWaveformRendererSignal : public WaveformRendererAbstract { |
661 | +class GLSLWaveformRendererSignal : public WaveformRendererSignalBase { |
662 | public: |
663 | explicit GLSLWaveformRendererSignal(WaveformWidgetRenderer* waveformWidgetRenderer); |
664 | virtual ~GLSLWaveformRendererSignal(); |
665 | |
666 | - virtual void init(); |
667 | - virtual void setup(const QDomNode& node); |
668 | + virtual void onInit(); |
669 | + virtual void onSetup(const QDomNode& node); |
670 | virtual void draw(QPainter* painter, QPaintEvent* event); |
671 | |
672 | virtual void onSetTrack(); |
673 | @@ -28,13 +27,10 @@ |
674 | void createFrameBuffer(); |
675 | |
676 | GLint m_unitQuadListId; |
677 | - |
678 | GLuint m_textureId; |
679 | |
680 | int m_loadedWaveform; |
681 | |
682 | - WaveformSignalColors m_colors; |
683 | - |
684 | //Frame buffer for two pass rendering |
685 | QGLFramebufferObject* m_signalMaxbuffer; |
686 | QGLFramebufferObject* m_framebuffer; |
687 | |
688 | === modified file 'mixxx/src/waveform/renderers/glwaveformrendererfilteredsignal.cpp' |
689 | --- mixxx/src/waveform/renderers/glwaveformrendererfilteredsignal.cpp 2012-04-15 01:25:21 +0000 |
690 | +++ mixxx/src/waveform/renderers/glwaveformrendererfilteredsignal.cpp 2012-05-17 02:22:20 +0000 |
691 | @@ -1,170 +1,75 @@ |
692 | -#include <QDomNode> |
693 | -#include <QLineF> |
694 | -#include <QLinearGradient> |
695 | -#include <QMutexLocker> |
696 | +#include "controlobjectthreadmain.h" |
697 | |
698 | -#include "controlobject.h" |
699 | #include "defs.h" |
700 | #include "glwaveformrendererfilteredsignal.h" |
701 | #include "trackinfoobject.h" |
702 | #include "waveform/waveform.h" |
703 | #include "waveformwidgetrenderer.h" |
704 | -#include "widget/wskincolor.h" |
705 | -#include "widget/wwidget.h" |
706 | + |
707 | #include "waveform/waveformwidgetfactory.h" |
708 | |
709 | +#include <QDomNode> |
710 | + |
711 | +#include <qgl.h> |
712 | + |
713 | GLWaveformRendererFilteredSignal::GLWaveformRendererFilteredSignal( |
714 | WaveformWidgetRenderer* waveformWidgetRenderer) |
715 | - : WaveformRendererAbstract(waveformWidgetRenderer) { |
716 | - m_lowFilterControlObject = NULL; |
717 | - m_midFilterControlObject = NULL; |
718 | - m_highFilterControlObject = NULL; |
719 | - m_lowKillControlObject = NULL; |
720 | - m_midKillControlObject = NULL; |
721 | - m_highKillControlObject = NULL; |
722 | - m_alignment = Qt::AlignCenter; |
723 | + : WaveformRendererSignalBase(waveformWidgetRenderer) { |
724 | + |
725 | } |
726 | |
727 | GLWaveformRendererFilteredSignal::~GLWaveformRendererFilteredSignal() { |
728 | -} |
729 | - |
730 | -void GLWaveformRendererFilteredSignal::init() { |
731 | - //create controls |
732 | - m_lowFilterControlObject = ControlObject::getControl(ConfigKey(m_waveformRenderer->getGroup(),"filterLow")); |
733 | - m_midFilterControlObject = ControlObject::getControl(ConfigKey(m_waveformRenderer->getGroup(),"filterMid")); |
734 | - m_highFilterControlObject = ControlObject::getControl(ConfigKey(m_waveformRenderer->getGroup(),"filterHigh")); |
735 | - m_lowKillControlObject = ControlObject::getControl(ConfigKey(m_waveformRenderer->getGroup(),"filterLowKill")); |
736 | - m_midKillControlObject = ControlObject::getControl(ConfigKey(m_waveformRenderer->getGroup(),"filterMidKill")); |
737 | - m_highKillControlObject = ControlObject::getControl(ConfigKey(m_waveformRenderer->getGroup(),"filterHighKill")); |
738 | -} |
739 | - |
740 | -void GLWaveformRendererFilteredSignal::setup(const QDomNode& node) { |
741 | - QString alignString = WWidget::selectNodeQString(node, "Align"); |
742 | - if (alignString == "bottom") { |
743 | - m_alignment = Qt::AlignBottom; |
744 | - } else if (alignString == "top") { |
745 | - m_alignment = Qt::AlignTop; |
746 | - } else { |
747 | - m_alignment = Qt::AlignCenter; |
748 | - } |
749 | - |
750 | - m_colors.setup(node); |
751 | - |
752 | - QColor low = m_colors.getLowColor(); |
753 | - QColor mid = m_colors.getMidColor(); |
754 | - QColor high = m_colors.getHighColor(); |
755 | - |
756 | - QColor lowCenter = low; |
757 | - QColor midCenter = mid; |
758 | - QColor highCenter = high; |
759 | - |
760 | - low.setAlphaF(0.9); |
761 | - mid.setAlphaF(0.9); |
762 | - high.setAlphaF(0.9); |
763 | - |
764 | - lowCenter.setAlphaF(0.5); |
765 | - midCenter.setAlphaF(0.5); |
766 | - highCenter.setAlphaF(0.5); |
767 | - |
768 | - QLinearGradient gradientLow(QPointF(0.0,-255.0/2.0),QPointF(0.0,255.0/2.0)); |
769 | - gradientLow.setColorAt(0.0, low); |
770 | - gradientLow.setColorAt(0.25,low.lighter(85)); |
771 | - gradientLow.setColorAt(0.5, lowCenter.darker(115)); |
772 | - gradientLow.setColorAt(0.75,low.lighter(85)); |
773 | - gradientLow.setColorAt(1.0, low); |
774 | - m_lowBrush = QBrush(gradientLow); |
775 | - |
776 | - QLinearGradient gradientMid(QPointF(0.0,-255.0/2.0),QPointF(0.0,255.0/2.0)); |
777 | - gradientMid.setColorAt(0.0, mid); |
778 | - gradientMid.setColorAt(0.35,mid.lighter(85)); |
779 | - gradientMid.setColorAt(0.5, midCenter.darker(115)); |
780 | - gradientMid.setColorAt(0.65,mid.lighter(85)); |
781 | - gradientMid.setColorAt(1.0, mid); |
782 | - m_midBrush = QBrush(gradientMid); |
783 | - |
784 | - QLinearGradient gradientHigh(QPointF(0.0,-255.0/2.0),QPointF(0.0,255.0/2.0)); |
785 | - gradientHigh.setColorAt(0.0, high); |
786 | - gradientHigh.setColorAt(0.45,high.lighter(85)); |
787 | - gradientHigh.setColorAt(0.5, highCenter.darker(115)); |
788 | - gradientHigh.setColorAt(0.55,high.lighter(85)); |
789 | - gradientHigh.setColorAt(1.0, high); |
790 | - m_highBrush = QBrush(gradientHigh); |
791 | - |
792 | - low.setAlphaF(0.3); |
793 | - mid.setAlphaF(0.3); |
794 | - high.setAlphaF(0.3); |
795 | - |
796 | - QLinearGradient gradientKilledLow(QPointF(0.0,-255.0/2.0),QPointF(0.0,255.0/2.0)); |
797 | - gradientKilledLow.setColorAt(0.0,low.darker(80)); |
798 | - gradientKilledLow.setColorAt(0.5,lowCenter.darker(150)); |
799 | - gradientKilledLow.setColorAt(1.0,low.darker(80)); |
800 | - m_lowKilledBrush = QBrush(gradientKilledLow); |
801 | - |
802 | - QLinearGradient gradientKilledMid(QPointF(0.0,-255.0/2.0),QPointF(0.0,255.0/2.0)); |
803 | - gradientKilledMid.setColorAt(0.0,mid.darker(80)); |
804 | - gradientKilledMid.setColorAt(0.5,midCenter.darker(150)); |
805 | - gradientKilledMid.setColorAt(1.0,mid.darker(80)); |
806 | - m_midKilledBrush = QBrush(gradientKilledMid); |
807 | - |
808 | - QLinearGradient gradientKilledHigh(QPointF(0.0,-255.0/2.0),QPointF(0.0,255.0/2.0)); |
809 | - gradientKilledHigh.setColorAt(0.0,high.darker(80)); |
810 | - gradientKilledHigh.setColorAt(0.5,highCenter.darker(150)); |
811 | - gradientKilledHigh.setColorAt(1.0,high.darker(80)); |
812 | - m_highKilledBrush = QBrush(gradientKilledHigh); |
813 | -} |
814 | - |
815 | -void GLWaveformRendererFilteredSignal::onResize() { |
816 | - m_polygon[0].resize(2*m_waveformRenderer->getWidth()+2); |
817 | - m_polygon[1].resize(2*m_waveformRenderer->getWidth()+2); |
818 | - m_polygon[2].resize(2*m_waveformRenderer->getWidth()+2); |
819 | -} |
820 | - |
821 | -inline void setPoint(QPointF& point, qreal x, qreal y) { |
822 | - point.setX(x); |
823 | - point.setY(y); |
824 | -} |
825 | - |
826 | -int GLWaveformRendererFilteredSignal::buildPolygon() { |
827 | - // We have to check the track is present because it might have been unloaded |
828 | - // between the call to draw and the call to buildPolygon |
829 | + |
830 | +} |
831 | + |
832 | +void GLWaveformRendererFilteredSignal::onInit() { |
833 | + |
834 | +} |
835 | + |
836 | +void GLWaveformRendererFilteredSignal::onSetup(const QDomNode& /*node*/) { |
837 | + |
838 | +} |
839 | + |
840 | +void GLWaveformRendererFilteredSignal::draw(QPainter* painter, QPaintEvent* /*event*/) { |
841 | + |
842 | TrackPointer pTrack = m_waveformRenderer->getTrackInfo(); |
843 | if (!pTrack) { |
844 | - return 0; |
845 | + return; |
846 | } |
847 | |
848 | const Waveform* waveform = pTrack->getWaveform(); |
849 | if (waveform == NULL) { |
850 | - return 0; |
851 | + return; |
852 | } |
853 | |
854 | const int dataSize = waveform->getDataSize(); |
855 | if (dataSize <= 1) { |
856 | - return 0; |
857 | + return; |
858 | } |
859 | |
860 | const WaveformData* data = waveform->data(); |
861 | if (data == NULL) { |
862 | - return 0; |
863 | + return; |
864 | } |
865 | |
866 | - const double firstVisualIndex = m_waveformRenderer->getFirstDisplayedPosition() * dataSize; |
867 | - const double lastVisualIndex = m_waveformRenderer->getLastDisplayedPosition() * dataSize; |
868 | - int pointIndex = 0; |
869 | - setPoint(m_polygon[0][pointIndex], 0.0, 0.0); |
870 | - setPoint(m_polygon[1][pointIndex], 0.0, 0.0); |
871 | - setPoint(m_polygon[2][pointIndex], 0.0, 0.0); |
872 | - pointIndex++; |
873 | - |
874 | - const double offset = firstVisualIndex; |
875 | - |
876 | - |
877 | - // Represents the # of waveform data points per horizontal pixel. |
878 | - const double gain = (lastVisualIndex - firstVisualIndex) / |
879 | - (double)m_waveformRenderer->getWidth(); |
880 | - |
881 | - // The number of visual samples that should be represented within one pixel |
882 | - // given our current zoom level and track speed. |
883 | - const double visualSamplePerPixel = m_waveformRenderer->getVisualSamplePerPixel(); |
884 | + double firstVisualIndex = m_waveformRenderer->getFirstDisplayedPosition() * dataSize; |
885 | + double lastVisualIndex = m_waveformRenderer->getLastDisplayedPosition() * dataSize; |
886 | + |
887 | + const int firstIndex = int(firstVisualIndex+0.5); |
888 | + firstVisualIndex = firstIndex - firstIndex%2; |
889 | + |
890 | + const int lastIndex = int(lastVisualIndex+0.5); |
891 | + lastVisualIndex = lastIndex + lastIndex%2; |
892 | + |
893 | + // save the GL state set for QPainter |
894 | + painter->beginNativePainting(); |
895 | + |
896 | + glEnable(GL_BLEND); |
897 | + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
898 | + |
899 | + const QColor& l = m_colors.getLowColor(); |
900 | + const QColor& m = m_colors.getMidColor(); |
901 | + const QColor& h = m_colors.getHighColor(); |
902 | |
903 | // Per-band gain from the EQ knobs. |
904 | float lowGain(1.0), midGain(1.0), highGain(1.0); |
905 | @@ -176,195 +81,143 @@ |
906 | highGain = m_highFilterControlObject->get(); |
907 | } |
908 | |
909 | - //apply separate visual gain |
910 | WaveformWidgetFactory* factory = WaveformWidgetFactory::instance(); |
911 | + double visualGain = factory->getVisualGain(::WaveformWidgetFactory::All); |
912 | lowGain *= factory->getVisualGain(WaveformWidgetFactory::Low); |
913 | midGain *= factory->getVisualGain(WaveformWidgetFactory::Mid); |
914 | highGain *= factory->getVisualGain(WaveformWidgetFactory::High); |
915 | |
916 | - //NOTE(vrince) Please help me find a better name for "channelSeparation" |
917 | - //this variable stand for merged channel ... 1 = merged & 2 = separated |
918 | - int channelSeparation = 2; |
919 | - if (m_alignment != Qt::AlignCenter) |
920 | - channelSeparation = 1; |
921 | - |
922 | - for (int channel = 0; channel < channelSeparation; ++channel) { |
923 | - int startPixel = 0; |
924 | - int endPixel = m_waveformRenderer->getWidth() - 1; |
925 | - int delta = 1; |
926 | - double direction = 1.0; |
927 | - |
928 | - //Reverse display for merged bottom channel |
929 | - if (m_alignment == Qt::AlignBottom) |
930 | - direction = -1.0; |
931 | - |
932 | - if (channel == 1) { |
933 | - startPixel = m_waveformRenderer->getWidth() - 1; |
934 | - endPixel = 0; |
935 | - delta = -1; |
936 | - direction = -1.0; |
937 | - |
938 | - // After preparing the first channel, insert the pivot point. |
939 | - setPoint(m_polygon[0][pointIndex], m_waveformRenderer->getWidth(), 0.0); |
940 | - setPoint(m_polygon[1][pointIndex], m_waveformRenderer->getWidth(), 0.0); |
941 | - setPoint(m_polygon[2][pointIndex], m_waveformRenderer->getWidth(), 0.0); |
942 | - pointIndex++; |
943 | - } |
944 | - |
945 | - for (int x = startPixel; |
946 | - (startPixel < endPixel) ? (x <= endPixel) : (x >= endPixel); |
947 | - x += delta) { |
948 | - |
949 | - // TODO(rryan) remove before 1.11 release. I'm seeing crashes |
950 | - // sometimes where the pointIndex is very very large. It hasn't come |
951 | - // back since adding locking, but I'm leaving this so that we can |
952 | - // get some info about it before crashing. (The crash usually |
953 | - // corrupts a lot of the stack). |
954 | - if (pointIndex > 2*m_waveformRenderer->getWidth()+2) { |
955 | - qDebug() << "OUT OF CONTROL" |
956 | - << 2*m_waveformRenderer->getWidth()+2 |
957 | - << dataSize |
958 | - << channel << pointIndex << x; |
959 | - } |
960 | - |
961 | - // Width of the x position in visual indices. |
962 | - const double xSampleWidth = gain * x; |
963 | - |
964 | - // Effective visual index of x |
965 | - const double xVisualSampleIndex = xSampleWidth + offset; |
966 | - |
967 | - // Our current pixel (x) corresponds to a number of visual samples |
968 | - // (visualSamplerPerPixel) in our waveform object. We take the max of |
969 | - // all the data points on either side of xVisualSampleIndex within a |
970 | - // window of 'maxSamplingRange' visual samples to measure the maximum |
971 | - // data point contained by this pixel. |
972 | - double maxSamplingRange = gain / 2.0; |
973 | - |
974 | - // Since xVisualSampleIndex is in visual-samples (e.g. R,L,R,L) we want |
975 | - // to check +/- maxSamplingRange frames, not samples. To do this, divide |
976 | - // xVisualSampleIndex by 2. Since frames indices are integers, we round |
977 | - // to the nearest integer by adding 0.5 before casting to int. |
978 | - int visualFrameStart = int(xVisualSampleIndex / 2.0 - maxSamplingRange + 0.5); |
979 | - int visualFrameStop = int(xVisualSampleIndex / 2.0 + maxSamplingRange + 0.5); |
980 | - |
981 | - // If the entire sample range is off the screen then don't calculate a |
982 | - // point for this pixel. |
983 | - const int lastVisualFrame = dataSize / 2 - 1; |
984 | - if (visualFrameStop < 0 || visualFrameStart > lastVisualFrame) { |
985 | - setPoint(m_polygon[0][pointIndex], x, 0.0); |
986 | - setPoint(m_polygon[1][pointIndex], x, 0.0); |
987 | - setPoint(m_polygon[2][pointIndex], x, 0.0); |
988 | - pointIndex++; |
989 | - continue; |
990 | - } |
991 | - |
992 | - // We now know that some subset of [visualFrameStart, |
993 | - // visualFrameStop] lies within the valid range of visual |
994 | - // frames. Clamp visualFrameStart/Stop to within [0, |
995 | - // lastVisualFrame]. |
996 | - visualFrameStart = math_max(math_min(lastVisualFrame, visualFrameStart), 0); |
997 | - visualFrameStop = math_max(math_min(lastVisualFrame, visualFrameStop), 0); |
998 | - |
999 | - int visualIndexStart = visualFrameStart * 2 + channel; |
1000 | - int visualIndexStop = visualFrameStop * 2 + channel; |
1001 | - |
1002 | - // if (x == m_waveformRenderer->getWidth() / 2) { |
1003 | - // qDebug() << "audioVisualRatio" << waveform->getAudioVisualRatio(); |
1004 | - // qDebug() << "visualSampleRate" << waveform->getVisualSampleRate(); |
1005 | - // qDebug() << "audioSamplesPerVisualPixel" << waveform->getAudioSamplesPerVisualSample(); |
1006 | - // qDebug() << "visualSamplePerPixel" << visualSamplePerPixel; |
1007 | - // qDebug() << "xSampleWidth" << xSampleWidth; |
1008 | - // qDebug() << "xVisualSampleIndex" << xVisualSampleIndex; |
1009 | - // qDebug() << "maxSamplingRange" << maxSamplingRange;; |
1010 | - // qDebug() << "Sampling pixel " << x << "over [" << visualIndexStart << visualIndexStop << "]"; |
1011 | - // } |
1012 | - |
1013 | - unsigned char maxLow = 0; |
1014 | - unsigned char maxBand = 0; |
1015 | - unsigned char maxHigh = 0; |
1016 | - |
1017 | - for (int i = visualIndexStart; i >= 0 && i < dataSize && i <= visualIndexStop; |
1018 | - i += channelSeparation) { |
1019 | - const WaveformData& waveformData = *(data + i); |
1020 | - unsigned char low = waveformData.filtered.low; |
1021 | - unsigned char mid = waveformData.filtered.mid; |
1022 | - unsigned char high = waveformData.filtered.high; |
1023 | - maxLow = math_max(maxLow, low); |
1024 | - maxBand = math_max(maxBand, mid); |
1025 | - maxHigh = math_max(maxHigh, high); |
1026 | - } |
1027 | - |
1028 | - setPoint(m_polygon[0][pointIndex], x, (float)maxLow*lowGain*direction); |
1029 | - setPoint(m_polygon[1][pointIndex], x, (float)maxBand*midGain*direction); |
1030 | - setPoint(m_polygon[2][pointIndex], x, (float)maxHigh*highGain*direction); |
1031 | - pointIndex++; |
1032 | - } |
1033 | - } |
1034 | - |
1035 | - //If channel are not displyed separatly we nne to close the loop properly |
1036 | - if (channelSeparation == 1) { |
1037 | - setPoint(m_polygon[0][pointIndex], m_waveformRenderer->getWidth(), 0.0); |
1038 | - setPoint(m_polygon[1][pointIndex], m_waveformRenderer->getWidth(), 0.0); |
1039 | - setPoint(m_polygon[2][pointIndex], m_waveformRenderer->getWidth(), 0.0); |
1040 | - pointIndex++; |
1041 | - } |
1042 | - |
1043 | - return pointIndex; |
1044 | -} |
1045 | - |
1046 | -void GLWaveformRendererFilteredSignal::draw(QPainter* painter, QPaintEvent* /*event*/) { |
1047 | - const TrackPointer pTrack = m_waveformRenderer->getTrackInfo(); |
1048 | - if (!pTrack) |
1049 | - return; |
1050 | - |
1051 | - painter->save(); |
1052 | - |
1053 | - painter->setRenderHint(QPainter::Antialiasing); |
1054 | - painter->resetTransform(); |
1055 | - |
1056 | - //visual gain |
1057 | - WaveformWidgetFactory* factory = WaveformWidgetFactory::instance(); |
1058 | - double visualGain = factory->getVisualGain(::WaveformWidgetFactory::All); |
1059 | - |
1060 | - if (m_alignment == Qt::AlignTop) { |
1061 | - painter->translate(0.0,0.0); |
1062 | - painter->scale(1.0,2.0*visualGain*m_waveformRenderer->getGain()*(double)m_waveformRenderer->getHeight()/255.0); |
1063 | - } else if (m_alignment == Qt::AlignBottom) { |
1064 | - painter->translate(0.0,m_waveformRenderer->getHeight()); |
1065 | - painter->scale(1.0,2.0*visualGain*m_waveformRenderer->getGain()*(double)m_waveformRenderer->getHeight()/255.0); |
1066 | - } else { |
1067 | - painter->translate(0.0,m_waveformRenderer->getHeight()/2.0); |
1068 | - painter->scale(1.0,1.0*visualGain*m_waveformRenderer->getGain()*(double)m_waveformRenderer->getHeight()/255.0); |
1069 | - } |
1070 | - |
1071 | - int numberOfPoints = buildPolygon(); |
1072 | - |
1073 | - if (m_lowKillControlObject && m_lowKillControlObject->get() > 0.1) { |
1074 | - painter->setPen(QPen(m_lowKilledBrush, 0.0)); |
1075 | - painter->setBrush(QColor(150,150,150,20)); |
1076 | - } else { |
1077 | - painter->setPen(QPen(m_lowBrush, 0.0)); |
1078 | - painter->setBrush(m_lowBrush); |
1079 | - } |
1080 | - painter->drawPolygon(&m_polygon[0][0],numberOfPoints); |
1081 | - |
1082 | - if (m_midKillControlObject && m_midKillControlObject->get() > 0.1) { |
1083 | - painter->setPen(QPen(m_midKilledBrush, 0.0)); |
1084 | - painter->setBrush(QColor(150,150,150,20)); |
1085 | - } else { |
1086 | - painter->setPen(QPen(m_midBrush, 0.0)); |
1087 | - painter->setBrush(m_midBrush); |
1088 | - } |
1089 | - painter->drawPolygon(&m_polygon[1][0],numberOfPoints); |
1090 | - |
1091 | - if (m_highKillControlObject && m_highKillControlObject->get() > 0.1) { |
1092 | - painter->setPen(QPen(m_highKilledBrush, 0.0)); |
1093 | - painter->setBrush(QColor(150,150,150,20)); |
1094 | - } else { |
1095 | - painter->setPen(QPen(m_highBrush, 0.0)); |
1096 | - painter->setBrush(m_highBrush); |
1097 | - } |
1098 | - painter->drawPolygon(&m_polygon[2][0],numberOfPoints); |
1099 | - |
1100 | - painter->restore(); |
1101 | + float maxLow[2]; |
1102 | + float maxMid[2]; |
1103 | + float maxHigh[2]; |
1104 | + |
1105 | + float meanIndex; |
1106 | + |
1107 | + glPushMatrix(); |
1108 | + |
1109 | + if( m_alignment == Qt::AlignCenter) { |
1110 | + glMatrixMode(GL_PROJECTION); |
1111 | + glLoadIdentity(); |
1112 | + glOrtho(firstVisualIndex, lastVisualIndex, -255.0, 255.0, -10.0, 10.0); |
1113 | + |
1114 | + glMatrixMode(GL_MODELVIEW); |
1115 | + glLoadIdentity(); |
1116 | + |
1117 | + glScalef(1.f,2.f*visualGain*m_waveformRenderer->getGain(),1.f); |
1118 | + |
1119 | + glLineWidth(1.0); |
1120 | + glDisable(GL_LINE_SMOOTH); |
1121 | + |
1122 | + //draw reference line |
1123 | + glBegin(GL_LINES); { |
1124 | + glColor4f(m_axesColor.redF(),m_axesColor.greenF(),m_axesColor.blueF(),m_axesColor.alphaF()); |
1125 | + glVertex2f(firstVisualIndex,0); |
1126 | + glVertex2f(lastVisualIndex,0); |
1127 | + } |
1128 | + glEnd(); |
1129 | + |
1130 | + glLineWidth(1.1); |
1131 | + glEnable(GL_LINE_SMOOTH); |
1132 | + |
1133 | + glBegin(GL_LINES); { |
1134 | + for( int visualIndex = firstVisualIndex; |
1135 | + visualIndex < lastVisualIndex; |
1136 | + visualIndex += 2) { |
1137 | + |
1138 | + if( visualIndex < 0) |
1139 | + continue; |
1140 | + |
1141 | + if( visualIndex > dataSize - 1) |
1142 | + break; |
1143 | + |
1144 | + maxLow[0] = (float)data[visualIndex].filtered.low; |
1145 | + maxMid[0] = (float)data[visualIndex].filtered.mid; |
1146 | + maxHigh[0] = (float)data[visualIndex].filtered.high; |
1147 | + maxLow[1] = (float)data[visualIndex+1].filtered.low; |
1148 | + maxMid[1] = (float)data[visualIndex+1].filtered.mid; |
1149 | + maxHigh[1] = (float)data[visualIndex+1].filtered.high; |
1150 | + |
1151 | + meanIndex = visualIndex; |
1152 | + |
1153 | + glColor4f(l.redF(),l.greenF(),l.blueF(),0.8); |
1154 | + glVertex2f(meanIndex,lowGain*maxLow[0]); |
1155 | + glVertex2f(meanIndex,-1.f*lowGain*maxLow[1]); |
1156 | + |
1157 | + glColor4f(m.redF(),m.greenF(),m.blueF(),0.85); |
1158 | + glVertex2f(meanIndex,midGain*maxMid[0]); |
1159 | + glVertex2f(meanIndex,-1.f*midGain*maxMid[1]); |
1160 | + |
1161 | + glColor4f(h.redF(),h.greenF(),h.blueF(),0.9); |
1162 | + glVertex2f(meanIndex,highGain*maxHigh[0]); |
1163 | + glVertex2f(meanIndex,-1.f*highGain*maxHigh[1]); |
1164 | + } |
1165 | + } |
1166 | + glEnd(); |
1167 | + } else { //top || bottom |
1168 | + glMatrixMode(GL_PROJECTION); |
1169 | + glLoadIdentity(); |
1170 | + if( m_alignment == Qt::AlignBottom) |
1171 | + glOrtho(firstVisualIndex, lastVisualIndex, 0.0, 255.0, -10.0, 10.0); |
1172 | + else |
1173 | + glOrtho(firstVisualIndex, lastVisualIndex, 255.0, 0.0, -10.0, 10.0); |
1174 | + |
1175 | + glMatrixMode(GL_MODELVIEW); |
1176 | + glLoadIdentity(); |
1177 | + |
1178 | + glScalef(1.f,visualGain*m_waveformRenderer->getGain(),1.f); |
1179 | + |
1180 | + glLineWidth(1.1); |
1181 | + glEnable(GL_LINE_SMOOTH); |
1182 | + |
1183 | + glBegin(GL_LINES); { |
1184 | + for( int visualIndex = firstVisualIndex; |
1185 | + visualIndex < lastVisualIndex; |
1186 | + visualIndex += 2) { |
1187 | + |
1188 | + if( visualIndex < 0) |
1189 | + continue; |
1190 | + |
1191 | + if( visualIndex > dataSize - 1) |
1192 | + break; |
1193 | + |
1194 | + maxLow[0] = (float)data[visualIndex].filtered.low; |
1195 | + maxLow[1] = (float)data[visualIndex+1].filtered.low; |
1196 | + maxMid[0] = (float)data[visualIndex].filtered.mid; |
1197 | + maxMid[1] = (float)data[visualIndex+1].filtered.mid; |
1198 | + maxHigh[0] = (float)data[visualIndex].filtered.high; |
1199 | + maxHigh[1] = (float)data[visualIndex+1].filtered.high; |
1200 | + |
1201 | + glColor4f(l.redF(),l.greenF(),l.blueF(),0.8); |
1202 | + glVertex2f(float(visualIndex),0.f); |
1203 | + glVertex2f(float(visualIndex),lowGain*math_max(maxLow[0],maxLow[1])); |
1204 | + |
1205 | + glColor4f(m.redF(),m.greenF(),m.blueF(),0.85); |
1206 | + glVertex2f(float(visualIndex),0.f); |
1207 | + glVertex2f(float(visualIndex),midGain*math_max(maxMid[0],maxMid[1])); |
1208 | + |
1209 | + glColor4f(h.redF(),h.greenF(),h.blueF(),0.9); |
1210 | + glVertex2f(float(visualIndex),0.f); |
1211 | + glVertex2f(float(visualIndex),highGain*math_max(maxHigh[0],maxHigh[1])); |
1212 | + } |
1213 | + } |
1214 | + glEnd(); |
1215 | + } |
1216 | + |
1217 | + glPopMatrix(); |
1218 | + |
1219 | + //DEBUG |
1220 | + /*glDisable(GL_ALPHA_TEST); |
1221 | + glBegin(GL_LINE_LOOP); |
1222 | + { |
1223 | + glColor4f(0.5,1.0,0.5,0.25); |
1224 | + glVertex3f(firstVisualIndex,-1.0f, 0.0f); |
1225 | + glVertex3f(lastVisualIndex, 1.0f, 0.0f); |
1226 | + glVertex3f(lastVisualIndex,-1.0f, 0.0f); |
1227 | + glVertex3f(firstVisualIndex, 1.0f, 0.0f); |
1228 | + } |
1229 | + glEnd();*/ |
1230 | + |
1231 | + glDisable(GL_BLEND); |
1232 | + |
1233 | + painter->endNativePainting(); |
1234 | } |
1235 | |
1236 | === modified file 'mixxx/src/waveform/renderers/glwaveformrendererfilteredsignal.h' |
1237 | --- mixxx/src/waveform/renderers/glwaveformrendererfilteredsignal.h 2012-04-03 00:51:35 +0000 |
1238 | +++ mixxx/src/waveform/renderers/glwaveformrendererfilteredsignal.h 2012-05-17 02:22:20 +0000 |
1239 | @@ -1,48 +1,18 @@ |
1240 | #ifndef GLWAVEFROMRENDERERFILTEREDSIGNAL_H |
1241 | #define GLWAVEFROMRENDERERFILTEREDSIGNAL_H |
1242 | |
1243 | -#include "waveformrendererabstract.h" |
1244 | -#include "waveformsignalcolors.h" |
1245 | - |
1246 | -#include <QBrush> |
1247 | - |
1248 | -#include <vector> |
1249 | +#include "waveformrenderersignalbase.h" |
1250 | |
1251 | class ControlObject; |
1252 | |
1253 | -class GLWaveformRendererFilteredSignal : public WaveformRendererAbstract { |
1254 | +class GLWaveformRendererFilteredSignal : public WaveformRendererSignalBase { |
1255 | public: |
1256 | explicit GLWaveformRendererFilteredSignal( WaveformWidgetRenderer* waveformWidgetRenderer); |
1257 | virtual ~GLWaveformRendererFilteredSignal(); |
1258 | |
1259 | - virtual void init(); |
1260 | - virtual void setup(const QDomNode &node); |
1261 | + virtual void onInit(); |
1262 | + virtual void onSetup(const QDomNode &node); |
1263 | virtual void draw(QPainter* painter, QPaintEvent* event); |
1264 | - |
1265 | - protected: |
1266 | - virtual void onResize(); |
1267 | - int buildPolygon(); |
1268 | - |
1269 | - protected: |
1270 | - ControlObject* m_lowFilterControlObject; |
1271 | - ControlObject* m_midFilterControlObject; |
1272 | - ControlObject* m_highFilterControlObject; |
1273 | - |
1274 | - ControlObject* m_lowKillControlObject; |
1275 | - ControlObject* m_midKillControlObject; |
1276 | - ControlObject* m_highKillControlObject; |
1277 | - |
1278 | - WaveformSignalColors m_colors; |
1279 | - Qt::Alignment m_alignment; |
1280 | - |
1281 | - QBrush m_lowBrush; |
1282 | - QBrush m_midBrush; |
1283 | - QBrush m_highBrush; |
1284 | - QBrush m_lowKilledBrush; |
1285 | - QBrush m_midKilledBrush; |
1286 | - QBrush m_highKilledBrush; |
1287 | - |
1288 | - std::vector<QPointF> m_polygon[3]; |
1289 | }; |
1290 | |
1291 | #endif // GLWAVEFROMRENDERERFILTEREDSIGNAL_H |
1292 | |
1293 | === modified file 'mixxx/src/waveform/renderers/glwaveformrenderersimplesignal.cpp' |
1294 | --- mixxx/src/waveform/renderers/glwaveformrenderersimplesignal.cpp 2012-04-19 02:13:58 +0000 |
1295 | +++ mixxx/src/waveform/renderers/glwaveformrenderersimplesignal.cpp 2012-05-17 02:22:20 +0000 |
1296 | @@ -3,43 +3,23 @@ |
1297 | #include "waveformwidgetrenderer.h" |
1298 | #include "waveform/waveform.h" |
1299 | |
1300 | -#include "widget/wwidget.h" |
1301 | -#include "trackinfoobject.h" |
1302 | - |
1303 | -#include <QLinearGradient> |
1304 | - |
1305 | -GLWaveformRendererSimpleSignal::GLWaveformRendererSimpleSignal( WaveformWidgetRenderer* waveformWidgetRenderer) : |
1306 | - WaveformRendererAbstract( waveformWidgetRenderer) { |
1307 | +#include "waveform/waveformwidgetfactory.h" |
1308 | + |
1309 | +#include <qgl.h> |
1310 | + |
1311 | +GLWaveformRendererSimpleSignal::GLWaveformRendererSimpleSignal( |
1312 | + WaveformWidgetRenderer* waveformWidgetRenderer) |
1313 | + : WaveformRendererSignalBase(waveformWidgetRenderer) { |
1314 | |
1315 | } |
1316 | |
1317 | GLWaveformRendererSimpleSignal::~GLWaveformRendererSimpleSignal(){ |
1318 | } |
1319 | |
1320 | -void GLWaveformRendererSimpleSignal::init(){ |
1321 | +void GLWaveformRendererSimpleSignal::onInit() { |
1322 | } |
1323 | |
1324 | -void GLWaveformRendererSimpleSignal::setup(const QDomNode &node){ |
1325 | - m_colors.setup(node); |
1326 | - |
1327 | - QString alignString = WWidget::selectNodeQString(node, "Align"); |
1328 | - if (alignString == "bottom") { |
1329 | - m_alignment = Qt::AlignBottom; |
1330 | - } else if (alignString == "top") { |
1331 | - m_alignment = Qt::AlignTop; |
1332 | - } else { |
1333 | - m_alignment = Qt::AlignCenter; |
1334 | - } |
1335 | - |
1336 | - QColor signalColor = m_colors.getSignalColor(); |
1337 | - signalColor.setAlphaF(0.8); |
1338 | - |
1339 | - QColor bornderColor = m_colors.getSignalColor().lighter(125); |
1340 | - bornderColor.setAlphaF(0.5); |
1341 | - m_borderPen.setColor(bornderColor); |
1342 | - m_borderPen.setWidthF(1.25); |
1343 | - |
1344 | - m_brush = QBrush(signalColor); |
1345 | +void GLWaveformRendererSimpleSignal::onSetup(const QDomNode &node){ |
1346 | } |
1347 | |
1348 | inline void setPoint(QPointF& point, qreal x, qreal y) { |
1349 | @@ -69,160 +49,115 @@ |
1350 | return; |
1351 | } |
1352 | |
1353 | - painter->save(); |
1354 | - |
1355 | - painter->setRenderHint(QPainter::Antialiasing); |
1356 | - painter->resetTransform(); |
1357 | - |
1358 | - if (m_alignment == Qt::AlignTop) { |
1359 | - painter->translate(0.0,0.0); |
1360 | - painter->scale(1.0,2.0*m_waveformRenderer->getGain()*(double)m_waveformRenderer->getHeight()/255.0); |
1361 | - } else if (m_alignment == Qt::AlignBottom) { |
1362 | - painter->translate(0.0,m_waveformRenderer->getHeight()); |
1363 | - painter->scale(1.0,2.0*m_waveformRenderer->getGain()*(double)m_waveformRenderer->getHeight()/255.0); |
1364 | - } else { |
1365 | - painter->translate(0.0,m_waveformRenderer->getHeight()/2.0); |
1366 | - painter->scale(1.0,1.0*m_waveformRenderer->getGain()*(double)m_waveformRenderer->getHeight()/255.0); |
1367 | - } |
1368 | - |
1369 | - const double firstVisualIndex = m_waveformRenderer->getFirstDisplayedPosition() * dataSize; |
1370 | - const double lastVisualIndex = m_waveformRenderer->getLastDisplayedPosition() * dataSize; |
1371 | - int pointIndex = 0; |
1372 | - setPoint(m_polygon[pointIndex], 0.0, 0.0); |
1373 | - pointIndex++; |
1374 | - |
1375 | - const double offset = firstVisualIndex; |
1376 | - |
1377 | - // Represents the # of waveform data points per horizontal pixel. |
1378 | - const double gain = (lastVisualIndex - firstVisualIndex) / |
1379 | - (double)m_waveformRenderer->getWidth(); |
1380 | - |
1381 | - // The number of visual samples that should be represented within one pixel |
1382 | - // given our current zoom level (this shoud be an dinterger in the 'simple' version |
1383 | - const double visualSamplePerPixel = m_waveformRenderer->getVisualSamplePerPixel(); |
1384 | - |
1385 | - //NOTE(vrince) Please help me find a better name for "channelSeparation" |
1386 | - //this variable stand for merged channel ... 1 = merged & 2 = separated |
1387 | - int channelSeparation = 2; |
1388 | - if (m_alignment != Qt::AlignCenter) |
1389 | - channelSeparation = 1; |
1390 | - |
1391 | - for (int channel = 0; channel < channelSeparation; ++channel) { |
1392 | - int startPixel = 0; |
1393 | - int endPixel = m_waveformRenderer->getWidth() - 1; |
1394 | - int delta = 1; |
1395 | - double direction = 1.0; |
1396 | - |
1397 | - //Reverse display for merged bottom channel |
1398 | - if (m_alignment == Qt::AlignBottom) |
1399 | - direction = -1.0; |
1400 | - |
1401 | - if (channel == 1) { |
1402 | - startPixel = m_waveformRenderer->getWidth() - 1; |
1403 | - endPixel = 0; |
1404 | - delta = -1; |
1405 | - direction = -1.0; |
1406 | - |
1407 | - // After preparing the first channel, insert the pivot point. |
1408 | - setPoint(m_polygon[pointIndex], m_waveformRenderer->getWidth(), 0.0); |
1409 | - pointIndex++; |
1410 | - } |
1411 | - |
1412 | - for (int x = startPixel; |
1413 | - (startPixel < endPixel) ? (x <= endPixel) : (x >= endPixel); |
1414 | - x += delta) { |
1415 | - |
1416 | - // TODO(rryan) remove before 1.11 release. I'm seeing crashes |
1417 | - // sometimes where the pointIndex is very very large. It hasn't come |
1418 | - // back since adding locking, but I'm leaving this so that we can |
1419 | - // get some info about it before crashing. (The crash usually |
1420 | - // corrupts a lot of the stack). |
1421 | - if (pointIndex > 2*m_waveformRenderer->getWidth()+2) { |
1422 | - qDebug() << "OUT OF CONTROL" |
1423 | - << 2*m_waveformRenderer->getWidth()+2 |
1424 | - << dataSize |
1425 | - << channel << pointIndex << x; |
1426 | - } |
1427 | - |
1428 | - // Width of the x position in visual indices. |
1429 | - const double xSampleWidth = gain * x; |
1430 | - |
1431 | - // Effective visual index of x |
1432 | - const double xVisualSampleIndex = xSampleWidth + offset; |
1433 | - |
1434 | - // Our current pixel (x) corresponds to a number of visual samples |
1435 | - // (visualSamplerPerPixel) in our waveform object. We take the max of |
1436 | - // all the data points on either side of xVisualSampleIndex within a |
1437 | - // window of 'maxSamplingRange' visual samples to measure the maximum |
1438 | - // data point contained by this pixel. |
1439 | - double maxSamplingRange = gain / 2.0; |
1440 | - |
1441 | - // Since xVisualSampleIndex is in visual-samples (e.g. R,L,R,L) we want |
1442 | - // to check +/- maxSamplingRange frames, not samples. To do this, divide |
1443 | - // xVisualSampleIndex by 2. Since frames indices are integers, we round |
1444 | - // to the nearest integer by adding 0.5 before casting to int. |
1445 | - int visualFrameStart = int(xVisualSampleIndex / 2.0 - maxSamplingRange + 0.5); |
1446 | - int visualFrameStop = int(xVisualSampleIndex / 2.0 + maxSamplingRange + 0.5); |
1447 | - |
1448 | - // If the entire sample range is off the screen then don't calculate a |
1449 | - // point for this pixel. |
1450 | - const int lastVisualFrame = dataSize / 2 - 1; |
1451 | - if (visualFrameStop < 0 || visualFrameStart > lastVisualFrame) { |
1452 | - setPoint(m_polygon[pointIndex], x, 0.0); |
1453 | - pointIndex++; |
1454 | - continue; |
1455 | - } |
1456 | - |
1457 | - // We now know that some subset of [visualFrameStart, |
1458 | - // visualFrameStop] lies within the valid range of visual |
1459 | - // frames. Clamp visualFrameStart/Stop to within [0, |
1460 | - // lastVisualFrame]. |
1461 | - visualFrameStart = math_max(math_min(lastVisualFrame, visualFrameStart), 0); |
1462 | - visualFrameStop = math_max(math_min(lastVisualFrame, visualFrameStop), 0); |
1463 | - |
1464 | - int visualIndexStart = visualFrameStart * 2 + channel; |
1465 | - int visualIndexStop = visualFrameStop * 2 + channel; |
1466 | - |
1467 | - // if (x == m_waveformRenderer->getWidth() / 2) { |
1468 | - // qDebug() << "audioVisualRatio" << waveform->getAudioVisualRatio(); |
1469 | - // qDebug() << "visualSampleRate" << waveform->getVisualSampleRate(); |
1470 | - // qDebug() << "audioSamplesPerVisualPixel" << waveform->getAudioSamplesPerVisualSample(); |
1471 | - // qDebug() << "visualSamplePerPixel" << visualSamplePerPixel; |
1472 | - // qDebug() << "xSampleWidth" << xSampleWidth; |
1473 | - // qDebug() << "xVisualSampleIndex" << xVisualSampleIndex; |
1474 | - // qDebug() << "maxSamplingRange" << maxSamplingRange;; |
1475 | - // qDebug() << "Sampling pixel " << x << "over [" << visualIndexStart << visualIndexStop << "]"; |
1476 | - // } |
1477 | - |
1478 | - unsigned char maxAll = 0; |
1479 | - |
1480 | - for (int i = visualIndexStart; i >= 0 && i < dataSize && i <= visualIndexStop; |
1481 | - i += channelSeparation) { |
1482 | - const WaveformData& waveformData = *(data + i); |
1483 | - unsigned char all = waveformData.filtered.all; |
1484 | - maxAll = math_max(maxAll, all); |
1485 | - } |
1486 | - |
1487 | - setPoint(m_polygon[pointIndex], x, (float)maxAll*direction); |
1488 | - pointIndex++; |
1489 | - } |
1490 | - } |
1491 | - |
1492 | - //If channel are not displayed separatly we nne to close the loop properly |
1493 | - if (channelSeparation == 1) { |
1494 | - setPoint(m_polygon[pointIndex], m_waveformRenderer->getWidth(), 0.0); |
1495 | - pointIndex++; |
1496 | - } |
1497 | - |
1498 | - painter->setPen(m_borderPen); |
1499 | - painter->setBrush(m_brush); |
1500 | - |
1501 | - painter->drawPolygon(&m_polygon[0], pointIndex); |
1502 | - |
1503 | - painter->restore(); |
1504 | -} |
1505 | - |
1506 | -void GLWaveformRendererSimpleSignal::onResize() { |
1507 | - m_polygon.resize(2*m_waveformRenderer->getWidth()+2); |
1508 | -} |
1509 | + double firstVisualIndex = m_waveformRenderer->getFirstDisplayedPosition() * dataSize; |
1510 | + double lastVisualIndex = m_waveformRenderer->getLastDisplayedPosition() * dataSize; |
1511 | + |
1512 | + const int firstIndex = int(firstVisualIndex+0.5); |
1513 | + firstVisualIndex = firstIndex - firstIndex%2; |
1514 | + |
1515 | + const int lastIndex = int(lastVisualIndex+0.5); |
1516 | + lastVisualIndex = lastIndex + lastIndex%2; |
1517 | + |
1518 | + // save the GL state set for QPainter |
1519 | + painter->beginNativePainting(); |
1520 | + |
1521 | + glEnable(GL_BLEND); |
1522 | + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
1523 | + |
1524 | + const QColor& color = m_colors.getSignalColor(); |
1525 | + |
1526 | + WaveformWidgetFactory* factory = WaveformWidgetFactory::instance(); |
1527 | + const double visualGain = factory->getVisualGain(::WaveformWidgetFactory::All); |
1528 | + |
1529 | + float maxAll[2]; |
1530 | + |
1531 | + glPushMatrix(); |
1532 | + |
1533 | + if( m_alignment == Qt::AlignCenter) { |
1534 | + glMatrixMode(GL_PROJECTION); |
1535 | + glLoadIdentity(); |
1536 | + glOrtho(firstVisualIndex, lastVisualIndex, -255.0, 255.0, -10.0, 10.0); |
1537 | + |
1538 | + glMatrixMode(GL_MODELVIEW); |
1539 | + glLoadIdentity(); |
1540 | + |
1541 | + glScalef(1.f,2.f*visualGain*m_waveformRenderer->getGain(),1.f); |
1542 | + |
1543 | + glLineWidth(1.0); |
1544 | + glDisable(GL_LINE_SMOOTH); |
1545 | + |
1546 | + //draw reference line |
1547 | + glBegin(GL_LINES); { |
1548 | + glColor4f(m_axesColor.redF(),m_axesColor.greenF(),m_axesColor.blueF(),m_axesColor.alphaF()); |
1549 | + glVertex2f(firstVisualIndex,0); |
1550 | + glVertex2f(lastVisualIndex,0); |
1551 | + } |
1552 | + glEnd(); |
1553 | + |
1554 | + glLineWidth(1.1); |
1555 | + glEnable(GL_LINE_SMOOTH); |
1556 | + |
1557 | + glBegin(GL_LINES); { |
1558 | + for( int visualIndex = firstVisualIndex; |
1559 | + visualIndex < lastVisualIndex; |
1560 | + visualIndex += 2) { |
1561 | + |
1562 | + if( visualIndex < 0) |
1563 | + continue; |
1564 | + |
1565 | + if( visualIndex > dataSize - 1) |
1566 | + break; |
1567 | + |
1568 | + maxAll[0] = (float)data[visualIndex].filtered.all; |
1569 | + maxAll[1] = (float)data[visualIndex+1].filtered.all; |
1570 | + glColor4f(color.redF(),color.greenF(),color.blueF(),0.9); |
1571 | + glVertex2f(visualIndex,maxAll[0]); |
1572 | + glVertex2f(visualIndex,-1.f*maxAll[1]); |
1573 | + } |
1574 | + } |
1575 | + glEnd(); |
1576 | + } else { //top || bottom |
1577 | + glMatrixMode(GL_PROJECTION); |
1578 | + glLoadIdentity(); |
1579 | + if( m_alignment == Qt::AlignBottom) |
1580 | + glOrtho(firstVisualIndex, lastVisualIndex, 0.0, 255.0, -10.0, 10.0); |
1581 | + else |
1582 | + glOrtho(firstVisualIndex, lastVisualIndex, 255.0, 0.0, -10.0, 10.0); |
1583 | + |
1584 | + glMatrixMode(GL_MODELVIEW); |
1585 | + glLoadIdentity(); |
1586 | + |
1587 | + glScalef(1.f,visualGain*m_waveformRenderer->getGain(),1.f); |
1588 | + |
1589 | + glLineWidth(1.1); |
1590 | + glEnable(GL_LINE_SMOOTH); |
1591 | + |
1592 | + glBegin(GL_LINES); { |
1593 | + for( int visualIndex = firstVisualIndex; |
1594 | + visualIndex < lastVisualIndex; |
1595 | + visualIndex += 2) { |
1596 | + |
1597 | + if( visualIndex < 0) |
1598 | + continue; |
1599 | + |
1600 | + if( visualIndex > dataSize - 1) |
1601 | + break; |
1602 | + |
1603 | + maxAll[0] = (float)data[visualIndex].filtered.all; |
1604 | + maxAll[1] = (float)data[visualIndex+1].filtered.all; |
1605 | + glColor4f(color.redF(),color.greenF(),color.blueF(),0.8); |
1606 | + glVertex2f(float(visualIndex),0.f); |
1607 | + glVertex2f(float(visualIndex),math_max(maxAll[0],maxAll[1])); |
1608 | + } |
1609 | + } |
1610 | + glEnd(); |
1611 | + } |
1612 | + |
1613 | + glPopMatrix(); |
1614 | + |
1615 | + glDisable(GL_BLEND); |
1616 | + |
1617 | + painter->endNativePainting(); |
1618 | +} |
1619 | + |
1620 | |
1621 | |
1622 | === modified file 'mixxx/src/waveform/renderers/glwaveformrenderersimplesignal.h' |
1623 | --- mixxx/src/waveform/renderers/glwaveformrenderersimplesignal.h 2012-04-12 22:03:01 +0000 |
1624 | +++ mixxx/src/waveform/renderers/glwaveformrenderersimplesignal.h 2012-05-17 02:22:20 +0000 |
1625 | @@ -1,35 +1,18 @@ |
1626 | #ifndef GLWAVEFORMRENDERERSIMPLESIGNAL_H |
1627 | #define GLWAVEFORMRENDERERSIMPLESIGNAL_H |
1628 | |
1629 | -#include "waveformrendererabstract.h" |
1630 | -#include "waveformsignalcolors.h" |
1631 | - |
1632 | -#include <QBrush> |
1633 | -#include <QPen> |
1634 | - |
1635 | -#include <vector> |
1636 | +#include "waveformrenderersignalbase.h" |
1637 | |
1638 | class ControlObject; |
1639 | |
1640 | -class GLWaveformRendererSimpleSignal : public WaveformRendererAbstract { |
1641 | +class GLWaveformRendererSimpleSignal : public WaveformRendererSignalBase { |
1642 | public: |
1643 | explicit GLWaveformRendererSimpleSignal( WaveformWidgetRenderer* waveformWidgetRenderer); |
1644 | virtual ~GLWaveformRendererSimpleSignal(); |
1645 | |
1646 | - virtual void init(); |
1647 | - virtual void setup(const QDomNode &node); |
1648 | + virtual void onInit(); |
1649 | + virtual void onSetup(const QDomNode &node); |
1650 | virtual void draw(QPainter* painter, QPaintEvent* event); |
1651 | - |
1652 | -protected: |
1653 | - virtual void onResize(); |
1654 | - |
1655 | -private: |
1656 | - WaveformSignalColors m_colors; |
1657 | - Qt::Alignment m_alignment; |
1658 | - |
1659 | - QBrush m_brush; |
1660 | - QPen m_borderPen; |
1661 | - std::vector<QPointF> m_polygon; |
1662 | }; |
1663 | |
1664 | #endif // GLWAVEFORMRENDERERSIMPLESIGNAL_H |
1665 | |
1666 | === added file 'mixxx/src/waveform/renderers/qtwaveformrendererfilteredsignal.cpp' |
1667 | --- mixxx/src/waveform/renderers/qtwaveformrendererfilteredsignal.cpp 1970-01-01 00:00:00 +0000 |
1668 | +++ mixxx/src/waveform/renderers/qtwaveformrendererfilteredsignal.cpp 2012-05-17 02:22:20 +0000 |
1669 | @@ -0,0 +1,346 @@ |
1670 | +#include "qtwaveformrendererfilteredsignal.h" |
1671 | + |
1672 | +#include "controlobjectthreadmain.h" |
1673 | +#include "waveformwidgetrenderer.h" |
1674 | +#include "waveform/waveform.h" |
1675 | +#include "waveform/waveformwidgetfactory.h" |
1676 | + |
1677 | +#include "trackinfoobject.h" |
1678 | +#include "defs.h" |
1679 | + |
1680 | +#include <QLineF> |
1681 | +#include <QLinearGradient> |
1682 | + |
1683 | +QtWaveformRendererFilteredSignal::QtWaveformRendererFilteredSignal( |
1684 | + WaveformWidgetRenderer* waveformWidgetRenderer) |
1685 | + : WaveformRendererSignalBase(waveformWidgetRenderer) { |
1686 | +} |
1687 | + |
1688 | +QtWaveformRendererFilteredSignal::~QtWaveformRendererFilteredSignal() { |
1689 | + |
1690 | +} |
1691 | + |
1692 | +void QtWaveformRendererFilteredSignal::onInit() { |
1693 | + |
1694 | +} |
1695 | + |
1696 | +void QtWaveformRendererFilteredSignal::onSetup(const QDomNode& /*node*/) { |
1697 | + QColor low = m_colors.getLowColor(); |
1698 | + QColor mid = m_colors.getMidColor(); |
1699 | + QColor high = m_colors.getHighColor(); |
1700 | + |
1701 | + QColor lowCenter = low; |
1702 | + QColor midCenter = mid; |
1703 | + QColor highCenter = high; |
1704 | + |
1705 | + low.setAlphaF(0.9); |
1706 | + mid.setAlphaF(0.9); |
1707 | + high.setAlphaF(0.9); |
1708 | + |
1709 | + lowCenter.setAlphaF(0.5); |
1710 | + midCenter.setAlphaF(0.5); |
1711 | + highCenter.setAlphaF(0.5); |
1712 | + |
1713 | + QLinearGradient gradientLow(QPointF(0.0,-255.0/2.0),QPointF(0.0,255.0/2.0)); |
1714 | + gradientLow.setColorAt(0.0, low); |
1715 | + gradientLow.setColorAt(0.25,low.lighter(85)); |
1716 | + gradientLow.setColorAt(0.5, lowCenter.darker(115)); |
1717 | + gradientLow.setColorAt(0.75,low.lighter(85)); |
1718 | + gradientLow.setColorAt(1.0, low); |
1719 | + m_lowBrush = QBrush(gradientLow); |
1720 | + |
1721 | + QLinearGradient gradientMid(QPointF(0.0,-255.0/2.0),QPointF(0.0,255.0/2.0)); |
1722 | + gradientMid.setColorAt(0.0, mid); |
1723 | + gradientMid.setColorAt(0.35,mid.lighter(85)); |
1724 | + gradientMid.setColorAt(0.5, midCenter.darker(115)); |
1725 | + gradientMid.setColorAt(0.65,mid.lighter(85)); |
1726 | + gradientMid.setColorAt(1.0, mid); |
1727 | + m_midBrush = QBrush(gradientMid); |
1728 | + |
1729 | + QLinearGradient gradientHigh(QPointF(0.0,-255.0/2.0),QPointF(0.0,255.0/2.0)); |
1730 | + gradientHigh.setColorAt(0.0, high); |
1731 | + gradientHigh.setColorAt(0.45,high.lighter(85)); |
1732 | + gradientHigh.setColorAt(0.5, highCenter.darker(115)); |
1733 | + gradientHigh.setColorAt(0.55,high.lighter(85)); |
1734 | + gradientHigh.setColorAt(1.0, high); |
1735 | + m_highBrush = QBrush(gradientHigh); |
1736 | + |
1737 | + low.setAlphaF(0.3); |
1738 | + mid.setAlphaF(0.3); |
1739 | + high.setAlphaF(0.3); |
1740 | + |
1741 | + QLinearGradient gradientKilledLow(QPointF(0.0,-255.0/2.0),QPointF(0.0,255.0/2.0)); |
1742 | + gradientKilledLow.setColorAt(0.0,low.darker(80)); |
1743 | + gradientKilledLow.setColorAt(0.5,lowCenter.darker(150)); |
1744 | + gradientKilledLow.setColorAt(1.0,low.darker(80)); |
1745 | + m_lowKilledBrush = QBrush(gradientKilledLow); |
1746 | + |
1747 | + QLinearGradient gradientKilledMid(QPointF(0.0,-255.0/2.0),QPointF(0.0,255.0/2.0)); |
1748 | + gradientKilledMid.setColorAt(0.0,mid.darker(80)); |
1749 | + gradientKilledMid.setColorAt(0.5,midCenter.darker(150)); |
1750 | + gradientKilledMid.setColorAt(1.0,mid.darker(80)); |
1751 | + m_midKilledBrush = QBrush(gradientKilledMid); |
1752 | + |
1753 | + QLinearGradient gradientKilledHigh(QPointF(0.0,-255.0/2.0),QPointF(0.0,255.0/2.0)); |
1754 | + gradientKilledHigh.setColorAt(0.0,high.darker(80)); |
1755 | + gradientKilledHigh.setColorAt(0.5,highCenter.darker(150)); |
1756 | + gradientKilledHigh.setColorAt(1.0,high.darker(80)); |
1757 | + m_highKilledBrush = QBrush(gradientKilledHigh); |
1758 | +} |
1759 | + |
1760 | +void QtWaveformRendererFilteredSignal::onResize() { |
1761 | + m_polygon[0].resize(2*m_waveformRenderer->getWidth()+2); |
1762 | + m_polygon[1].resize(2*m_waveformRenderer->getWidth()+2); |
1763 | + m_polygon[2].resize(2*m_waveformRenderer->getWidth()+2); |
1764 | +} |
1765 | + |
1766 | +inline void setPoint(QPointF& point, qreal x, qreal y) { |
1767 | + point.setX(x); |
1768 | + point.setY(y); |
1769 | +} |
1770 | + |
1771 | +int QtWaveformRendererFilteredSignal::buildPolygon() { |
1772 | + // We have to check the track is present because it might have been unloaded |
1773 | + // between the call to draw and the call to buildPolygon |
1774 | + TrackPointer pTrack = m_waveformRenderer->getTrackInfo(); |
1775 | + if (!pTrack) { |
1776 | + return 0; |
1777 | + } |
1778 | + |
1779 | + const Waveform* waveform = pTrack->getWaveform(); |
1780 | + if (waveform == NULL) { |
1781 | + return 0; |
1782 | + } |
1783 | + |
1784 | + const int dataSize = waveform->getDataSize(); |
1785 | + if (dataSize <= 1) { |
1786 | + return 0; |
1787 | + } |
1788 | + |
1789 | + const WaveformData* data = waveform->data(); |
1790 | + if (data == NULL) { |
1791 | + return 0; |
1792 | + } |
1793 | + |
1794 | + const double firstVisualIndex = m_waveformRenderer->getFirstDisplayedPosition() * dataSize; |
1795 | + const double lastVisualIndex = m_waveformRenderer->getLastDisplayedPosition() * dataSize; |
1796 | + int pointIndex = 0; |
1797 | + setPoint(m_polygon[0][pointIndex], 0.0, 0.0); |
1798 | + setPoint(m_polygon[1][pointIndex], 0.0, 0.0); |
1799 | + setPoint(m_polygon[2][pointIndex], 0.0, 0.0); |
1800 | + pointIndex++; |
1801 | + |
1802 | + const double offset = firstVisualIndex; |
1803 | + |
1804 | + // Represents the # of waveform data points per horizontal pixel. |
1805 | + const double gain = (lastVisualIndex - firstVisualIndex) / |
1806 | + (double)m_waveformRenderer->getWidth(); |
1807 | + |
1808 | + // Per-band gain from the EQ knobs. |
1809 | + float lowGain(1.0), midGain(1.0), highGain(1.0); |
1810 | + if (m_lowFilterControlObject && |
1811 | + m_midFilterControlObject && |
1812 | + m_highFilterControlObject) { |
1813 | + lowGain = m_lowFilterControlObject->get(); |
1814 | + midGain = m_midFilterControlObject->get(); |
1815 | + highGain = m_highFilterControlObject->get(); |
1816 | + } |
1817 | + |
1818 | + //apply separate visual gain |
1819 | + WaveformWidgetFactory* factory = WaveformWidgetFactory::instance(); |
1820 | + lowGain *= factory->getVisualGain(WaveformWidgetFactory::Low); |
1821 | + midGain *= factory->getVisualGain(WaveformWidgetFactory::Mid); |
1822 | + highGain *= factory->getVisualGain(WaveformWidgetFactory::High); |
1823 | + |
1824 | + //NOTE(vrince) Please help me find a better name for "channelSeparation" |
1825 | + //this variable stand for merged channel ... 1 = merged & 2 = separated |
1826 | + int channelSeparation = 2; |
1827 | + if (m_alignment != Qt::AlignCenter) |
1828 | + channelSeparation = 1; |
1829 | + |
1830 | + for (int channel = 0; channel < channelSeparation; ++channel) { |
1831 | + int startPixel = 0; |
1832 | + int endPixel = m_waveformRenderer->getWidth() - 1; |
1833 | + int delta = 1; |
1834 | + double direction = 1.0; |
1835 | + |
1836 | + //Reverse display for merged bottom channel |
1837 | + if (m_alignment == Qt::AlignBottom) |
1838 | + direction = -1.0; |
1839 | + |
1840 | + if (channel == 1) { |
1841 | + startPixel = m_waveformRenderer->getWidth() - 1; |
1842 | + endPixel = 0; |
1843 | + delta = -1; |
1844 | + direction = -1.0; |
1845 | + |
1846 | + // After preparing the first channel, insert the pivot point. |
1847 | + setPoint(m_polygon[0][pointIndex], m_waveformRenderer->getWidth(), 0.0); |
1848 | + setPoint(m_polygon[1][pointIndex], m_waveformRenderer->getWidth(), 0.0); |
1849 | + setPoint(m_polygon[2][pointIndex], m_waveformRenderer->getWidth(), 0.0); |
1850 | + pointIndex++; |
1851 | + } |
1852 | + |
1853 | + for (int x = startPixel; |
1854 | + (startPixel < endPixel) ? (x <= endPixel) : (x >= endPixel); |
1855 | + x += delta) { |
1856 | + |
1857 | + // TODO(rryan) remove before 1.11 release. I'm seeing crashes |
1858 | + // sometimes where the pointIndex is very very large. It hasn't come |
1859 | + // back since adding locking, but I'm leaving this so that we can |
1860 | + // get some info about it before crashing. (The crash usually |
1861 | + // corrupts a lot of the stack). |
1862 | + if (pointIndex > 2*m_waveformRenderer->getWidth()+2) { |
1863 | + qDebug() << "OUT OF CONTROL" |
1864 | + << 2*m_waveformRenderer->getWidth()+2 |
1865 | + << dataSize |
1866 | + << channel << pointIndex << x; |
1867 | + } |
1868 | + |
1869 | + // Width of the x position in visual indices. |
1870 | + const double xSampleWidth = gain * x; |
1871 | + |
1872 | + // Effective visual index of x |
1873 | + const double xVisualSampleIndex = xSampleWidth + offset; |
1874 | + |
1875 | + // Our current pixel (x) corresponds to a number of visual samples |
1876 | + // (visualSamplerPerPixel) in our waveform object. We take the max of |
1877 | + // all the data points on either side of xVisualSampleIndex within a |
1878 | + // window of 'maxSamplingRange' visual samples to measure the maximum |
1879 | + // data point contained by this pixel. |
1880 | + double maxSamplingRange = gain / 2.0; |
1881 | + |
1882 | + // Since xVisualSampleIndex is in visual-samples (e.g. R,L,R,L) we want |
1883 | + // to check +/- maxSamplingRange frames, not samples. To do this, divide |
1884 | + // xVisualSampleIndex by 2. Since frames indices are integers, we round |
1885 | + // to the nearest integer by adding 0.5 before casting to int. |
1886 | + int visualFrameStart = int(xVisualSampleIndex / 2.0 - maxSamplingRange + 0.5); |
1887 | + int visualFrameStop = int(xVisualSampleIndex / 2.0 + maxSamplingRange + 0.5); |
1888 | + |
1889 | + // If the entire sample range is off the screen then don't calculate a |
1890 | + // point for this pixel. |
1891 | + const int lastVisualFrame = dataSize / 2 - 1; |
1892 | + if (visualFrameStop < 0 || visualFrameStart > lastVisualFrame) { |
1893 | + setPoint(m_polygon[0][pointIndex], x, 0.0); |
1894 | + setPoint(m_polygon[1][pointIndex], x, 0.0); |
1895 | + setPoint(m_polygon[2][pointIndex], x, 0.0); |
1896 | + pointIndex++; |
1897 | + continue; |
1898 | + } |
1899 | + |
1900 | + // We now know that some subset of [visualFrameStart, |
1901 | + // visualFrameStop] lies within the valid range of visual |
1902 | + // frames. Clamp visualFrameStart/Stop to within [0, |
1903 | + // lastVisualFrame]. |
1904 | + visualFrameStart = math_max(math_min(lastVisualFrame, visualFrameStart), 0); |
1905 | + visualFrameStop = math_max(math_min(lastVisualFrame, visualFrameStop), 0); |
1906 | + |
1907 | + int visualIndexStart = visualFrameStart * 2 + channel; |
1908 | + int visualIndexStop = visualFrameStop * 2 + channel; |
1909 | + |
1910 | + // if (x == m_waveformRenderer->getWidth() / 2) { |
1911 | + // qDebug() << "audioVisualRatio" << waveform->getAudioVisualRatio(); |
1912 | + // qDebug() << "visualSampleRate" << waveform->getVisualSampleRate(); |
1913 | + // qDebug() << "audioSamplesPerVisualPixel" << waveform->getAudioSamplesPerVisualSample(); |
1914 | + // qDebug() << "visualSamplePerPixel" << visualSamplePerPixel; |
1915 | + // qDebug() << "xSampleWidth" << xSampleWidth; |
1916 | + // qDebug() << "xVisualSampleIndex" << xVisualSampleIndex; |
1917 | + // qDebug() << "maxSamplingRange" << maxSamplingRange;; |
1918 | + // qDebug() << "Sampling pixel " << x << "over [" << visualIndexStart << visualIndexStop << "]"; |
1919 | + // } |
1920 | + |
1921 | + unsigned char maxLow = 0; |
1922 | + unsigned char maxBand = 0; |
1923 | + unsigned char maxHigh = 0; |
1924 | + |
1925 | + for (int i = visualIndexStart; i >= 0 && i < dataSize && i <= visualIndexStop; |
1926 | + i += channelSeparation) { |
1927 | + const WaveformData& waveformData = *(data + i); |
1928 | + unsigned char low = waveformData.filtered.low; |
1929 | + unsigned char mid = waveformData.filtered.mid; |
1930 | + unsigned char high = waveformData.filtered.high; |
1931 | + maxLow = math_max(maxLow, low); |
1932 | + maxBand = math_max(maxBand, mid); |
1933 | + maxHigh = math_max(maxHigh, high); |
1934 | + } |
1935 | + |
1936 | + setPoint(m_polygon[0][pointIndex], x, (float)maxLow*lowGain*direction); |
1937 | + setPoint(m_polygon[1][pointIndex], x, (float)maxBand*midGain*direction); |
1938 | + setPoint(m_polygon[2][pointIndex], x, (float)maxHigh*highGain*direction); |
1939 | + pointIndex++; |
1940 | + } |
1941 | + } |
1942 | + |
1943 | + //If channel are not displyed separatly we nne to close the loop properly |
1944 | + if (channelSeparation == 1) { |
1945 | + setPoint(m_polygon[0][pointIndex], m_waveformRenderer->getWidth(), 0.0); |
1946 | + setPoint(m_polygon[1][pointIndex], m_waveformRenderer->getWidth(), 0.0); |
1947 | + setPoint(m_polygon[2][pointIndex], m_waveformRenderer->getWidth(), 0.0); |
1948 | + pointIndex++; |
1949 | + } |
1950 | + |
1951 | + return pointIndex; |
1952 | +} |
1953 | + |
1954 | +void QtWaveformRendererFilteredSignal::draw(QPainter* painter, QPaintEvent* /*event*/) { |
1955 | + const TrackPointer pTrack = m_waveformRenderer->getTrackInfo(); |
1956 | + if (!pTrack) |
1957 | + return; |
1958 | + |
1959 | + painter->save(); |
1960 | + |
1961 | + painter->setRenderHint(QPainter::Antialiasing); |
1962 | + painter->resetTransform(); |
1963 | + |
1964 | + //visual gain |
1965 | + WaveformWidgetFactory* factory = WaveformWidgetFactory::instance(); |
1966 | + double visualGain = factory->getVisualGain(::WaveformWidgetFactory::All); |
1967 | + |
1968 | + if (m_alignment == Qt::AlignTop) { |
1969 | + painter->translate(0.0,0.0); |
1970 | + painter->scale(1.0,2.0*visualGain*m_waveformRenderer->getGain()*(double)m_waveformRenderer->getHeight()/255.0); |
1971 | + } else if (m_alignment == Qt::AlignBottom) { |
1972 | + painter->translate(0.0,m_waveformRenderer->getHeight()); |
1973 | + painter->scale(1.0,2.0*visualGain*m_waveformRenderer->getGain()*(double)m_waveformRenderer->getHeight()/255.0); |
1974 | + } else { |
1975 | + painter->translate(0.0,m_waveformRenderer->getHeight()/2.0); |
1976 | + painter->scale(1.0,1.0*visualGain*m_waveformRenderer->getGain()*(double)m_waveformRenderer->getHeight()/255.0); |
1977 | + } |
1978 | + |
1979 | + //draw reference line |
1980 | + if( m_alignment == Qt::AlignCenter) { |
1981 | + painter->setPen(m_axesColor); |
1982 | + painter->drawLine(0,0,m_waveformRenderer->getWidth(),0); |
1983 | + } |
1984 | + |
1985 | + int numberOfPoints = buildPolygon(); |
1986 | + |
1987 | + if (m_lowKillControlObject && m_lowKillControlObject->get() > 0.1) { |
1988 | + painter->setPen(QPen(m_lowKilledBrush, 0.0)); |
1989 | + painter->setBrush(QColor(150,150,150,20)); |
1990 | + } else { |
1991 | + painter->setPen(QPen(m_lowBrush, 0.0)); |
1992 | + painter->setBrush(m_lowBrush); |
1993 | + } |
1994 | + painter->drawPolygon(&m_polygon[0][0],numberOfPoints); |
1995 | + |
1996 | + if (m_midKillControlObject && m_midKillControlObject->get() > 0.1) { |
1997 | + painter->setPen(QPen(m_midKilledBrush, 0.0)); |
1998 | + painter->setBrush(QColor(150,150,150,20)); |
1999 | + } else { |
2000 | + painter->setPen(QPen(m_midBrush, 0.0)); |
2001 | + painter->setBrush(m_midBrush); |
2002 | + } |
2003 | + painter->drawPolygon(&m_polygon[1][0],numberOfPoints); |
2004 | + |
2005 | + if (m_highKillControlObject && m_highKillControlObject->get() > 0.1) { |
2006 | + painter->setPen(QPen(m_highKilledBrush, 0.0)); |
2007 | + painter->setBrush(QColor(150,150,150,20)); |
2008 | + } else { |
2009 | + painter->setPen(QPen(m_highBrush, 0.0)); |
2010 | + painter->setBrush(m_highBrush); |
2011 | + } |
2012 | + painter->drawPolygon(&m_polygon[2][0],numberOfPoints); |
2013 | + |
2014 | + painter->restore(); |
2015 | +} |
2016 | |
2017 | === added file 'mixxx/src/waveform/renderers/qtwaveformrendererfilteredsignal.h' |
2018 | --- mixxx/src/waveform/renderers/qtwaveformrendererfilteredsignal.h 1970-01-01 00:00:00 +0000 |
2019 | +++ mixxx/src/waveform/renderers/qtwaveformrendererfilteredsignal.h 2012-05-17 02:22:20 +0000 |
2020 | @@ -0,0 +1,36 @@ |
2021 | +#ifndef QTWAVEFROMRENDERERFILTEREDSIGNAL_H |
2022 | +#define QTWAVEFROMRENDERERFILTEREDSIGNAL_H |
2023 | + |
2024 | +#include "waveformrenderersignalbase.h" |
2025 | + |
2026 | +#include <QBrush> |
2027 | + |
2028 | +#include <vector> |
2029 | + |
2030 | +class ControlObject; |
2031 | + |
2032 | +class QtWaveformRendererFilteredSignal : public WaveformRendererSignalBase { |
2033 | + public: |
2034 | + explicit QtWaveformRendererFilteredSignal( WaveformWidgetRenderer* waveformWidgetRenderer); |
2035 | + virtual ~QtWaveformRendererFilteredSignal(); |
2036 | + |
2037 | + virtual void onInit(); |
2038 | + virtual void onSetup(const QDomNode &node); |
2039 | + virtual void draw(QPainter* painter, QPaintEvent* event); |
2040 | + |
2041 | + protected: |
2042 | + virtual void onResize(); |
2043 | + int buildPolygon(); |
2044 | + |
2045 | + protected: |
2046 | + QBrush m_lowBrush; |
2047 | + QBrush m_midBrush; |
2048 | + QBrush m_highBrush; |
2049 | + QBrush m_lowKilledBrush; |
2050 | + QBrush m_midKilledBrush; |
2051 | + QBrush m_highKilledBrush; |
2052 | + |
2053 | + std::vector<QPointF> m_polygon[3]; |
2054 | +}; |
2055 | + |
2056 | +#endif // QTWAVEFROMRENDERERFILTEREDSIGNAL_H |
2057 | |
2058 | === added file 'mixxx/src/waveform/renderers/qtwaveformrenderersimplesignal.cpp' |
2059 | --- mixxx/src/waveform/renderers/qtwaveformrenderersimplesignal.cpp 1970-01-01 00:00:00 +0000 |
2060 | +++ mixxx/src/waveform/renderers/qtwaveformrenderersimplesignal.cpp 2012-05-17 02:22:20 +0000 |
2061 | @@ -0,0 +1,223 @@ |
2062 | +#include "qtwaveformrenderersimplesignal.h" |
2063 | + |
2064 | +#include "waveformwidgetrenderer.h" |
2065 | +#include "waveform/waveform.h" |
2066 | +#include "waveform/waveformwidgetfactory.h" |
2067 | + |
2068 | +#include "widget/wwidget.h" |
2069 | +#include "trackinfoobject.h" |
2070 | + |
2071 | +#include <QLinearGradient> |
2072 | + |
2073 | +QtWaveformRendererSimpleSignal::QtWaveformRendererSimpleSignal( WaveformWidgetRenderer* waveformWidgetRenderer) : |
2074 | + WaveformRendererSignalBase( waveformWidgetRenderer) { |
2075 | + |
2076 | +} |
2077 | + |
2078 | +QtWaveformRendererSimpleSignal::~QtWaveformRendererSimpleSignal(){ |
2079 | +} |
2080 | + |
2081 | +void QtWaveformRendererSimpleSignal::onInit(){ |
2082 | +} |
2083 | + |
2084 | +void QtWaveformRendererSimpleSignal::onSetup(const QDomNode &node){ |
2085 | + QColor signalColor = m_colors.getSignalColor(); |
2086 | + signalColor.setAlphaF(0.8); |
2087 | + |
2088 | + QColor bornderColor = m_colors.getSignalColor().lighter(125); |
2089 | + bornderColor.setAlphaF(0.5); |
2090 | + m_borderPen.setColor(bornderColor); |
2091 | + m_borderPen.setWidthF(1.25); |
2092 | + |
2093 | + m_brush = QBrush(signalColor); |
2094 | +} |
2095 | + |
2096 | +inline void setPoint(QPointF& point, qreal x, qreal y) { |
2097 | + point.setX(x); |
2098 | + point.setY(y); |
2099 | +} |
2100 | + |
2101 | +void QtWaveformRendererSimpleSignal::draw(QPainter* painter, QPaintEvent* /*event*/){ |
2102 | + |
2103 | + TrackPointer pTrack = m_waveformRenderer->getTrackInfo(); |
2104 | + if (!pTrack) { |
2105 | + return; |
2106 | + } |
2107 | + |
2108 | + const Waveform* waveform = pTrack->getWaveform(); |
2109 | + if (waveform == NULL) { |
2110 | + return; |
2111 | + } |
2112 | + |
2113 | + const int dataSize = waveform->getDataSize(); |
2114 | + if (dataSize <= 1) { |
2115 | + return; |
2116 | + } |
2117 | + |
2118 | + const WaveformData* data = waveform->data(); |
2119 | + if (data == NULL) { |
2120 | + return; |
2121 | + } |
2122 | + |
2123 | + painter->save(); |
2124 | + |
2125 | + painter->setRenderHint(QPainter::Antialiasing); |
2126 | + painter->resetTransform(); |
2127 | + |
2128 | + WaveformWidgetFactory* factory = WaveformWidgetFactory::instance(); |
2129 | + const double visualGain = factory->getVisualGain(WaveformWidgetFactory::All); |
2130 | + |
2131 | + if (m_alignment == Qt::AlignTop) { |
2132 | + painter->translate(0.0,0.0); |
2133 | + painter->scale(1.0,2.0*visualGain*m_waveformRenderer->getGain()*(double)m_waveformRenderer->getHeight()/255.0); |
2134 | + } else if (m_alignment == Qt::AlignBottom) { |
2135 | + painter->translate(0.0,m_waveformRenderer->getHeight()); |
2136 | + painter->scale(1.0,2.0*visualGain*m_waveformRenderer->getGain()*(double)m_waveformRenderer->getHeight()/255.0); |
2137 | + } else { |
2138 | + painter->translate(0.0,m_waveformRenderer->getHeight()/2.0); |
2139 | + painter->scale(1.0,1.0*visualGain*m_waveformRenderer->getGain()*(double)m_waveformRenderer->getHeight()/255.0); |
2140 | + } |
2141 | + |
2142 | + //draw reference line |
2143 | + if( m_alignment == Qt::AlignCenter) { |
2144 | + painter->setPen(m_axesColor); |
2145 | + painter->drawLine(0,0,m_waveformRenderer->getWidth(),0); |
2146 | + } |
2147 | + |
2148 | + const double firstVisualIndex = m_waveformRenderer->getFirstDisplayedPosition() * dataSize; |
2149 | + const double lastVisualIndex = m_waveformRenderer->getLastDisplayedPosition() * dataSize; |
2150 | + int pointIndex = 0; |
2151 | + setPoint(m_polygon[pointIndex], 0.0, 0.0); |
2152 | + pointIndex++; |
2153 | + |
2154 | + const double offset = firstVisualIndex; |
2155 | + |
2156 | + // Represents the # of waveform data points per horizontal pixel. |
2157 | + const double gain = (lastVisualIndex - firstVisualIndex) / |
2158 | + (double)m_waveformRenderer->getWidth(); |
2159 | + |
2160 | + //NOTE(vrince) Please help me find a better name for "channelSeparation" |
2161 | + //this variable stand for merged channel ... 1 = merged & 2 = separated |
2162 | + int channelSeparation = 2; |
2163 | + if (m_alignment != Qt::AlignCenter) |
2164 | + channelSeparation = 1; |
2165 | + |
2166 | + for (int channel = 0; channel < channelSeparation; ++channel) { |
2167 | + int startPixel = 0; |
2168 | + int endPixel = m_waveformRenderer->getWidth() - 1; |
2169 | + int delta = 1; |
2170 | + double direction = 1.0; |
2171 | + |
2172 | + //Reverse display for merged bottom channel |
2173 | + if (m_alignment == Qt::AlignBottom) |
2174 | + direction = -1.0; |
2175 | + |
2176 | + if (channel == 1) { |
2177 | + startPixel = m_waveformRenderer->getWidth() - 1; |
2178 | + endPixel = 0; |
2179 | + delta = -1; |
2180 | + direction = -1.0; |
2181 | + |
2182 | + // After preparing the first channel, insert the pivot point. |
2183 | + setPoint(m_polygon[pointIndex], m_waveformRenderer->getWidth(), 0.0); |
2184 | + pointIndex++; |
2185 | + } |
2186 | + |
2187 | + for (int x = startPixel; |
2188 | + (startPixel < endPixel) ? (x <= endPixel) : (x >= endPixel); |
2189 | + x += delta) { |
2190 | + |
2191 | + // TODO(rryan) remove before 1.11 release. I'm seeing crashes |
2192 | + // sometimes where the pointIndex is very very large. It hasn't come |
2193 | + // back since adding locking, but I'm leaving this so that we can |
2194 | + // get some info about it before crashing. (The crash usually |
2195 | + // corrupts a lot of the stack). |
2196 | + if (pointIndex > 2*m_waveformRenderer->getWidth()+2) { |
2197 | + qDebug() << "OUT OF CONTROL" |
2198 | + << 2*m_waveformRenderer->getWidth()+2 |
2199 | + << dataSize |
2200 | + << channel << pointIndex << x; |
2201 | + } |
2202 | + |
2203 | + // Width of the x position in visual indices. |
2204 | + const double xSampleWidth = gain * x; |
2205 | + |
2206 | + // Effective visual index of x |
2207 | + const double xVisualSampleIndex = xSampleWidth + offset; |
2208 | + |
2209 | + // Our current pixel (x) corresponds to a number of visual samples |
2210 | + // (visualSamplerPerPixel) in our waveform object. We take the max of |
2211 | + // all the data points on either side of xVisualSampleIndex within a |
2212 | + // window of 'maxSamplingRange' visual samples to measure the maximum |
2213 | + // data point contained by this pixel. |
2214 | + double maxSamplingRange = gain / 2.0; |
2215 | + |
2216 | + // Since xVisualSampleIndex is in visual-samples (e.g. R,L,R,L) we want |
2217 | + // to check +/- maxSamplingRange frames, not samples. To do this, divide |
2218 | + // xVisualSampleIndex by 2. Since frames indices are integers, we round |
2219 | + // to the nearest integer by adding 0.5 before casting to int. |
2220 | + int visualFrameStart = int(xVisualSampleIndex / 2.0 - maxSamplingRange + 0.5); |
2221 | + int visualFrameStop = int(xVisualSampleIndex / 2.0 + maxSamplingRange + 0.5); |
2222 | + |
2223 | + // If the entire sample range is off the screen then don't calculate a |
2224 | + // point for this pixel. |
2225 | + const int lastVisualFrame = dataSize / 2 - 1; |
2226 | + if (visualFrameStop < 0 || visualFrameStart > lastVisualFrame) { |
2227 | + setPoint(m_polygon[pointIndex], x, 0.0); |
2228 | + pointIndex++; |
2229 | + continue; |
2230 | + } |
2231 | + |
2232 | + // We now know that some subset of [visualFrameStart, |
2233 | + // visualFrameStop] lies within the valid range of visual |
2234 | + // frames. Clamp visualFrameStart/Stop to within [0, |
2235 | + // lastVisualFrame]. |
2236 | + visualFrameStart = math_max(math_min(lastVisualFrame, visualFrameStart), 0); |
2237 | + visualFrameStop = math_max(math_min(lastVisualFrame, visualFrameStop), 0); |
2238 | + |
2239 | + int visualIndexStart = visualFrameStart * 2 + channel; |
2240 | + int visualIndexStop = visualFrameStop * 2 + channel; |
2241 | + |
2242 | + // if (x == m_waveformRenderer->getWidth() / 2) { |
2243 | + // qDebug() << "audioVisualRatio" << waveform->getAudioVisualRatio(); |
2244 | + // qDebug() << "visualSampleRate" << waveform->getVisualSampleRate(); |
2245 | + // qDebug() << "audioSamplesPerVisualPixel" << waveform->getAudioSamplesPerVisualSample(); |
2246 | + // qDebug() << "visualSamplePerPixel" << visualSamplePerPixel; |
2247 | + // qDebug() << "xSampleWidth" << xSampleWidth; |
2248 | + // qDebug() << "xVisualSampleIndex" << xVisualSampleIndex; |
2249 | + // qDebug() << "maxSamplingRange" << maxSamplingRange;; |
2250 | + // qDebug() << "Sampling pixel " << x << "over [" << visualIndexStart << visualIndexStop << "]"; |
2251 | + // } |
2252 | + |
2253 | + unsigned char maxAll = 0; |
2254 | + |
2255 | + for (int i = visualIndexStart; i >= 0 && i < dataSize && i <= visualIndexStop; |
2256 | + i += channelSeparation) { |
2257 | + const WaveformData& waveformData = *(data + i); |
2258 | + unsigned char all = waveformData.filtered.all; |
2259 | + maxAll = math_max(maxAll, all); |
2260 | + } |
2261 | + |
2262 | + setPoint(m_polygon[pointIndex], x, (float)maxAll*direction); |
2263 | + pointIndex++; |
2264 | + } |
2265 | + } |
2266 | + |
2267 | + //If channel are not displayed separatly we nne to close the loop properly |
2268 | + if (channelSeparation == 1) { |
2269 | + setPoint(m_polygon[pointIndex], m_waveformRenderer->getWidth(), 0.0); |
2270 | + pointIndex++; |
2271 | + } |
2272 | + |
2273 | + painter->setPen(m_borderPen); |
2274 | + painter->setBrush(m_brush); |
2275 | + |
2276 | + painter->drawPolygon(&m_polygon[0], pointIndex); |
2277 | + |
2278 | + painter->restore(); |
2279 | +} |
2280 | + |
2281 | +void QtWaveformRendererSimpleSignal::onResize() { |
2282 | + m_polygon.resize(2*m_waveformRenderer->getWidth()+2); |
2283 | +} |
2284 | + |
2285 | |
2286 | === added file 'mixxx/src/waveform/renderers/qtwaveformrenderersimplesignal.h' |
2287 | --- mixxx/src/waveform/renderers/qtwaveformrenderersimplesignal.h 1970-01-01 00:00:00 +0000 |
2288 | +++ mixxx/src/waveform/renderers/qtwaveformrenderersimplesignal.h 2012-05-17 02:22:20 +0000 |
2289 | @@ -0,0 +1,31 @@ |
2290 | +#ifndef QTWAVEFORMRENDERERSIMPLESIGNAL_H |
2291 | +#define QTWAVEFORMRENDERERSIMPLESIGNAL_H |
2292 | + |
2293 | +#include "waveformrenderersignalbase.h" |
2294 | + |
2295 | +#include <QBrush> |
2296 | +#include <QPen> |
2297 | + |
2298 | +#include <vector> |
2299 | + |
2300 | +class ControlObject; |
2301 | + |
2302 | +class QtWaveformRendererSimpleSignal : public WaveformRendererSignalBase { |
2303 | +public: |
2304 | + explicit QtWaveformRendererSimpleSignal( WaveformWidgetRenderer* waveformWidgetRenderer); |
2305 | + virtual ~QtWaveformRendererSimpleSignal(); |
2306 | + |
2307 | + virtual void onInit(); |
2308 | + virtual void onSetup(const QDomNode &node); |
2309 | + virtual void draw(QPainter* painter, QPaintEvent* event); |
2310 | + |
2311 | +protected: |
2312 | + virtual void onResize(); |
2313 | + |
2314 | +private: |
2315 | + QBrush m_brush; |
2316 | + QPen m_borderPen; |
2317 | + std::vector<QPointF> m_polygon; |
2318 | +}; |
2319 | + |
2320 | +#endif // QTWAVEFORMRENDERERSIMPLESIGNAL_H |
2321 | |
2322 | === modified file 'mixxx/src/waveform/renderers/waveformmark.cpp' |
2323 | --- mixxx/src/waveform/renderers/waveformmark.cpp 2012-04-10 12:49:54 +0000 |
2324 | +++ mixxx/src/waveform/renderers/waveformmark.cpp 2012-05-17 02:22:20 +0000 |
2325 | @@ -14,10 +14,6 @@ |
2326 | QString item = WWidget::selectNodeQString( node, "Control"); |
2327 | m_pointControl = ControlObject::getControl( ConfigKey(group, item)); |
2328 | |
2329 | - //if there is no control the mark won't be displayed anyway ... |
2330 | - if( m_pointControl == 0) |
2331 | - return; |
2332 | - |
2333 | m_color = WWidget::selectNodeQString( node, "Color"); |
2334 | if( m_color == "") { |
2335 | |
2336 | |
2337 | === modified file 'mixxx/src/waveform/renderers/waveformrendererendoftrack.cpp' |
2338 | --- mixxx/src/waveform/renderers/waveformrendererendoftrack.cpp 2012-04-29 18:45:39 +0000 |
2339 | +++ mixxx/src/waveform/renderers/waveformrendererendoftrack.cpp 2012-05-17 02:22:20 +0000 |
2340 | @@ -84,10 +84,14 @@ |
2341 | |
2342 | m_endOfTrackEnabled = m_endOfTrackControl->get() > 0.5; |
2343 | |
2344 | + //special case of track not long enougth |
2345 | + const double trackLength = 0.5 * trackSamples / sampleRate; |
2346 | + |
2347 | if (sampleRate < 0.1 //not ready |
2348 | || trackSamples < 0.1 //not ready |
2349 | || m_playControl->get() < 0.5 //not playing |
2350 | || m_loopControl->get() > 0.5 //in loop |
2351 | + || trackLength <= m_remainingTimeTriggerSeconds //track too short |
2352 | ) { |
2353 | if(m_endOfTrackEnabled && m_endOfTrackControl->getControlObject()) { |
2354 | m_endOfTrackControl->getControlObject()->set(0.); |
2355 | |
2356 | === modified file 'mixxx/src/waveform/renderers/waveformrendererfilteredsignal.cpp' |
2357 | --- mixxx/src/waveform/renderers/waveformrendererfilteredsignal.cpp 2012-04-05 03:21:25 +0000 |
2358 | +++ mixxx/src/waveform/renderers/waveformrendererfilteredsignal.cpp 2012-05-17 02:22:20 +0000 |
2359 | @@ -2,6 +2,7 @@ |
2360 | |
2361 | #include "waveformwidgetrenderer.h" |
2362 | #include "waveform/waveform.h" |
2363 | +#include "waveform/waveformwidgetfactory.h" |
2364 | |
2365 | #include "widget/wskincolor.h" |
2366 | #include "trackinfoobject.h" |
2367 | @@ -9,15 +10,17 @@ |
2368 | |
2369 | #include "defs.h" |
2370 | |
2371 | +#include "controlobjectthreadmain.h" |
2372 | + |
2373 | WaveformRendererFilteredSignal::WaveformRendererFilteredSignal( |
2374 | WaveformWidgetRenderer* waveformWidgetRenderer) |
2375 | - : WaveformRendererAbstract( waveformWidgetRenderer) { |
2376 | + : WaveformRendererSignalBase( waveformWidgetRenderer) { |
2377 | } |
2378 | |
2379 | WaveformRendererFilteredSignal::~WaveformRendererFilteredSignal() { |
2380 | } |
2381 | |
2382 | -void WaveformRendererFilteredSignal::init() { |
2383 | +void WaveformRendererFilteredSignal::onInit() { |
2384 | } |
2385 | |
2386 | void WaveformRendererFilteredSignal::onResize() { |
2387 | @@ -26,17 +29,8 @@ |
2388 | m_highLines.resize(m_waveformRenderer->getWidth()); |
2389 | } |
2390 | |
2391 | -void WaveformRendererFilteredSignal::setup(const QDomNode& node) { |
2392 | - m_signalColor.setNamedColor( |
2393 | - WWidget::selectNodeQString(node, "SignalColor")); |
2394 | - m_signalColor = WSkinColor::getCorrectColor(m_signalColor); |
2395 | +void WaveformRendererFilteredSignal::onSetup(const QDomNode& node) { |
2396 | |
2397 | - // TODO(vRince): fetch color from skin |
2398 | - int h, s, l; |
2399 | - m_signalColor.getHsl(&h, &s, &l); |
2400 | - m_lowColor = QColor::fromHsl(h, s, 50, 128); |
2401 | - m_midColor = QColor::fromHsl(h-2, s, 100, 128); |
2402 | - m_highColor = QColor::fromHsl(h+2, s, 200, 128); |
2403 | } |
2404 | |
2405 | void WaveformRendererFilteredSignal::draw(QPainter* painter, |
2406 | @@ -51,7 +45,7 @@ |
2407 | return; |
2408 | } |
2409 | |
2410 | - int dataSize = waveform->getDataSize(); |
2411 | + const int dataSize = waveform->getDataSize(); |
2412 | if (dataSize <= 1) { |
2413 | return; |
2414 | } |
2415 | @@ -61,8 +55,6 @@ |
2416 | return; |
2417 | } |
2418 | |
2419 | - const double xOffset = 0.5; |
2420 | - |
2421 | int samplesPerPixel = m_waveformRenderer->getVisualSamplePerPixel(); |
2422 | int numberOfSamples = m_waveformRenderer->getWidth() * samplesPerPixel; |
2423 | |
2424 | @@ -78,9 +70,40 @@ |
2425 | painter->setRenderHints(QPainter::HighQualityAntialiasing, false); |
2426 | painter->setRenderHints(QPainter::SmoothPixmapTransform, false); |
2427 | painter->setWorldMatrixEnabled(false); |
2428 | - |
2429 | - const float halfHeight = m_waveformRenderer->getHeight()/2.0; |
2430 | - const float heightFactor = halfHeight/255.0; |
2431 | + painter->resetTransform(); |
2432 | + |
2433 | + // Per-band gain from the EQ knobs. |
2434 | + float lowGain(1.0), midGain(1.0), highGain(1.0), allGain(1.0); |
2435 | + if (m_lowFilterControlObject && |
2436 | + m_midFilterControlObject && |
2437 | + m_highFilterControlObject) { |
2438 | + lowGain = m_lowFilterControlObject->get(); |
2439 | + midGain = m_midFilterControlObject->get(); |
2440 | + highGain = m_highFilterControlObject->get(); |
2441 | + } |
2442 | + allGain = m_waveformRenderer->getGain(); |
2443 | + |
2444 | + WaveformWidgetFactory* factory = WaveformWidgetFactory::instance(); |
2445 | + allGain *= factory->getVisualGain(::WaveformWidgetFactory::All); |
2446 | + lowGain *= factory->getVisualGain(WaveformWidgetFactory::Low); |
2447 | + midGain *= factory->getVisualGain(WaveformWidgetFactory::Mid); |
2448 | + highGain *= factory->getVisualGain(WaveformWidgetFactory::High); |
2449 | + |
2450 | + const float halfHeight = (float)m_waveformRenderer->getHeight()/2.0; |
2451 | + |
2452 | + const float heightFactor = m_alignment == Qt::AlignCenter |
2453 | + ? 2.0*allGain*halfHeight/255.0 |
2454 | + : allGain*m_waveformRenderer->getHeight()/255.0; |
2455 | + |
2456 | + //draw reference line |
2457 | + if( m_alignment == Qt::AlignCenter) { |
2458 | + painter->setPen(m_axesColor); |
2459 | + painter->drawLine(0,halfHeight,m_waveformRenderer->getWidth(),halfHeight); |
2460 | + } |
2461 | + |
2462 | + int actualLowLineNumber = 0; |
2463 | + int actualMidLineNumber = 0; |
2464 | + int actualHighLineNumber = 0; |
2465 | |
2466 | for (int i = 0; i < numberOfSamples; i += samplesPerPixel) { |
2467 | const int xPos = i/samplesPerPixel; |
2468 | @@ -104,25 +127,75 @@ |
2469 | maxHigh[1] = math_max(maxHigh[1], waveformDataNext.filtered.high); |
2470 | } |
2471 | |
2472 | - m_lowLines[xPos].setLine(xPos, (int)(halfHeight-heightFactor*(float)maxLow[0]), |
2473 | - xPos, (int)(halfHeight+heightFactor*(float)maxLow[1])+1); |
2474 | - m_midLines[xPos].setLine(xPos, (int)(halfHeight-heightFactor*(float)maxMid[0]), |
2475 | - xPos, (int)(halfHeight+heightFactor*(float)maxMid[1])); |
2476 | - m_highLines[xPos].setLine(xPos, (int)(halfHeight-heightFactor*(float)maxHigh[0]), |
2477 | - xPos, (int)(halfHeight+heightFactor*(float)maxHigh[1])); |
2478 | - } else { |
2479 | - m_lowLines[xPos].setLine(xPos, halfHeight, xPos, halfHeight+1); |
2480 | - m_midLines[xPos].setLine(xPos, halfHeight, xPos, halfHeight); |
2481 | - m_highLines[xPos].setLine(xPos, halfHeight, xPos, halfHeight); |
2482 | + if( maxLow[0] && maxLow[1]) { |
2483 | + switch( m_alignment) { |
2484 | + case Qt::AlignBottom : |
2485 | + m_lowLines[actualLowLineNumber].setLine( |
2486 | + xPos, m_waveformRenderer->getHeight(), |
2487 | + xPos, m_waveformRenderer->getHeight() - (int)(heightFactor*lowGain*(float)math_max(maxLow[0],maxLow[1]))); |
2488 | + break; |
2489 | + case Qt::AlignTop : |
2490 | + m_lowLines[actualLowLineNumber].setLine( |
2491 | + xPos, 0, |
2492 | + xPos, (int)(heightFactor*lowGain*(float)math_max(maxLow[0],maxLow[1]))); |
2493 | + break; |
2494 | + default : |
2495 | + m_lowLines[actualLowLineNumber].setLine( |
2496 | + xPos, (int)(halfHeight-heightFactor*(float)maxLow[0]*lowGain), |
2497 | + xPos, (int)(halfHeight+heightFactor*(float)maxLow[1]*lowGain)); |
2498 | + break; |
2499 | + } |
2500 | + actualLowLineNumber++; |
2501 | + } |
2502 | + if( maxMid[0] && maxMid[1]) { |
2503 | + switch( m_alignment) { |
2504 | + case Qt::AlignBottom : |
2505 | + m_midLines[actualMidLineNumber].setLine( |
2506 | + xPos, m_waveformRenderer->getHeight(), |
2507 | + xPos, m_waveformRenderer->getHeight() - (int)(heightFactor*midGain*(float)math_max(maxMid[0],maxMid[1]))); |
2508 | + break; |
2509 | + case Qt::AlignTop : |
2510 | + m_midLines[actualMidLineNumber].setLine( |
2511 | + xPos, 0, |
2512 | + xPos, (int)(heightFactor*midGain*(float)math_max(maxMid[0],maxMid[1]))); |
2513 | + break; |
2514 | + default : |
2515 | + m_midLines[actualMidLineNumber].setLine( |
2516 | + xPos, (int)(halfHeight-heightFactor*(float)maxMid[0]*midGain), |
2517 | + xPos, (int)(halfHeight+heightFactor*(float)maxMid[1]*midGain)); |
2518 | + break; |
2519 | + } |
2520 | + actualMidLineNumber++; |
2521 | + } |
2522 | + if( maxHigh[0] && maxHigh[1]) { |
2523 | + switch( m_alignment) { |
2524 | + case Qt::AlignBottom : |
2525 | + m_highLines[actualHighLineNumber].setLine( |
2526 | + xPos, m_waveformRenderer->getHeight(), |
2527 | + xPos, m_waveformRenderer->getHeight() - (int)(heightFactor*highGain*(float)math_max(maxHigh[0],maxHigh[1]))); |
2528 | + break; |
2529 | + case Qt::AlignTop : |
2530 | + m_highLines[actualHighLineNumber].setLine( |
2531 | + xPos, 0, |
2532 | + xPos, (int)(heightFactor*highGain*(float)math_max(maxHigh[0],maxHigh[1]))); |
2533 | + break; |
2534 | + default : |
2535 | + m_highLines[actualHighLineNumber].setLine( |
2536 | + xPos, (int)(halfHeight-heightFactor*(float)maxHigh[0]*highGain), |
2537 | + xPos, (int)(halfHeight+heightFactor*(float)maxHigh[1]*highGain)); |
2538 | + break; |
2539 | + } |
2540 | + actualHighLineNumber++; |
2541 | + } |
2542 | } |
2543 | } |
2544 | |
2545 | - painter->setPen(QPen(QBrush(m_lowColor), 1)); |
2546 | - painter->drawLines(&m_lowLines[0], m_lowLines.size()); |
2547 | - painter->setPen(QPen(QBrush(m_midColor), 1)); |
2548 | - painter->drawLines(&m_midLines[0], m_midLines.size()); |
2549 | - painter->setPen(QPen(QBrush(m_highColor), 1)); |
2550 | - painter->drawLines(&m_highLines[0], m_highLines.size()); |
2551 | + painter->setPen(QPen(QBrush(m_colors.getLowColor()), 1)); |
2552 | + painter->drawLines(&m_lowLines[0], actualLowLineNumber); |
2553 | + painter->setPen(QPen(QBrush(m_colors.getMidColor()), 1)); |
2554 | + painter->drawLines(&m_midLines[0], actualMidLineNumber); |
2555 | + painter->setPen(QPen(QBrush(m_colors.getHighColor()), 1)); |
2556 | + painter->drawLines(&m_highLines[0], actualHighLineNumber); |
2557 | |
2558 | painter->restore(); |
2559 | } |
2560 | |
2561 | === modified file 'mixxx/src/waveform/renderers/waveformrendererfilteredsignal.h' |
2562 | --- mixxx/src/waveform/renderers/waveformrendererfilteredsignal.h 2012-02-26 20:46:51 +0000 |
2563 | +++ mixxx/src/waveform/renderers/waveformrendererfilteredsignal.h 2012-05-17 02:22:20 +0000 |
2564 | @@ -1,32 +1,27 @@ |
2565 | #ifndef WAVEFORMRENDERERFILTEREDSIGNAL_H |
2566 | #define WAVEFORMRENDERERFILTEREDSIGNAL_H |
2567 | |
2568 | -#include <QColor> |
2569 | +#include "waveformrenderersignalbase.h" |
2570 | + |
2571 | +#include <vector> |
2572 | #include <QLineF> |
2573 | |
2574 | -#include <vector> |
2575 | - |
2576 | #include "util.h" |
2577 | -#include "waveformrendererabstract.h" |
2578 | |
2579 | -class WaveformRendererFilteredSignal : public WaveformRendererAbstract { |
2580 | +class WaveformRendererFilteredSignal : public WaveformRendererSignalBase { |
2581 | public: |
2582 | explicit WaveformRendererFilteredSignal( |
2583 | WaveformWidgetRenderer* waveformWidget); |
2584 | virtual ~WaveformRendererFilteredSignal(); |
2585 | |
2586 | - virtual void init(); |
2587 | - virtual void setup(const QDomNode& node); |
2588 | + virtual void onInit(); |
2589 | + virtual void onSetup(const QDomNode& node); |
2590 | + |
2591 | virtual void draw(QPainter* painter, QPaintEvent* event); |
2592 | |
2593 | virtual void onResize(); |
2594 | |
2595 | private: |
2596 | - QColor m_signalColor; |
2597 | - QColor m_lowColor; |
2598 | - QColor m_midColor; |
2599 | - QColor m_highColor; |
2600 | - |
2601 | std::vector<QLineF> m_lowLines; |
2602 | std::vector<QLineF> m_midLines; |
2603 | std::vector<QLineF> m_highLines; |
2604 | |
2605 | === added file 'mixxx/src/waveform/renderers/waveformrenderersignalbase.cpp' |
2606 | --- mixxx/src/waveform/renderers/waveformrenderersignalbase.cpp 1970-01-01 00:00:00 +0000 |
2607 | +++ mixxx/src/waveform/renderers/waveformrenderersignalbase.cpp 2012-05-17 02:22:20 +0000 |
2608 | @@ -0,0 +1,83 @@ |
2609 | +#include "waveformrenderersignalbase.h" |
2610 | +#include "waveformwidgetrenderer.h" |
2611 | + |
2612 | +#include "controlobject.h" |
2613 | +#include "controlobjectthreadmain.h" |
2614 | + |
2615 | +#include "widget/wskincolor.h" |
2616 | +#include "widget/wwidget.h" |
2617 | + |
2618 | +#include <QDomNode> |
2619 | + |
2620 | + |
2621 | +WaveformRendererSignalBase::WaveformRendererSignalBase( |
2622 | + WaveformWidgetRenderer* waveformWidgetRenderer) |
2623 | + : WaveformRendererAbstract(waveformWidgetRenderer) { |
2624 | + m_lowFilterControlObject = NULL; |
2625 | + m_midFilterControlObject = NULL; |
2626 | + m_highFilterControlObject = NULL; |
2627 | + m_lowKillControlObject = NULL; |
2628 | + m_midKillControlObject = NULL; |
2629 | + m_highKillControlObject = NULL; |
2630 | + m_alignment = Qt::AlignCenter; |
2631 | +} |
2632 | + |
2633 | +WaveformRendererSignalBase::~WaveformRendererSignalBase() { |
2634 | + deleteControls(); |
2635 | +} |
2636 | + |
2637 | +void WaveformRendererSignalBase::deleteControls() { |
2638 | + if(m_lowFilterControlObject) |
2639 | + delete m_lowFilterControlObject; |
2640 | + if(m_midFilterControlObject) |
2641 | + delete m_midFilterControlObject; |
2642 | + if(m_highFilterControlObject) |
2643 | + delete m_highFilterControlObject; |
2644 | + if(m_lowKillControlObject) |
2645 | + delete m_lowKillControlObject; |
2646 | + if(m_midKillControlObject) |
2647 | + delete m_midKillControlObject; |
2648 | + if(m_highKillControlObject) |
2649 | + delete m_highKillControlObject; |
2650 | +} |
2651 | + |
2652 | +void WaveformRendererSignalBase::init() { |
2653 | + deleteControls(); |
2654 | + |
2655 | + //create controls |
2656 | + m_lowFilterControlObject = new ControlObjectThreadMain( |
2657 | + ControlObject::getControl(ConfigKey(m_waveformRenderer->getGroup(),"filterLow"))); |
2658 | + m_midFilterControlObject = new ControlObjectThreadMain( |
2659 | + ControlObject::getControl(ConfigKey(m_waveformRenderer->getGroup(),"filterMid"))); |
2660 | + m_highFilterControlObject = new ControlObjectThreadMain( |
2661 | + ControlObject::getControl(ConfigKey(m_waveformRenderer->getGroup(),"filterHigh"))); |
2662 | + m_lowKillControlObject = new ControlObjectThreadMain( |
2663 | + ControlObject::getControl(ConfigKey(m_waveformRenderer->getGroup(),"filterLowKill"))); |
2664 | + m_midKillControlObject = new ControlObjectThreadMain( |
2665 | + ControlObject::getControl(ConfigKey(m_waveformRenderer->getGroup(),"filterMidKill"))); |
2666 | + m_highKillControlObject = new ControlObjectThreadMain( |
2667 | + ControlObject::getControl(ConfigKey(m_waveformRenderer->getGroup(),"filterHighKill"))); |
2668 | + |
2669 | + onInit(); |
2670 | +} |
2671 | + |
2672 | +void WaveformRendererSignalBase::setup(const QDomNode &node) { |
2673 | + QString alignString = WWidget::selectNodeQString(node, "Align").toLower(); |
2674 | + if (alignString == "bottom") { |
2675 | + m_alignment = Qt::AlignBottom; |
2676 | + } else if (alignString == "top") { |
2677 | + m_alignment = Qt::AlignTop; |
2678 | + } else { |
2679 | + m_alignment = Qt::AlignCenter; |
2680 | + } |
2681 | + |
2682 | + m_axesColor.setNamedColor(WWidget::selectNodeQString(node, "AxesColor")); |
2683 | + m_axesColor = WSkinColor::getCorrectColor(m_axesColor); |
2684 | + |
2685 | + if( !m_axesColor.isValid()) |
2686 | + m_axesColor = QColor(245,245,245,128); |
2687 | + |
2688 | + m_colors.setup(node); |
2689 | + |
2690 | + onSetup(node); |
2691 | +} |
2692 | |
2693 | === added file 'mixxx/src/waveform/renderers/waveformrenderersignalbase.h' |
2694 | --- mixxx/src/waveform/renderers/waveformrenderersignalbase.h 1970-01-01 00:00:00 +0000 |
2695 | +++ mixxx/src/waveform/renderers/waveformrenderersignalbase.h 2012-05-17 02:22:20 +0000 |
2696 | @@ -0,0 +1,38 @@ |
2697 | +#ifndef WAVEFORMRENDERERSIGNALBASE_H |
2698 | +#define WAVEFORMRENDERERSIGNALBASE_H |
2699 | + |
2700 | +#include "waveformrendererabstract.h" |
2701 | +#include "waveformsignalcolors.h" |
2702 | + |
2703 | +class ControlObject; |
2704 | +class ControlObjectThreadMain; |
2705 | + |
2706 | +class WaveformRendererSignalBase : public WaveformRendererAbstract { |
2707 | +public: |
2708 | + explicit WaveformRendererSignalBase( WaveformWidgetRenderer* waveformWidgetRenderer); |
2709 | + virtual ~WaveformRendererSignalBase(); |
2710 | + |
2711 | + virtual void init(); |
2712 | + virtual void setup(const QDomNode &node); |
2713 | + |
2714 | + virtual void onInit() = 0; |
2715 | + virtual void onSetup(const QDomNode &node) = 0; |
2716 | + |
2717 | +protected: |
2718 | + void deleteControls(); |
2719 | + |
2720 | +protected: |
2721 | + ControlObjectThreadMain* m_lowFilterControlObject; |
2722 | + ControlObjectThreadMain* m_midFilterControlObject; |
2723 | + ControlObjectThreadMain* m_highFilterControlObject; |
2724 | + |
2725 | + ControlObjectThreadMain* m_lowKillControlObject; |
2726 | + ControlObjectThreadMain* m_midKillControlObject; |
2727 | + ControlObjectThreadMain* m_highKillControlObject; |
2728 | + |
2729 | + WaveformSignalColors m_colors; |
2730 | + QColor m_axesColor; |
2731 | + Qt::Alignment m_alignment; |
2732 | +}; |
2733 | + |
2734 | +#endif // WAVEFORMRENDERERSIGNALBASE_H |
2735 | |
2736 | === modified file 'mixxx/src/waveform/renderers/waveformrendermark.cpp' |
2737 | --- mixxx/src/waveform/renderers/waveformrendermark.cpp 2012-04-10 12:49:54 +0000 |
2738 | +++ mixxx/src/waveform/renderers/waveformrendermark.cpp 2012-05-17 02:22:20 +0000 |
2739 | @@ -11,6 +11,11 @@ |
2740 | #include "widget/wskincolor.h" |
2741 | #include "widget/wwidget.h" |
2742 | |
2743 | +#include "engine/cuecontrol.h" |
2744 | +#include <set> |
2745 | + |
2746 | +#include <QTextStream> |
2747 | + |
2748 | WaveformRenderMark::WaveformRenderMark( WaveformWidgetRenderer* waveformWidgetRenderer) : |
2749 | WaveformRendererAbstract(waveformWidgetRenderer) { |
2750 | } |
2751 | @@ -19,22 +24,55 @@ |
2752 | } |
2753 | |
2754 | void WaveformRenderMark::setup( const QDomNode& node) { |
2755 | + m_defaultMark = WaveformMark(); |
2756 | m_marks.clear(); |
2757 | - m_marks.reserve(37); //36 hot cues + 1 cue |
2758 | + m_marks.reserve(NUM_HOT_CUES); |
2759 | + |
2760 | + std::set<QString> hotCutSet; |
2761 | + bool hasDefaultMark = false; |
2762 | |
2763 | QDomNode child = node.firstChild(); |
2764 | while (!child.isNull()) { |
2765 | - if (child.nodeName() == "Mark") { |
2766 | + if (child.nodeName() == "DefaultMark") { |
2767 | + m_defaultMark.setup( m_waveformRenderer->getGroup(), child); |
2768 | + hasDefaultMark = true; |
2769 | + } else if (child.nodeName() == "Mark") { |
2770 | m_marks.push_back(WaveformMark()); |
2771 | WaveformMark& mark = m_marks.back(); |
2772 | mark.setup( m_waveformRenderer->getGroup(), child); |
2773 | + //garante uniqueness even if there is misdesigned skin |
2774 | + std::pair<std::set<QString>::iterator, bool> insertion; |
2775 | + insertion = hotCutSet.insert(mark.m_pointControl->getKey().item); |
2776 | + if( !insertion.second) { |
2777 | + qWarning() << "WaveformRenderMark::setup - redefinition of " |
2778 | + << mark.m_pointControl->getKey().item; |
2779 | + m_marks.resize( m_marks.size() - 1); |
2780 | + } |
2781 | } |
2782 | child = child.nextSibling(); |
2783 | } |
2784 | + |
2785 | + //check if there is a default mark and compare declared |
2786 | + //and to create all missing hot_cues |
2787 | + if(hasDefaultMark) { |
2788 | + for( int i = 1; i < NUM_HOT_CUES; i++) { |
2789 | + QString hotCueControlItem = "hotcue_" + QString::number(i) + "_position"; |
2790 | + std::pair<std::set<QString>::iterator, bool> insertion; |
2791 | + insertion = hotCutSet.insert(hotCueControlItem); |
2792 | + if( insertion.second) { |
2793 | + //qDebug() << "WaveformRenderMark::setup - Automatic mark" << hotCueControlItem; |
2794 | + m_marks.push_back(m_defaultMark); |
2795 | + WaveformMark& mark = m_marks.back(); |
2796 | + mark.m_pointControl = ControlObject::getControl( |
2797 | + ConfigKey(m_waveformRenderer->getGroup(), hotCueControlItem)); |
2798 | + mark.m_text = QString(" HOTCUE %1 ").arg(i); |
2799 | + } |
2800 | + } |
2801 | + } |
2802 | } |
2803 | |
2804 | |
2805 | -void WaveformRenderMark::draw( QPainter* painter, QPaintEvent* event) { |
2806 | +void WaveformRenderMark::draw( QPainter* painter, QPaintEvent* /*event*/) { |
2807 | painter->save(); |
2808 | |
2809 | /* |
2810 | @@ -47,7 +85,7 @@ |
2811 | |
2812 | painter->setWorldMatrixEnabled(false); |
2813 | |
2814 | - for( int i = 0; i < m_marks.size(); i++) { |
2815 | + for( unsigned int i = 0; i < m_marks.size(); i++) { |
2816 | WaveformMark& mark = m_marks[i]; |
2817 | |
2818 | if( !mark.m_pointControl) |
2819 | @@ -139,7 +177,7 @@ |
2820 | QColor rectColor = mark.m_color; |
2821 | rectColor.setAlpha(50); |
2822 | rectColor.darker(140); |
2823 | - painter.setPen(rectColor); |
2824 | + painter.setPen(mark.m_color); |
2825 | painter.setBrush(QBrush(rectColor)); |
2826 | painter.drawRoundedRect(labelRect, 2.0, 2.0); |
2827 | |
2828 | |
2829 | === modified file 'mixxx/src/waveform/renderers/waveformrendermark.h' |
2830 | --- mixxx/src/waveform/renderers/waveformrendermark.h 2012-04-10 12:49:54 +0000 |
2831 | +++ mixxx/src/waveform/renderers/waveformrendermark.h 2012-05-17 02:22:20 +0000 |
2832 | @@ -22,6 +22,7 @@ |
2833 | private: |
2834 | void generateMarkPixmap(WaveformMark& mark); |
2835 | |
2836 | + WaveformMark m_defaultMark; |
2837 | std::vector<WaveformMark> m_marks; |
2838 | DISALLOW_COPY_AND_ASSIGN(WaveformRenderMark); |
2839 | }; |
2840 | |
2841 | === modified file 'mixxx/src/waveform/renderers/waveformwidgetrenderer.cpp' |
2842 | --- mixxx/src/waveform/renderers/waveformwidgetrenderer.cpp 2012-05-07 05:30:14 +0000 |
2843 | +++ mixxx/src/waveform/renderers/waveformwidgetrenderer.cpp 2012-05-17 02:22:20 +0000 |
2844 | @@ -1,6 +1,7 @@ |
2845 | #include "waveformwidgetrenderer.h" |
2846 | #include "waveform/waveform.h" |
2847 | |
2848 | +#include "widget/wwidget.h" |
2849 | #include "controlobjectthreadmain.h" |
2850 | #include "controlobject.h" |
2851 | #include "defs.h" |
2852 | @@ -165,12 +166,11 @@ |
2853 | m_rendererStack[0]->draw( painter, event); |
2854 | return; |
2855 | } else { |
2856 | - |
2857 | for( int i = 0; i < m_rendererStack.size(); ++i) |
2858 | m_rendererStack[i]->draw( painter, event); |
2859 | |
2860 | - painter->setPen(QColor(255,255,255,200)); |
2861 | - painter->drawLine( m_width/2, 0, m_width/2, m_height); |
2862 | + painter->setPen(m_axesColor); |
2863 | + painter->drawLine(m_width/2,0,m_width/2,m_height); |
2864 | } |
2865 | |
2866 | #ifdef WAVEFORMWIDGETRENDERER_DEBUG |
2867 | @@ -218,6 +218,12 @@ |
2868 | } |
2869 | |
2870 | void WaveformWidgetRenderer::setup( const QDomNode& node) { |
2871 | + |
2872 | + m_axesColor.setNamedColor(WWidget::selectNodeQString(node, "AxesColor")); |
2873 | + |
2874 | + if( !m_axesColor.isValid()) |
2875 | + m_axesColor = QColor(245,245,245,200); |
2876 | + |
2877 | for( int i = 0; i < m_rendererStack.size(); ++i) |
2878 | m_rendererStack[i]->setup(node); |
2879 | } |
2880 | |
2881 | === modified file 'mixxx/src/waveform/renderers/waveformwidgetrenderer.h' |
2882 | --- mixxx/src/waveform/renderers/waveformwidgetrenderer.h 2012-04-19 02:27:57 +0000 |
2883 | +++ mixxx/src/waveform/renderers/waveformwidgetrenderer.h 2012-05-17 02:22:20 +0000 |
2884 | @@ -81,6 +81,7 @@ |
2885 | QVector<WaveformRendererAbstract*> m_rendererStack; |
2886 | int m_height; |
2887 | int m_width; |
2888 | + QColor m_axesColor; |
2889 | |
2890 | double m_firstDisplayedPosition; |
2891 | double m_lastDisplayedPosition; |
2892 | @@ -107,7 +108,6 @@ |
2893 | ControlObjectThreadMain* m_trackSamplesControlObject; |
2894 | int m_trackSamples; |
2895 | |
2896 | - |
2897 | #ifdef WAVEFORMWIDGETRENDERER_DEBUG |
2898 | QTime* m_timer; |
2899 | int m_lastFrameTime; |
2900 | |
2901 | === modified file 'mixxx/src/waveform/waveformwidgetfactory.cpp' |
2902 | --- mixxx/src/waveform/waveformwidgetfactory.cpp 2012-04-29 18:45:39 +0000 |
2903 | +++ mixxx/src/waveform/waveformwidgetfactory.cpp 2012-05-17 02:22:20 +0000 |
2904 | @@ -11,18 +11,20 @@ |
2905 | #include "controlpotmeter.h" |
2906 | #include "defs.h" |
2907 | #include "waveform/widgets/emptywaveformwidget.h" |
2908 | +#include "waveform/widgets/softwarewaveformwidget.h" |
2909 | +#include "waveform/widgets/glwaveformwidget.h" |
2910 | #include "waveform/widgets/glsimplewaveformwidget.h" |
2911 | +#include "waveform/widgets/qtwaveformwidget.h" |
2912 | +#include "waveform/widgets/qtsimplewaveformwidget.h" |
2913 | #include "waveform/widgets/glslwaveformwidget.h" |
2914 | -#include "waveform/widgets/glwaveformwidget.h" |
2915 | -#include "waveform/widgets/softwarewaveformwidget.h" |
2916 | #include "waveform/widgets/waveformwidgetabstract.h" |
2917 | #include "widget/wwaveformviewer.h" |
2918 | |
2919 | /////////////////////////////////////////// |
2920 | |
2921 | WaveformWidgetAbstractHandle::WaveformWidgetAbstractHandle() |
2922 | - : m_active(true), |
2923 | - m_type(WaveformWidgetType::Count_WaveformwidgetType) { |
2924 | + : m_active(true), |
2925 | + m_type(WaveformWidgetType::Count_WaveformwidgetType) { |
2926 | } |
2927 | |
2928 | /////////////////////////////////////////// |
2929 | @@ -30,9 +32,9 @@ |
2930 | WaveformWidgetHolder::WaveformWidgetHolder(WaveformWidgetAbstract* waveformWidget, |
2931 | WWaveformViewer* waveformViewer, |
2932 | const QDomNode& visualNodeCache) |
2933 | - : m_waveformWidget(waveformWidget), |
2934 | - m_waveformViewer(waveformViewer), |
2935 | - m_visualNodeCache(visualNodeCache.cloneNode()) { |
2936 | + : m_waveformWidget(waveformWidget), |
2937 | + m_waveformViewer(waveformViewer), |
2938 | + m_visualNodeCache(visualNodeCache.cloneNode()) { |
2939 | } |
2940 | |
2941 | /////////////////////////////////////////// |
2942 | @@ -42,7 +44,7 @@ |
2943 | m_config = 0; |
2944 | m_skipRender = false; |
2945 | setFrameRate(33); |
2946 | - m_defaultZoom = 1; |
2947 | + m_defaultZoom = 3; |
2948 | m_zoomSync = false; |
2949 | m_visualGain[All] = 1.5; |
2950 | m_visualGain[Low] = 1.0; |
2951 | @@ -147,14 +149,14 @@ |
2952 | } |
2953 | |
2954 | WaveformWidgetType::Type type = static_cast<WaveformWidgetType::Type>( |
2955 | - m_config->getValueString(ConfigKey("[Waveform]","WaveformType")).toInt(&ok)); |
2956 | + m_config->getValueString(ConfigKey("[Waveform]","WaveformType")).toInt(&ok)); |
2957 | if (!ok || !setWidgetType(type)) { |
2958 | setWidgetType(autoChooseWidgetType()); |
2959 | } |
2960 | |
2961 | for (int i = 0; i < FilterCount; i++) { |
2962 | double visualGain = m_config->getValueString( |
2963 | - ConfigKey("[Waveform]","VisualGain_" + QString::number(i))).toDouble(&ok); |
2964 | + ConfigKey("[Waveform]","VisualGain_" + QString::number(i))).toDouble(&ok); |
2965 | |
2966 | if (ok) { |
2967 | setVisualGain(FilterIndex(i), visualGain); |
2968 | @@ -223,7 +225,7 @@ |
2969 | |
2970 | viewer->setZoom(m_defaultZoom); |
2971 | |
2972 | - qDebug() << "WaveformWidgetFactory::setWaveformWidget - waveform widget added in factory index" << index; |
2973 | + qDebug() << "WaveformWidgetFactory::setWaveformWidget - waveform widget added in factory, index" << index; |
2974 | |
2975 | return true; |
2976 | } |
2977 | @@ -261,7 +263,7 @@ |
2978 | } |
2979 | |
2980 | bool WaveformWidgetFactory::setWidgetTypeFromHandle(int handleIndex) { |
2981 | - if (handleIndex < 0 && handleIndex > m_waveformWidgetHandles.size()) { |
2982 | + if (handleIndex < 0 && handleIndex > (int)m_waveformWidgetHandles.size()) { |
2983 | qDebug() << "WaveformWidgetFactory::setWidgetType - invalid handle --> use of 'EmptyWaveform'"; |
2984 | // fallback empty type |
2985 | setWidgetType(WaveformWidgetType::EmptyWaveform); |
2986 | @@ -278,22 +280,24 @@ |
2987 | setWidgetType(handle.m_type); |
2988 | |
2989 | m_skipRender = true; |
2990 | - qDebug() << "recreate start"; |
2991 | + //qDebug() << "recreate start"; |
2992 | |
2993 | //re-create/setup all waveform widgets |
2994 | for (unsigned int i = 0; i < m_waveformWidgetHolders.size(); i++) { |
2995 | WaveformWidgetHolder& holder = m_waveformWidgetHolders[i]; |
2996 | WaveformWidgetAbstract* previousWidget = holder.m_waveformWidget; |
2997 | TrackPointer pTrack = previousWidget->getTrackInfo(); |
2998 | - previousWidget->hold(); |
2999 | + //previousWidget->hold(); |
3000 | + int previousZoom = previousWidget->getZoomFactor(); |
3001 | delete previousWidget; |
3002 | WWaveformViewer* viewer = holder.m_waveformViewer; |
3003 | WaveformWidgetAbstract* widget = createWaveformWidget(m_type, holder.m_waveformViewer); |
3004 | holder.m_waveformWidget = widget; |
3005 | widget->castToQWidget(); |
3006 | - widget->hold(); |
3007 | + //widget->hold(); |
3008 | viewer->setWaveformWidget(widget); |
3009 | viewer->setup(holder.m_visualNodeCache); |
3010 | + viewer->setZoom(previousZoom); |
3011 | // resize() doesn't seem to get called on the widget. I think Qt skips |
3012 | // it since the size didn't change. |
3013 | //viewer->resize(viewer->size()); |
3014 | @@ -302,7 +306,7 @@ |
3015 | } |
3016 | |
3017 | m_skipRender = false; |
3018 | - qDebug() << "recreate done"; |
3019 | + //qDebug() << "recreate done"; |
3020 | return true; |
3021 | } |
3022 | |
3023 | @@ -348,7 +352,7 @@ |
3024 | if (isZoomSync()) { |
3025 | //qDebug() << "WaveformWidgetFactory::notifyZoomChange"; |
3026 | int refZoom = viewer->getWaveformWidget()->getZoomFactor(); |
3027 | - for (int i = 0; i < m_waveformWidgetHolders.size(); i++) { |
3028 | + for (int i = 0; i < (int)m_waveformWidgetHolders.size(); i++) { |
3029 | if (m_waveformWidgetHolders[i].m_waveformViewer != viewer) { |
3030 | m_waveformWidgetHolders[i].m_waveformViewer->setZoom(refZoom); |
3031 | } |
3032 | @@ -358,7 +362,7 @@ |
3033 | |
3034 | void WaveformWidgetFactory::refresh() { |
3035 | if (m_skipRender) |
3036 | - return; |
3037 | + return; |
3038 | |
3039 | for (unsigned int i = 0; i < m_waveformWidgetHolders.size(); i++) |
3040 | m_waveformWidgetHolders[i].m_waveformWidget->preRender(); |
3041 | @@ -399,9 +403,11 @@ |
3042 | WaveformWidgetAbstract* widget = 0; |
3043 | switch(type) { |
3044 | case WaveformWidgetType::EmptyWaveform : widget = new EmptyWaveformWidget(); break; |
3045 | - case WaveformWidgetType::SimpleSoftwareWaveform : break; //TODO: (vrince) |
3046 | + case WaveformWidgetType::SoftwareSimpleWaveform : break; //TODO: (vrince) |
3047 | + case WaveformWidgetType::SoftwareWaveform : widget = new SoftwareWaveformWidget(); break; |
3048 | + case WaveformWidgetType::QtSimpleWaveform : widget = new QtSimpleWaveformWidget(); break; |
3049 | + case WaveformWidgetType::QtWaveform : widget = new QtWaveformWidget(); break; |
3050 | case WaveformWidgetType::GLSimpleWaveform : widget = new GLSimpleWaveformWidget(); break; |
3051 | - case WaveformWidgetType::SoftwareWaveform : widget = new SoftwareWaveformWidget(); break; |
3052 | case WaveformWidgetType::GLWaveform : widget = new GLWaveformWidget(); break; |
3053 | case WaveformWidgetType::GLSLWaveform : widget = new GLSLWaveformWidget(); break; |
3054 | } |
3055 | @@ -437,9 +443,11 @@ |
3056 | if (viewer) { |
3057 | switch(type) { |
3058 | case WaveformWidgetType::EmptyWaveform : return new EmptyWaveformWidget(viewer->getGroup(), viewer); |
3059 | - case WaveformWidgetType::SimpleSoftwareWaveform : return 0; //TODO: (vrince) |
3060 | + case WaveformWidgetType::SoftwareSimpleWaveform : return 0; //TODO: (vrince) |
3061 | + case WaveformWidgetType::SoftwareWaveform : return new SoftwareWaveformWidget(viewer->getGroup(), viewer); |
3062 | + case WaveformWidgetType::QtSimpleWaveform : return new QtSimpleWaveformWidget(viewer->getGroup(), viewer); |
3063 | + case WaveformWidgetType::QtWaveform : return new QtWaveformWidget(viewer->getGroup(), viewer); |
3064 | case WaveformWidgetType::GLSimpleWaveform : return new GLSimpleWaveformWidget(viewer->getGroup(), viewer); |
3065 | - case WaveformWidgetType::SoftwareWaveform : return new SoftwareWaveformWidget(viewer->getGroup(), viewer); |
3066 | case WaveformWidgetType::GLWaveform : return new GLWaveformWidget(viewer->getGroup(), viewer); |
3067 | case WaveformWidgetType::GLSLWaveform : return new GLSLWaveformWidget(viewer->getGroup(), viewer); |
3068 | default : return 0; |
3069 | @@ -449,7 +457,7 @@ |
3070 | } |
3071 | |
3072 | int WaveformWidgetFactory::findIndexOf(WWaveformViewer* viewer) const { |
3073 | - for (int i = 0; i < m_waveformWidgetHolders.size(); i++) |
3074 | + for (int i = 0; i < (int)m_waveformWidgetHolders.size(); i++) |
3075 | if (m_waveformWidgetHolders[i].m_waveformViewer == viewer) |
3076 | return i; |
3077 | return -1; |
3078 | |
3079 | === modified file 'mixxx/src/waveform/widgets/glsimplewaveformwidget.cpp' |
3080 | --- mixxx/src/waveform/widgets/glsimplewaveformwidget.cpp 2012-04-15 01:25:21 +0000 |
3081 | +++ mixxx/src/waveform/widgets/glsimplewaveformwidget.cpp 2012-05-17 02:22:20 +0000 |
3082 | @@ -8,6 +8,7 @@ |
3083 | #include "waveform/renderers/waveformrendererpreroll.h" |
3084 | #include "waveform/renderers/waveformrendermark.h" |
3085 | #include "waveform/renderers/waveformrendermarkrange.h" |
3086 | +#include "waveform/renderers/waveformrendererendoftrack.h" |
3087 | #include "waveform/renderers/waveformrenderbeat.h" |
3088 | |
3089 | GLSimpleWaveformWidget::GLSimpleWaveformWidget( const char* group, QWidget* parent) : |
3090 | @@ -15,6 +16,7 @@ |
3091 | QGLWidget(parent) { |
3092 | |
3093 | addRenderer<WaveformRenderBackground>(); |
3094 | + addRenderer<WaveformRendererEndOfTrack>(); |
3095 | addRenderer<WaveformRendererPreroll>(); |
3096 | addRenderer<WaveformRenderMarkRange>(); |
3097 | addRenderer<GLWaveformRendererSimpleSignal>(); |
3098 | @@ -42,12 +44,6 @@ |
3099 | m_widget = static_cast<QWidget*>(static_cast<QGLWidget*>(this)); |
3100 | } |
3101 | |
3102 | -//here rate adjust is discarded in the simple version to have an tinegral |
3103 | -//number of visual sample per pixel |
3104 | -void GLSimpleWaveformWidget::updateVisualSamplingPerPixel() { |
3105 | - m_visualSamplePerPixel = m_zoomFactor; |
3106 | -} |
3107 | - |
3108 | void GLSimpleWaveformWidget::paintEvent( QPaintEvent* event) { |
3109 | if (QGLContext::currentContext() != context()) { |
3110 | makeCurrent(); |
3111 | |
3112 | === modified file 'mixxx/src/waveform/widgets/glsimplewaveformwidget.h' |
3113 | --- mixxx/src/waveform/widgets/glsimplewaveformwidget.h 2012-04-29 18:45:39 +0000 |
3114 | +++ mixxx/src/waveform/widgets/glsimplewaveformwidget.h 2012-05-17 02:22:20 +0000 |
3115 | @@ -17,9 +17,6 @@ |
3116 | virtual bool useOpenGl() const { return true;} |
3117 | virtual bool useOpenGLShaders() const { return false;} |
3118 | |
3119 | - //reimplemet it to discard use of rate adjust |
3120 | - virtual void updateVisualSamplingPerPixel(); |
3121 | - |
3122 | protected: |
3123 | virtual void castToQWidget(); |
3124 | virtual void paintEvent(QPaintEvent* event); |
3125 | |
3126 | === modified file 'mixxx/src/waveform/widgets/glslwaveformwidget.cpp' |
3127 | --- mixxx/src/waveform/widgets/glslwaveformwidget.cpp 2012-03-27 00:54:20 +0000 |
3128 | +++ mixxx/src/waveform/widgets/glslwaveformwidget.cpp 2012-05-17 02:22:20 +0000 |
3129 | @@ -12,15 +12,15 @@ |
3130 | #include "waveform/renderers/waveformrenderbeat.h" |
3131 | |
3132 | GLSLWaveformWidget::GLSLWaveformWidget( const char* group, QWidget* parent) : |
3133 | - WaveformWidgetAbstract(group), |
3134 | - QGLWidget(parent) { |
3135 | + QGLWidget(parent), |
3136 | + WaveformWidgetAbstract(group) { |
3137 | |
3138 | addRenderer<WaveformRenderBackground>(); |
3139 | addRenderer<WaveformRendererEndOfTrack>(); |
3140 | + addRenderer<WaveformRendererPreroll>(); |
3141 | addRenderer<WaveformRenderMarkRange>(); |
3142 | + signalRenderer_ = addRenderer<GLSLWaveformRendererSignal>(); |
3143 | addRenderer<WaveformRenderMark>(); |
3144 | - signalRenderer_ = addRenderer<GLSLWaveformRendererSignal>(); |
3145 | - addRenderer<WaveformRendererPreroll>(); |
3146 | addRenderer<WaveformRenderBeat>(); |
3147 | |
3148 | setAttribute(Qt::WA_NoSystemBackground); |
3149 | |
3150 | === modified file 'mixxx/src/waveform/widgets/glslwaveformwidget.h' |
3151 | --- mixxx/src/waveform/widgets/glslwaveformwidget.h 2012-04-29 18:45:39 +0000 |
3152 | +++ mixxx/src/waveform/widgets/glslwaveformwidget.h 2012-05-17 02:22:20 +0000 |
3153 | @@ -13,7 +13,7 @@ |
3154 | GLSLWaveformWidget(const char* group, QWidget* parent); |
3155 | virtual ~GLSLWaveformWidget(); |
3156 | |
3157 | - virtual QString getWaveformWidgetName() { return tr("Filtered (experimental)");} |
3158 | + virtual QString getWaveformWidgetName() { return tr("Filtered - experimental");} |
3159 | virtual WaveformWidgetType::Type getType() const { return WaveformWidgetType::GLWaveform;} |
3160 | |
3161 | virtual bool useOpenGl() const { return true;} |
3162 | |
3163 | === modified file 'mixxx/src/waveform/widgets/glwaveformwidget.cpp' |
3164 | --- mixxx/src/waveform/widgets/glwaveformwidget.cpp 2012-04-15 01:25:21 +0000 |
3165 | +++ mixxx/src/waveform/widgets/glwaveformwidget.cpp 2012-05-17 02:22:20 +0000 |
3166 | @@ -4,6 +4,7 @@ |
3167 | #include "glwaveformwidget.h" |
3168 | #include "waveform/renderers/waveformwidgetrenderer.h" |
3169 | #include "waveform/renderers/waveformrenderbackground.h" |
3170 | +#include "waveform/renderers/qtwaveformrendererfilteredsignal.h" |
3171 | #include "waveform/renderers/glwaveformrendererfilteredsignal.h" |
3172 | #include "waveform/renderers/waveformrendererpreroll.h" |
3173 | #include "waveform/renderers/waveformrendermark.h" |
3174 | @@ -13,8 +14,8 @@ |
3175 | #include "sharedglcontext.h" |
3176 | |
3177 | GLWaveformWidget::GLWaveformWidget( const char* group, QWidget* parent) : |
3178 | - WaveformWidgetAbstract(group), |
3179 | - QGLWidget(SharedGLContext::getContext(), parent) { |
3180 | + QGLWidget(SharedGLContext::getContext(), parent), |
3181 | + WaveformWidgetAbstract(group) { |
3182 | |
3183 | addRenderer<WaveformRenderBackground>(); |
3184 | addRenderer<WaveformRendererEndOfTrack>(); |
3185 | |
3186 | === added file 'mixxx/src/waveform/widgets/qtsimplewaveformwidget.cpp' |
3187 | --- mixxx/src/waveform/widgets/qtsimplewaveformwidget.cpp 1970-01-01 00:00:00 +0000 |
3188 | +++ mixxx/src/waveform/widgets/qtsimplewaveformwidget.cpp 2012-05-17 02:22:20 +0000 |
3189 | @@ -0,0 +1,57 @@ |
3190 | +#include "qtsimplewaveformwidget.h" |
3191 | + |
3192 | +#include <QPainter> |
3193 | + |
3194 | +#include "waveform/renderers/waveformwidgetrenderer.h" |
3195 | +#include "waveform/renderers/waveformrenderbackground.h" |
3196 | +#include "waveform/renderers/qtwaveformrenderersimplesignal.h" |
3197 | +#include "waveform/renderers/waveformrendererpreroll.h" |
3198 | +#include "waveform/renderers/waveformrendermark.h" |
3199 | +#include "waveform/renderers/waveformrendermarkrange.h" |
3200 | +#include "waveform/renderers/waveformrendererendoftrack.h" |
3201 | +#include "waveform/renderers/waveformrenderbeat.h" |
3202 | + |
3203 | +QtSimpleWaveformWidget::QtSimpleWaveformWidget( const char* group, QWidget* parent) : |
3204 | + WaveformWidgetAbstract(group), |
3205 | + QGLWidget(parent) { |
3206 | + |
3207 | + addRenderer<WaveformRenderBackground>(); |
3208 | + addRenderer<WaveformRendererEndOfTrack>(); |
3209 | + addRenderer<WaveformRendererPreroll>(); |
3210 | + addRenderer<WaveformRenderMarkRange>(); |
3211 | + addRenderer<QtWaveformRendererSimpleSignal>(); |
3212 | + addRenderer<WaveformRenderMark>(); |
3213 | + addRenderer<WaveformRenderBeat>(); |
3214 | + |
3215 | + setAttribute(Qt::WA_NoSystemBackground); |
3216 | + setAttribute(Qt::WA_OpaquePaintEvent); |
3217 | + |
3218 | + setAutoBufferSwap(false); |
3219 | + |
3220 | + if (QGLContext::currentContext() != context()) { |
3221 | + makeCurrent(); |
3222 | + } |
3223 | + init(); |
3224 | +} |
3225 | + |
3226 | +QtSimpleWaveformWidget::~QtSimpleWaveformWidget(){ |
3227 | + if (QGLContext::currentContext() != context()) { |
3228 | + makeCurrent(); |
3229 | + } |
3230 | +} |
3231 | + |
3232 | +void QtSimpleWaveformWidget::castToQWidget() { |
3233 | + m_widget = static_cast<QWidget*>(static_cast<QGLWidget*>(this)); |
3234 | +} |
3235 | + |
3236 | +void QtSimpleWaveformWidget::paintEvent( QPaintEvent* event) { |
3237 | + if (QGLContext::currentContext() != context()) { |
3238 | + makeCurrent(); |
3239 | + } |
3240 | + QPainter painter(this); |
3241 | + draw(&painter,event); |
3242 | +} |
3243 | + |
3244 | +void QtSimpleWaveformWidget::postRender() { |
3245 | + QGLWidget::swapBuffers(); |
3246 | +} |
3247 | |
3248 | === added file 'mixxx/src/waveform/widgets/qtsimplewaveformwidget.h' |
3249 | --- mixxx/src/waveform/widgets/qtsimplewaveformwidget.h 1970-01-01 00:00:00 +0000 |
3250 | +++ mixxx/src/waveform/widgets/qtsimplewaveformwidget.h 2012-05-17 02:22:20 +0000 |
3251 | @@ -0,0 +1,30 @@ |
3252 | +#ifndef QTSIMPLEWAVEFORMWIDGET_H |
3253 | +#define QTSIMPLEWAVEFORMWIDGET_H |
3254 | + |
3255 | +#include <QGLWidget> |
3256 | + |
3257 | +#include "waveformwidgetabstract.h" |
3258 | + |
3259 | +class QtSimpleWaveformWidget : public QGLWidget, public WaveformWidgetAbstract { |
3260 | + Q_OBJECT |
3261 | + public: |
3262 | + QtSimpleWaveformWidget(const char* group, QWidget* parent); |
3263 | + virtual ~QtSimpleWaveformWidget(); |
3264 | + |
3265 | + virtual QString getWaveformWidgetName() { return tr("Simple - Qt");} |
3266 | + virtual WaveformWidgetType::Type getType() const { return WaveformWidgetType::GLSimpleWaveform;} |
3267 | + |
3268 | + virtual bool useOpenGl() const { return true;} |
3269 | + virtual bool useOpenGLShaders() const { return false;} |
3270 | + |
3271 | + protected: |
3272 | + virtual void castToQWidget(); |
3273 | + virtual void paintEvent(QPaintEvent* event); |
3274 | + virtual void postRender(); |
3275 | + |
3276 | + private: |
3277 | + QtSimpleWaveformWidget() {} |
3278 | + friend class WaveformWidgetFactory; |
3279 | +}; |
3280 | + |
3281 | +#endif // QTSIMPLEWAVEFORMWIDGET_H |
3282 | |
3283 | === added file 'mixxx/src/waveform/widgets/qtwaveformwidget.cpp' |
3284 | --- mixxx/src/waveform/widgets/qtwaveformwidget.cpp 1970-01-01 00:00:00 +0000 |
3285 | +++ mixxx/src/waveform/widgets/qtwaveformwidget.cpp 2012-05-17 02:22:20 +0000 |
3286 | @@ -0,0 +1,56 @@ |
3287 | +#include "qtwaveformwidget.h" |
3288 | + |
3289 | +#include "waveform/renderers/waveformwidgetrenderer.h" |
3290 | +#include "waveform/renderers/waveformrenderbackground.h" |
3291 | +#include "waveform/renderers/qtwaveformrendererfilteredsignal.h" |
3292 | +#include "waveform/renderers/waveformrendererpreroll.h" |
3293 | +#include "waveform/renderers/waveformrendermark.h" |
3294 | +#include "waveform/renderers/waveformrendermarkrange.h" |
3295 | +#include "waveform/renderers/waveformrendererendoftrack.h" |
3296 | +#include "waveform/renderers/waveformrenderbeat.h" |
3297 | +#include "sharedglcontext.h" |
3298 | + |
3299 | +#include <QPainter> |
3300 | +#include <QGLContext> |
3301 | + |
3302 | +QtWaveformWidget::QtWaveformWidget( const char* group, QWidget* parent) : |
3303 | + QGLWidget(SharedGLContext::getContext(), parent), |
3304 | + WaveformWidgetAbstract(group) { |
3305 | + |
3306 | + addRenderer<WaveformRenderBackground>(); |
3307 | + addRenderer<WaveformRendererEndOfTrack>(); |
3308 | + addRenderer<WaveformRendererPreroll>(); |
3309 | + addRenderer<WaveformRenderMarkRange>(); |
3310 | + addRenderer<QtWaveformRendererFilteredSignal>(); |
3311 | + addRenderer<WaveformRenderMark>(); |
3312 | + addRenderer<WaveformRenderBeat>(); |
3313 | + |
3314 | + setAttribute(Qt::WA_NoSystemBackground); |
3315 | + setAttribute(Qt::WA_OpaquePaintEvent); |
3316 | + |
3317 | + setAutoBufferSwap(false); |
3318 | + |
3319 | + if (QGLContext::currentContext() != context()) { |
3320 | + makeCurrent(); |
3321 | + } |
3322 | + init(); |
3323 | +} |
3324 | + |
3325 | +QtWaveformWidget::~QtWaveformWidget() { |
3326 | +} |
3327 | + |
3328 | +void QtWaveformWidget::castToQWidget() { |
3329 | + m_widget = static_cast<QWidget*>(static_cast<QGLWidget*>(this)); |
3330 | +} |
3331 | + |
3332 | +void QtWaveformWidget::paintEvent( QPaintEvent* event) { |
3333 | + if (QGLContext::currentContext() != context()) { |
3334 | + makeCurrent(); |
3335 | + } |
3336 | + QPainter painter(this); |
3337 | + draw(&painter, event); |
3338 | +} |
3339 | + |
3340 | +void QtWaveformWidget::postRender() { |
3341 | + QGLWidget::swapBuffers(); |
3342 | +} |
3343 | |
3344 | === added file 'mixxx/src/waveform/widgets/qtwaveformwidget.h' |
3345 | --- mixxx/src/waveform/widgets/qtwaveformwidget.h 1970-01-01 00:00:00 +0000 |
3346 | +++ mixxx/src/waveform/widgets/qtwaveformwidget.h 2012-05-17 02:22:20 +0000 |
3347 | @@ -0,0 +1,30 @@ |
3348 | +#ifndef QTWAVEFORMWIDGET_H |
3349 | +#define QTWAVEFORMWIDGET_H |
3350 | + |
3351 | +#include <QGLWidget> |
3352 | + |
3353 | +#include "waveformwidgetabstract.h" |
3354 | + |
3355 | +class QtWaveformWidget : public QGLWidget, public WaveformWidgetAbstract { |
3356 | + Q_OBJECT |
3357 | + public: |
3358 | + QtWaveformWidget(const char* group, QWidget* parent); |
3359 | + virtual ~QtWaveformWidget(); |
3360 | + |
3361 | + virtual QString getWaveformWidgetName() { return tr("Filtered - Qt");} |
3362 | + virtual WaveformWidgetType::Type getType() const { return WaveformWidgetType::GLSLWaveform;} |
3363 | + |
3364 | + virtual bool useOpenGl() const { return true;} |
3365 | + virtual bool useOpenGLShaders() const { return false;} |
3366 | + |
3367 | + protected: |
3368 | + virtual void castToQWidget(); |
3369 | + virtual void paintEvent(QPaintEvent* event); |
3370 | + virtual void postRender(); |
3371 | + |
3372 | + private: |
3373 | + QtWaveformWidget() {} |
3374 | + friend class WaveformWidgetFactory; |
3375 | +}; |
3376 | + |
3377 | +#endif // QTWAVEFORMWIDGET_H |
3378 | |
3379 | === modified file 'mixxx/src/waveform/widgets/softwarewaveformwidget.cpp' |
3380 | --- mixxx/src/waveform/widgets/softwarewaveformwidget.cpp 2012-02-26 07:48:23 +0000 |
3381 | +++ mixxx/src/waveform/widgets/softwarewaveformwidget.cpp 2012-05-17 02:22:20 +0000 |
3382 | @@ -8,6 +8,7 @@ |
3383 | #include "waveform/renderers/waveformrendermarkrange.h" |
3384 | #include "waveform/renderers/waveformrendererfilteredsignal.h" |
3385 | #include "waveform/renderers/waveformrendererpreroll.h" |
3386 | +#include "waveform/renderers/waveformrendererendoftrack.h" |
3387 | #include "waveform/renderers/waveformrenderbeat.h" |
3388 | |
3389 | SoftwareWaveformWidget::SoftwareWaveformWidget( const char* group, QWidget* parent) : |
3390 | @@ -15,11 +16,11 @@ |
3391 | QWidget(parent) { |
3392 | |
3393 | addRenderer<WaveformRenderBackground>(); |
3394 | + addRenderer<WaveformRendererEndOfTrack>(); |
3395 | + addRenderer<WaveformRendererPreroll>(); |
3396 | addRenderer<WaveformRenderMarkRange>(); |
3397 | addRenderer<WaveformRendererFilteredSignal>(); |
3398 | - addRenderer<WaveformRendererPreroll>(); |
3399 | addRenderer<WaveformRenderMark>(); |
3400 | - addRenderer<WaveformRenderMarkRange>(); |
3401 | addRenderer<WaveformRenderBeat>(); |
3402 | |
3403 | init(); |
3404 | |
3405 | === modified file 'mixxx/src/waveform/widgets/softwarewaveformwidget.h' |
3406 | --- mixxx/src/waveform/widgets/softwarewaveformwidget.h 2012-04-29 18:45:39 +0000 |
3407 | +++ mixxx/src/waveform/widgets/softwarewaveformwidget.h 2012-05-17 02:22:20 +0000 |
3408 | @@ -10,7 +10,7 @@ |
3409 | public: |
3410 | virtual ~SoftwareWaveformWidget(); |
3411 | |
3412 | - virtual QString getWaveformWidgetName() { return tr("Filtered");} |
3413 | + virtual QString getWaveformWidgetName() { return tr("Filtered - Soft");} |
3414 | virtual WaveformWidgetType::Type getType() const { return WaveformWidgetType::SoftwareWaveform;} |
3415 | |
3416 | virtual bool useOpenGl() const { return false;} |
3417 | |
3418 | === modified file 'mixxx/src/waveform/widgets/waveformwidgettype.h' |
3419 | --- mixxx/src/waveform/widgets/waveformwidgettype.h 2012-04-29 18:45:39 +0000 |
3420 | +++ mixxx/src/waveform/widgets/waveformwidgettype.h 2012-05-17 02:22:20 +0000 |
3421 | @@ -5,8 +5,10 @@ |
3422 | public: |
3423 | enum Type { |
3424 | EmptyWaveform = 0, |
3425 | - SimpleSoftwareWaveform, //TODO |
3426 | + SoftwareSimpleWaveform, //TODO |
3427 | SoftwareWaveform, //TODO |
3428 | + QtSimpleWaveform, //TODO |
3429 | + QtWaveform, |
3430 | GLSimpleWaveform, |
3431 | GLWaveform, |
3432 | GLSLWaveform, |
3433 | |
3434 | === modified file 'mixxx/src/widget/wwaveformviewer.cpp' |
3435 | --- mixxx/src/widget/wwaveformviewer.cpp 2012-04-25 04:10:59 +0000 |
3436 | +++ mixxx/src/widget/wwaveformviewer.cpp 2012-05-17 02:22:20 +0000 |
3437 | @@ -153,7 +153,8 @@ |
3438 | |
3439 | void WWaveformViewer::wheelEvent(QWheelEvent *event) { |
3440 | if (m_waveformWidget) { |
3441 | - if (event->x() > width() - m_zoomZoneWidth) { |
3442 | + //NOTE: (vrince) to limit the zoom action area uncomment the following line |
3443 | + //if (event->x() > width() - m_zoomZoneWidth) { |
3444 | if (event->delta() > 0) { |
3445 | //qDebug() << "WaveformWidgetRenderer::wheelEvent +1"; |
3446 | onZoomChange(m_waveformWidget->getZoomFactor()+1); |
3447 | @@ -162,7 +163,7 @@ |
3448 | //qDebug() << "WaveformWidgetRenderer::wheelEvent -1"; |
3449 | onZoomChange(m_waveformWidget->getZoomFactor()-1); |
3450 | } |
3451 | - } |
3452 | + //} |
3453 | } |
3454 | } |
3455 |
Hey Thomas,
Have you considered using display lists or VBOs for the waveform
instead of immediate mode? I expect that would give you a fairly
significant drop in CPU usage. (Maybe you're already using VBOs for
the GLSL code?)
Thanks,
Albert