diff options
author | Peter D'Hoye <peter.dhoye@gmail.com> | 2009-07-03 22:16:11 +0000 |
---|---|---|
committer | Peter D'Hoye <peter.dhoye@gmail.com> | 2009-07-03 22:16:11 +0000 |
commit | 0d4560cb0305029fa5f0739670286176ab47cb65 (patch) | |
tree | 9899f4324664a77e6a5884fdd1541818a28a2172 /apps/plugins/pdbox/PDa/src/g_vumeter.c | |
parent | eabeb928ddfdbe5fc6379efb87d9522803310649 (diff) | |
download | rockbox-0d4560cb0305029fa5f0739670286176ab47cb65.tar.gz rockbox-0d4560cb0305029fa5f0739670286176ab47cb65.zip |
Accept FS #10244 by Wincent Balin: more pdbox work done for GSoC; also some keyword and line-ending fixes by me
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21626 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/pdbox/PDa/src/g_vumeter.c')
-rw-r--r-- | apps/plugins/pdbox/PDa/src/g_vumeter.c | 78 |
1 files changed, 77 insertions, 1 deletions
diff --git a/apps/plugins/pdbox/PDa/src/g_vumeter.c b/apps/plugins/pdbox/PDa/src/g_vumeter.c index fb3a8fafa4..2c43fbd120 100644 --- a/apps/plugins/pdbox/PDa/src/g_vumeter.c +++ b/apps/plugins/pdbox/PDa/src/g_vumeter.c | |||
@@ -5,7 +5,13 @@ | |||
5 | /* g_7_guis.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */ | 5 | /* g_7_guis.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */ |
6 | /* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */ | 6 | /* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */ |
7 | 7 | ||
8 | 8 | #ifdef ROCKBOX | |
9 | #include "plugin.h" | ||
10 | #include "pdbox.h" | ||
11 | #include "m_pd.h" | ||
12 | #include "g_canvas.h" | ||
13 | #include "g_all_guis.h" | ||
14 | #else /* ROCKBOX */ | ||
9 | #include <stdlib.h> | 15 | #include <stdlib.h> |
10 | #include <string.h> | 16 | #include <string.h> |
11 | #include <stdio.h> | 17 | #include <stdio.h> |
@@ -21,6 +27,7 @@ | |||
21 | #else | 27 | #else |
22 | #include <unistd.h> | 28 | #include <unistd.h> |
23 | #endif | 29 | #endif |
30 | #endif /* ROCKBOX */ | ||
24 | 31 | ||
25 | /* ----- vu gui-peak- & rms- vu-meter-display ---------- */ | 32 | /* ----- vu gui-peak- & rms- vu-meter-display ---------- */ |
26 | 33 | ||
@@ -31,6 +38,10 @@ static t_class *vu_class; | |||
31 | 38 | ||
32 | static void vu_update_rms(t_vu *x, t_glist *glist) | 39 | static void vu_update_rms(t_vu *x, t_glist *glist) |
33 | { | 40 | { |
41 | #ifdef ROCKBOX | ||
42 | (void) x; | ||
43 | (void) glist; | ||
44 | #else /* ROCKBOX */ | ||
34 | if(glist_isvisible(glist)) | 45 | if(glist_isvisible(glist)) |
35 | { | 46 | { |
36 | int w4=x->x_gui.x_w/4, off=text_ypix(&x->x_gui.x_obj, glist)-1; | 47 | int w4=x->x_gui.x_w/4, off=text_ypix(&x->x_gui.x_obj, glist)-1; |
@@ -40,10 +51,15 @@ static void vu_update_rms(t_vu *x, t_glist *glist) | |||
40 | glist_getcanvas(glist), x, quad1, off, quad3, | 51 | glist_getcanvas(glist), x, quad1, off, quad3, |
41 | off + (x->x_led_size+1)*(IEM_VU_STEPS-x->x_rms)); | 52 | off + (x->x_led_size+1)*(IEM_VU_STEPS-x->x_rms)); |
42 | } | 53 | } |
54 | #endif /* ROCKBOX */ | ||
43 | } | 55 | } |
44 | 56 | ||
45 | static void vu_update_peak(t_vu *x, t_glist *glist) | 57 | static void vu_update_peak(t_vu *x, t_glist *glist) |
46 | { | 58 | { |
59 | #ifdef ROCKBOX | ||
60 | (void) x; | ||
61 | (void) glist; | ||
62 | #else /* ROCKBOX */ | ||
47 | t_canvas *canvas=glist_getcanvas(glist); | 63 | t_canvas *canvas=glist_getcanvas(glist); |
48 | 64 | ||
49 | if(glist_isvisible(glist)) | 65 | if(glist_isvisible(glist)) |
@@ -74,10 +90,15 @@ static void vu_update_peak(t_vu *x, t_glist *glist) | |||
74 | mid, ypos+20); | 90 | mid, ypos+20); |
75 | } | 91 | } |
76 | } | 92 | } |
93 | #endif /* ROCKBOX */ | ||
77 | } | 94 | } |
78 | 95 | ||
79 | static void vu_draw_new(t_vu *x, t_glist *glist) | 96 | static void vu_draw_new(t_vu *x, t_glist *glist) |
80 | { | 97 | { |
98 | #ifdef ROCKBOX | ||
99 | (void) x; | ||
100 | (void) glist; | ||
101 | #else /* ROCKBOX */ | ||
81 | t_canvas *canvas=glist_getcanvas(glist); | 102 | t_canvas *canvas=glist_getcanvas(glist); |
82 | 103 | ||
83 | int xpos=text_xpix(&x->x_gui.x_obj, glist); | 104 | int xpos=text_xpix(&x->x_gui.x_obj, glist); |
@@ -151,11 +172,16 @@ static void vu_draw_new(t_vu *x, t_glist *glist) | |||
151 | xpos+x->x_gui.x_w+1, ypos-1, | 172 | xpos+x->x_gui.x_w+1, ypos-1, |
152 | x, 1); | 173 | x, 1); |
153 | } | 174 | } |
175 | #endif /* ROCKBOX */ | ||
154 | } | 176 | } |
155 | 177 | ||
156 | 178 | ||
157 | static void vu_draw_move(t_vu *x, t_glist *glist) | 179 | static void vu_draw_move(t_vu *x, t_glist *glist) |
158 | { | 180 | { |
181 | #ifdef ROCKBOX | ||
182 | (void) x; | ||
183 | (void) glist; | ||
184 | #else /* ROCKBOX */ | ||
159 | t_canvas *canvas=glist_getcanvas(glist); | 185 | t_canvas *canvas=glist_getcanvas(glist); |
160 | 186 | ||
161 | int xpos=text_xpix(&x->x_gui.x_obj, glist); | 187 | int xpos=text_xpix(&x->x_gui.x_obj, glist); |
@@ -212,10 +238,15 @@ static void vu_draw_move(t_vu *x, t_glist *glist) | |||
212 | xpos+x->x_gui.x_w+1-IOWIDTH, ypos-2, | 238 | xpos+x->x_gui.x_w+1-IOWIDTH, ypos-2, |
213 | xpos+x->x_gui.x_w+1, ypos-1); | 239 | xpos+x->x_gui.x_w+1, ypos-1); |
214 | } | 240 | } |
241 | #endif /* ROCKBOX */ | ||
215 | } | 242 | } |
216 | 243 | ||
217 | static void vu_draw_erase(t_vu* x,t_glist* glist) | 244 | static void vu_draw_erase(t_vu* x,t_glist* glist) |
218 | { | 245 | { |
246 | #ifdef ROCKBOX | ||
247 | (void) x; | ||
248 | (void) glist; | ||
249 | #else /* ROCKBOX */ | ||
219 | int i; | 250 | int i; |
220 | t_canvas *canvas=glist_getcanvas(glist); | 251 | t_canvas *canvas=glist_getcanvas(glist); |
221 | 252 | ||
@@ -244,10 +275,15 @@ static void vu_draw_erase(t_vu* x,t_glist* glist) | |||
244 | sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0); | 275 | sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0); |
245 | sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 1); | 276 | sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 1); |
246 | } | 277 | } |
278 | #endif /* ROCKBOX */ | ||
247 | } | 279 | } |
248 | 280 | ||
249 | static void vu_draw_config(t_vu* x, t_glist* glist) | 281 | static void vu_draw_config(t_vu* x, t_glist* glist) |
250 | { | 282 | { |
283 | #ifdef ROCKBOX | ||
284 | (void) x; | ||
285 | (void) glist; | ||
286 | #else /* ROCKBOX */ | ||
251 | int i; | 287 | int i; |
252 | t_canvas *canvas=glist_getcanvas(glist); | 288 | t_canvas *canvas=glist_getcanvas(glist); |
253 | 289 | ||
@@ -277,10 +313,16 @@ static void vu_draw_config(t_vu* x, t_glist* glist) | |||
277 | x, x->x_gui.x_bcol, x->x_gui.x_bcol); | 313 | x, x->x_gui.x_bcol, x->x_gui.x_bcol); |
278 | sys_vgui(".x%x.c itemconfigure %xPLED -width %d\n", canvas, x, | 314 | sys_vgui(".x%x.c itemconfigure %xPLED -width %d\n", canvas, x, |
279 | x->x_led_size); | 315 | x->x_led_size); |
316 | #endif /* ROCKBOX */ | ||
280 | } | 317 | } |
281 | 318 | ||
282 | static void vu_draw_io(t_vu* x, t_glist* glist, int old_snd_rcv_flags) | 319 | static void vu_draw_io(t_vu* x, t_glist* glist, int old_snd_rcv_flags) |
283 | { | 320 | { |
321 | #ifdef ROCKBOX | ||
322 | (void) x; | ||
323 | (void) glist; | ||
324 | (void) old_snd_rcv_flags; | ||
325 | #else /* ROCKBOX */ | ||
284 | int xpos=text_xpix(&x->x_gui.x_obj, glist); | 326 | int xpos=text_xpix(&x->x_gui.x_obj, glist); |
285 | int ypos=text_ypix(&x->x_gui.x_obj, glist); | 327 | int ypos=text_ypix(&x->x_gui.x_obj, glist); |
286 | t_canvas *canvas=glist_getcanvas(glist); | 328 | t_canvas *canvas=glist_getcanvas(glist); |
@@ -321,10 +363,15 @@ static void vu_draw_io(t_vu* x, t_glist* glist, int old_snd_rcv_flags) | |||
321 | sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0); | 363 | sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0); |
322 | sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 1); | 364 | sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 1); |
323 | } | 365 | } |
366 | #endif /* ROCKBOX */ | ||
324 | } | 367 | } |
325 | 368 | ||
326 | static void vu_draw_select(t_vu* x,t_glist* glist) | 369 | static void vu_draw_select(t_vu* x,t_glist* glist) |
327 | { | 370 | { |
371 | #ifdef ROCKBOX | ||
372 | (void) x; | ||
373 | (void) glist; | ||
374 | #else /* ROCKBOX */ | ||
328 | int i; | 375 | int i; |
329 | t_canvas *canvas=glist_getcanvas(glist); | 376 | t_canvas *canvas=glist_getcanvas(glist); |
330 | 377 | ||
@@ -362,6 +409,7 @@ static void vu_draw_select(t_vu* x,t_glist* glist) | |||
362 | } | 409 | } |
363 | sys_vgui(".x%x.c itemconfigure %xLABEL -fill #%6.6x\n", canvas, x, x->x_gui.x_lcol); | 410 | sys_vgui(".x%x.c itemconfigure %xLABEL -fill #%6.6x\n", canvas, x, x->x_gui.x_lcol); |
364 | } | 411 | } |
412 | #endif /* ROCKBOX */ | ||
365 | } | 413 | } |
366 | 414 | ||
367 | void vu_draw(t_vu *x, t_glist *glist, int mode) | 415 | void vu_draw(t_vu *x, t_glist *glist, int mode) |
@@ -425,6 +473,10 @@ void vu_check_height(t_vu *x, int h) | |||
425 | 473 | ||
426 | static void vu_scale(t_vu *x, t_floatarg fscale) | 474 | static void vu_scale(t_vu *x, t_floatarg fscale) |
427 | { | 475 | { |
476 | #ifdef ROCKBOX | ||
477 | (void) x; | ||
478 | (void) fscale; | ||
479 | #else /* ROCKBOX */ | ||
428 | int i, scale = (int)fscale; | 480 | int i, scale = (int)fscale; |
429 | 481 | ||
430 | if(scale != 0) scale = 1; | 482 | if(scale != 0) scale = 1; |
@@ -446,7 +498,11 @@ static void vu_scale(t_vu *x, t_floatarg fscale) | |||
446 | } | 498 | } |
447 | if(!x->x_scale && scale) | 499 | if(!x->x_scale && scale) |
448 | { | 500 | { |
501 | #ifdef ROCKBOX | ||
502 | int end=text_xpix(&x->x_gui.x_obj, x->x_gui.x_glist)+x->x_gui.x_w+4; | ||
503 | #else /* ROCKBOX */ | ||
449 | int w4=x->x_gui.x_w/4, end=text_xpix(&x->x_gui.x_obj, x->x_gui.x_glist)+x->x_gui.x_w+4; | 504 | int w4=x->x_gui.x_w/4, end=text_xpix(&x->x_gui.x_obj, x->x_gui.x_glist)+x->x_gui.x_w+4; |
505 | #endif /* ROCKBOX */ | ||
450 | int k1=x->x_led_size+1, k2=IEM_VU_STEPS+1, k3=k1/2; | 506 | int k1=x->x_led_size+1, k2=IEM_VU_STEPS+1, k3=k1/2; |
451 | int yyy, k4=text_ypix(&x->x_gui.x_obj, x->x_gui.x_glist)-k3; | 507 | int yyy, k4=text_ypix(&x->x_gui.x_obj, x->x_gui.x_glist)-k3; |
452 | t_canvas *canvas=glist_getcanvas(x->x_gui.x_glist); | 508 | t_canvas *canvas=glist_getcanvas(x->x_gui.x_glist); |
@@ -471,10 +527,15 @@ static void vu_scale(t_vu *x, t_floatarg fscale) | |||
471 | x->x_gui.x_lcol, x, i); | 527 | x->x_gui.x_lcol, x, i); |
472 | } | 528 | } |
473 | } | 529 | } |
530 | #endif /* ROCKBOX */ | ||
474 | } | 531 | } |
475 | 532 | ||
476 | static void vu_properties(t_gobj *z, t_glist *owner) | 533 | static void vu_properties(t_gobj *z, t_glist *owner) |
477 | { | 534 | { |
535 | #ifdef ROCKBOX | ||
536 | (void) z; | ||
537 | (void) owner; | ||
538 | #else /* ROCKBOX */ | ||
478 | t_vu *x = (t_vu *)z; | 539 | t_vu *x = (t_vu *)z; |
479 | char buf[800]; | 540 | char buf[800]; |
480 | t_symbol *srl[3]; | 541 | t_symbol *srl[3]; |
@@ -496,6 +557,7 @@ static void vu_properties(t_gobj *z, t_glist *owner) | |||
496 | x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize, | 557 | x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize, |
497 | 0xffffff & x->x_gui.x_bcol, -1/*no front-color*/, 0xffffff & x->x_gui.x_lcol); | 558 | 0xffffff & x->x_gui.x_bcol, -1/*no front-color*/, 0xffffff & x->x_gui.x_lcol); |
498 | gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); | 559 | gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); |
560 | #endif /* ROCKBOX */ | ||
499 | } | 561 | } |
500 | 562 | ||
501 | static void vu_dialog(t_vu *x, t_symbol *s, int argc, t_atom *argv) | 563 | static void vu_dialog(t_vu *x, t_symbol *s, int argc, t_atom *argv) |
@@ -506,6 +568,10 @@ static void vu_dialog(t_vu *x, t_symbol *s, int argc, t_atom *argv) | |||
506 | int scale = (int)atom_getintarg(4, argc, argv); | 568 | int scale = (int)atom_getintarg(4, argc, argv); |
507 | int sr_flags; | 569 | int sr_flags; |
508 | 570 | ||
571 | #ifdef ROCKBOX | ||
572 | (void) s; | ||
573 | #endif | ||
574 | |||
509 | srl[0] = gensym("empty"); | 575 | srl[0] = gensym("empty"); |
510 | sr_flags = iemgui_dialog(&x->x_gui, srl, argc, argv); | 576 | sr_flags = iemgui_dialog(&x->x_gui, srl, argc, argv); |
511 | x->x_gui.x_fsf.x_snd_able = 0; | 577 | x->x_gui.x_fsf.x_snd_able = 0; |
@@ -523,6 +589,9 @@ static void vu_dialog(t_vu *x, t_symbol *s, int argc, t_atom *argv) | |||
523 | 589 | ||
524 | static void vu_size(t_vu *x, t_symbol *s, int ac, t_atom *av) | 590 | static void vu_size(t_vu *x, t_symbol *s, int ac, t_atom *av) |
525 | { | 591 | { |
592 | #ifdef ROCKBOX | ||
593 | (void) s; | ||
594 | #endif | ||
526 | x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av)); | 595 | x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av)); |
527 | if(ac > 1) | 596 | if(ac > 1) |
528 | vu_check_height(x, (int)atom_getintarg(1, ac, av)); | 597 | vu_check_height(x, (int)atom_getintarg(1, ac, av)); |
@@ -608,9 +677,14 @@ static void *vu_new(t_symbol *s, int argc, t_atom *argv) | |||
608 | t_vu *x = (t_vu *)pd_new(vu_class); | 677 | t_vu *x = (t_vu *)pd_new(vu_class); |
609 | int bflcol[]={-66577, -1, -1}; | 678 | int bflcol[]={-66577, -1, -1}; |
610 | int w=IEM_GUI_DEFAULTSIZE, h=IEM_VU_STEPS*IEM_VU_DEFAULTSIZE; | 679 | int w=IEM_GUI_DEFAULTSIZE, h=IEM_VU_STEPS*IEM_VU_DEFAULTSIZE; |
680 | #ifdef ROCKBOX | ||
681 | int ldx=-1, ldy=-8, fs=8, scale=1; | ||
682 | (void) s; | ||
683 | #else /* ROCKBOX */ | ||
611 | int ldx=-1, ldy=-8, f=0, fs=8, scale=1; | 684 | int ldx=-1, ldy=-8, f=0, fs=8, scale=1; |
612 | int ftbreak=IEM_BNG_DEFAULTBREAKFLASHTIME, fthold=IEM_BNG_DEFAULTHOLDFLASHTIME; | 685 | int ftbreak=IEM_BNG_DEFAULTBREAKFLASHTIME, fthold=IEM_BNG_DEFAULTHOLDFLASHTIME; |
613 | char str[144]; | 686 | char str[144]; |
687 | #endif /* ROCKBOX */ | ||
614 | 688 | ||
615 | iem_inttosymargs(&x->x_gui.x_isa, 0); | 689 | iem_inttosymargs(&x->x_gui.x_isa, 0); |
616 | iem_inttofstyle(&x->x_gui.x_fsf, 0); | 690 | iem_inttofstyle(&x->x_gui.x_fsf, 0); |
@@ -678,7 +752,9 @@ static void vu_free(t_vu *x) | |||
678 | { | 752 | { |
679 | if(x->x_gui.x_fsf.x_rcv_able) | 753 | if(x->x_gui.x_fsf.x_rcv_able) |
680 | pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); | 754 | pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); |
755 | #ifndef ROCKBOX | ||
681 | gfxstub_deleteforkey(x); | 756 | gfxstub_deleteforkey(x); |
757 | #endif | ||
682 | } | 758 | } |
683 | 759 | ||
684 | void g_vumeter_setup(void) | 760 | void g_vumeter_setup(void) |