Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18262
Modified Files:
Tag: impd_0_37
g_hslider.c g_vumeter.c g_hdial.c
Log Message:
deleted 100 lines
Index: g_hslider.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_hslider.c,v
retrieving revision 1.1.1.3.2.2.2.24
retrieving revision 1.1.1.3.2.2.2.25
diff -C2 -d -r1.1.1.3.2.2.2.24 -r1.1.1.3.2.2.2.25
*** g_hslider.c 7 May 2004 07:15:38 -0000 1.1.1.3.2.2.2.24
--- g_hslider.c 8 May 2004 21:13:34 -0000 1.1.1.3.2.2.2.25
***************
*** 35,51 ****
}
- static void slider_draw(t_slider *x, t_glist *glist, int mode)
- {
- if (mode==IEM_GUI_DRAW_MODE_ERASE) {
- sys_mgui((t_iemgui *)x,"slider","erase","");
- } else if (mode==IEM_GUI_DRAW_MODE_SELECT) {
- sys_mgui((t_iemgui *)x,"slider","select","i",x->x_gui.x_selected);
- } else {
- pd_upload((t_gobj *)x,glist);
- sys_mgui((t_iemgui *)x,"slider","draw","");
- // sys_mgui((t_iemgui *)x,"slider","set","i",x->x_val);
- }
- }
-
/* ------------------------ hsl widgetbehaviour----------------------------- */
--- 35,38 ----
***************
*** 114,118 ****
x->x_val = (int)(100.0*g + 0.49999);
x->x_pos = x->x_val;
! x->x_gui.x_draw(x, x->x_gui.x_glist, 0);
}
--- 101,105 ----
x->x_val = (int)(100.0*g + 0.49999);
x->x_pos = x->x_val;
! iemgui_dodraw((t_iemgui *)x);
}
***************
*** 145,150 ****
static void slider_lin(t_slider *x) {x->x_gui.x_lin0_log1 = 0; x->x_k = (x->x_max-x->x_min)/(double)((isvert(x)?x->x_gui.x_h:x->x_gui.x_w)-1);}
static void slider_log(t_slider *x) {x->x_gui.x_lin0_log1 = 1; slider_check_minmax(x);}
-
- static void slider_init(t_slider *x, t_floatarg f) {x->x_gui.x_loadinit = !!f;}
static void slider_steady(t_slider *x, t_floatarg f) {x->x_gui.x_steady = !!f;}
--- 132,135 ----
***************
*** 159,163 ****
t_iemgui *y = (t_iemgui *)x;
if(!sys_noloadbang && y->x_loadinit) {
! y->x_draw(x,y->x_glist,0);
slider_bang(x);
}
--- 144,148 ----
t_iemgui *y = (t_iemgui *)x;
if(!sys_noloadbang && y->x_loadinit) {
! iemgui_dodraw((t_iemgui *)x);
slider_bang(x);
}
***************
*** 184,188 ****
y->x_rcv_able = y->x_rcv!=sym_empty;
if(y->x_rcv_able) pd_bind((t_pd *)x, y->x_rcv);
! if (glist_isvisible(glist_getcanvas(y->x_glist))) x->x_gui.x_draw(x, y->x_glist, 0);
}
--- 169,173 ----
y->x_rcv_able = y->x_rcv!=sym_empty;
if(y->x_rcv_able) pd_bind((t_pd *)x, y->x_rcv);
! if (glist_isvisible(glist_getcanvas(y->x_glist))) iemgui_dodraw((t_iemgui *)x);
}
***************
*** 191,195 ****
t_iemgui *y = iemgui_new(slider_class);
t_slider *x = (t_slider *)y;
- y->x_draw = (t_iemfunptr)slider_draw;
x->x_flavor=s;
x->x_min=0.0;
--- 176,179 ----
***************
*** 228,232 ****
class_addmethod(c, (t_method)slider_log, gensym("log"), 0);
class_addmethod(c, (t_method)slider_lin, gensym("lin"), 0);
! class_addmethod(c, (t_method)slider_init, gensym("init"), A_FLOAT, 0);
class_addmethod(c, (t_method)slider_steady, gensym("steady"), A_FLOAT, 0);
--- 212,216 ----
class_addmethod(c, (t_method)slider_log, gensym("log"), 0);
class_addmethod(c, (t_method)slider_lin, gensym("lin"), 0);
! class_addmethod(c, (t_method)iemgui_init, gensym("init"), A_FLOAT, 0);
class_addmethod(c, (t_method)slider_steady, gensym("steady"), A_FLOAT, 0);
Index: g_hdial.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_hdial.c,v
retrieving revision 1.1.1.4.2.2.2.21
retrieving revision 1.1.1.4.2.2.2.22
diff -C2 -d -r1.1.1.4.2.2.2.21 -r1.1.1.4.2.2.2.22
*** g_hdial.c 4 May 2004 07:15:49 -0000 1.1.1.4.2.2.2.21
--- g_hdial.c 8 May 2004 21:13:34 -0000 1.1.1.4.2.2.2.22
***************
*** 32,48 ****
}
- static void radio_draw(t_radio *x, t_glist *glist, int mode)
- {
- if (mode==IEM_GUI_DRAW_MODE_ERASE) {
- sys_mgui((t_iemgui *)x,"radio","erase","");
- } else if (mode==IEM_GUI_DRAW_MODE_SELECT) {
- sys_mgui((t_iemgui *)x,"radio","select","i",x->x_gui.x_selected);
- } else {
- pd_upload((t_gobj *)x,glist);
- sys_mgui((t_iemgui *)x,"radio","draw","");
- sys_mgui((t_iemgui *)x,"radio","set","i",x->x_on);
- }
- }
-
/* ------------------------ hdl widgetbehaviour----------------------------- */
--- 32,35 ----
***************
*** 79,91 ****
int old=x->x_on_old;
CLAMP(i,0,x->x_number-1);
! if(x->x_on != x->x_on_old) {
! x->x_on_old = x->x_on;
! x->x_on = i;
! x->x_gui.x_draw(x, x->x_gui.x_glist, 0);
! x->x_on_old = old;
! } else {
! x->x_on = i;
! x->x_gui.x_draw(x, x->x_gui.x_glist, 0);
! }
}
--- 66,87 ----
int old=x->x_on_old;
CLAMP(i,0,x->x_number-1);
! if(x->x_on!=old) x->x_on_old = x->x_on;
! x->x_on = i;
! iemgui_dodraw((t_iemgui *)x);
! if(x->x_on!=old) x->x_on_old = old;
! }
!
! static void radio_send2(t_radio *x, float a, float b) {
! SETFLOAT(x->x_at,a);
! SETFLOAT(x->x_at+1,b);
! outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at);
! if(x->x_gui.x_snd_able && x->x_gui.x_snd->s_thing)
! pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at);
! }
!
! static void radio_send(t_radio *x, float a) {
! outlet_float(x->x_gui.x_obj.ob_outlet,a);
! if(x->x_gui.x_snd_able && x->x_gui.x_snd->s_thing)
! pd_float(x->x_gui.x_snd->s_thing,a);
}
***************
*** 93,118 ****
{
/* compatibility with earlier "hdial" behavior */
! if (x->x_flavor == sym_vdl || x->x_flavor == sym_hdl)
! {
! if(x->x_change && x->x_on!=x->x_on_old)
! {
! SETFLOAT(x->x_at, (float)x->x_on_old);
! SETFLOAT(x->x_at+1, 0.0);
! outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at);
! if(x->x_gui.x_snd_able && x->x_gui.x_snd->s_thing)
! pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at);
! }
x->x_on_old = x->x_on;
! SETFLOAT(x->x_at, (float)x->x_on);
! SETFLOAT(x->x_at+1, 1.0);
! outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at);
! if(x->x_gui.x_snd_able && x->x_gui.x_snd->s_thing)
! pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at);
! }
! else
! {
! outlet_float(x->x_gui.x_obj.ob_outlet, x->x_on);
! if(x->x_gui.x_snd_able && x->x_gui.x_snd->s_thing)
! pd_float(x->x_gui.x_snd->s_thing, x->x_on);
}
}
--- 89,98 ----
{
/* compatibility with earlier "hdial" behavior */
! if (x->x_flavor == sym_vdl || x->x_flavor == sym_hdl) {
! if(x->x_change && x->x_on!=x->x_on_old) radio_send2(x,x->x_on_old,0.0);
x->x_on_old = x->x_on;
! radio_send2(x,x->x_on,1.0);
! } else {
! radio_send(x,x->x_on);
}
}
***************
*** 125,153 ****
{
/* compatibility with earlier "hdial" behavior */
! if(x->x_change && i!=x->x_on_old)
! {
! SETFLOAT(x->x_at, (float)x->x_on_old);
! SETFLOAT(x->x_at+1, 0.0);
! outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at);
! if(x->x_gui.x_snd_able && x->x_gui.x_snd->s_thing)
! pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at);
! }
x->x_on_old = x->x_on;
x->x_on = i;
! x->x_gui.x_draw(x, x->x_gui.x_glist, 0);
x->x_on_old = x->x_on;
! SETFLOAT(x->x_at, (float)x->x_on);
! SETFLOAT(x->x_at+1, 1.0);
! outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at);
! if(x->x_gui.x_snd_able && x->x_gui.x_snd->s_thing)
! pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at);
! }
! else
! {
x->x_on = i;
! outlet_float(x->x_gui.x_obj.ob_outlet, x->x_on);
! if(x->x_gui.x_snd_able && x->x_gui.x_snd->s_thing)
! pd_float(x->x_gui.x_snd->s_thing, x->x_on);
! x->x_gui.x_draw(x, x->x_gui.x_glist, 0);
x->x_on_old = x->x_on;
}
--- 105,118 ----
{
/* compatibility with earlier "hdial" behavior */
! if(x->x_change && i!=x->x_on_old) radio_send2(x,x->x_on_old,0.0);
x->x_on_old = x->x_on;
x->x_on = i;
! iemgui_dodraw((t_iemgui *)x);
x->x_on_old = x->x_on;
! radio_send2(x,x->x_on,1.0);
! } else {
x->x_on = i;
! radio_send(x,x->x_on);
! iemgui_dodraw((t_iemgui *)x);
x->x_on_old = x->x_on;
}
***************
*** 158,195 ****
int i=(int)f;
CLAMP(i,0,x->x_number-1);
-
if (x->x_flavor == sym_vdl || x->x_flavor == sym_hdl)
{
/* compatibility with earlier "vdial" behavior */
! if (x->x_change && i!=x->x_on_old && x->x_gui.x_put_in2out) {
! SETFLOAT(x->x_at, (float)x->x_on_old);
! SETFLOAT(x->x_at+1, 0.0);
! outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at);
! if(x->x_gui.x_snd_able && x->x_gui.x_snd->s_thing)
! pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at);
! }
x->x_on_old = x->x_on;
x->x_on = i;
! x->x_gui.x_draw(x, x->x_gui.x_glist, 0);
x->x_on_old = x->x_on;
! if(x->x_gui.x_put_in2out)
! {
! SETFLOAT(x->x_at, (float)x->x_on);
! SETFLOAT(x->x_at+1, 1.0);
! outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at);
! if(x->x_gui.x_snd_able && x->x_gui.x_snd->s_thing)
! pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at);
! }
! }
! else
! {
x->x_on = i;
! if (x->x_gui.x_put_in2out)
! {
! outlet_float(x->x_gui.x_obj.ob_outlet, x->x_on);
! if(x->x_gui.x_snd_able && x->x_gui.x_snd->s_thing)
! pd_float(x->x_gui.x_snd->s_thing, x->x_on);
! }
! x->x_gui.x_draw(x, x->x_gui.x_glist, 0);
x->x_on_old = x->x_on;
}
--- 123,140 ----
int i=(int)f;
CLAMP(i,0,x->x_number-1);
if (x->x_flavor == sym_vdl || x->x_flavor == sym_hdl)
{
/* compatibility with earlier "vdial" behavior */
! if (x->x_change && i!=x->x_on_old && x->x_gui.x_put_in2out)
! radio_send2(x,x->x_on_old,0.0);
x->x_on_old = x->x_on;
x->x_on = i;
! iemgui_dodraw((t_iemgui *)x);
x->x_on_old = x->x_on;
! if(x->x_gui.x_put_in2out) radio_send2(x,x->x_on,1.0);
! } else {
x->x_on = i;
! if (x->x_gui.x_put_in2out) radio_send(x,x->x_on);
! iemgui_dodraw((t_iemgui *)x);
x->x_on_old = x->x_on;
}
***************
*** 208,224 ****
CLAMP(x->x_on,0,x->x_number-1);
x->x_on_old = x->x_on;
! x->x_gui.x_draw(x, x->x_gui.x_glist, 0);
}
}
! static void radio_size(t_radio *x, t_symbol *s, int ac, t_atom *av)
{
! x->x_gui.x_h = x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av));
iemgui_size((t_iemgui *)x);
}
- static void radio_init(t_radio *x, t_floatarg f)
- {x->x_gui.x_loadinit = (f==0.0)?0:1;}
-
static void radio_double_change(t_radio *x) {x->x_change = 1;}
static void radio_single_change(t_radio *x) {x->x_change = 0;}
--- 153,166 ----
CLAMP(x->x_on,0,x->x_number-1);
x->x_on_old = x->x_on;
! iemgui_dodraw((t_iemgui *)x);
}
}
! static void radio_size(t_radio *x, t_float size)
{
! x->x_gui.x_h = x->x_gui.x_w = iemgui_clip_size(size);
iemgui_size((t_iemgui *)x);
}
static void radio_double_change(t_radio *x) {x->x_change = 1;}
static void radio_single_change(t_radio *x) {x->x_change = 0;}
***************
*** 227,241 ****
{
t_iemgui *y = (t_iemgui *)x;
! int isa=0;
if(!pd_scanargs(argc,argv,"ibiiaaaiiiiccci",
&y->x_w,&x->x_change,&isa,&x->x_number,&y->x_snd,&y->x_rcv,&y->x_lab,
&y->x_ldx,&y->x_ldy,&y->x_font_style,&y->x_fontsize,
&y->x_bcol,&y->x_fcol,&y->x_lcol,&x->x_on)) return;
! iem_inttosymargs(&x->x_gui, isa);
iemgui_constrain(y);
y->x_snd_able = y->x_snd!=sym_empty;
y->x_rcv_able = y->x_rcv!=sym_empty;
if (y->x_rcv_able) pd_bind((t_pd *)x, y->x_rcv);
! if (glist_isvisible(glist_getcanvas(y->x_glist))) x->x_gui.x_draw(x, y->x_glist, 0);
}
--- 169,183 ----
{
t_iemgui *y = (t_iemgui *)x;
! int isa;
if(!pd_scanargs(argc,argv,"ibiiaaaiiiiccci",
&y->x_w,&x->x_change,&isa,&x->x_number,&y->x_snd,&y->x_rcv,&y->x_lab,
&y->x_ldx,&y->x_ldy,&y->x_font_style,&y->x_fontsize,
&y->x_bcol,&y->x_fcol,&y->x_lcol,&x->x_on)) return;
! iem_inttosymargs(y,isa);
iemgui_constrain(y);
y->x_snd_able = y->x_snd!=sym_empty;
y->x_rcv_able = y->x_rcv!=sym_empty;
if (y->x_rcv_able) pd_bind((t_pd *)x, y->x_rcv);
! if (glist_isvisible(glist_getcanvas(y->x_glist))) iemgui_dodraw((t_iemgui *)x);
}
***************
*** 249,253 ****
x->x_flavor=s;
y->x_binbufindex = 4;
- y->x_draw = (t_iemfunptr)radio_draw;
CLAMP(x->x_number,1,IEM_RADIO_MAX);
CLAMP(x->x_on,0,x->x_number-1);
--- 191,194 ----
***************
*** 275,280 ****
class_addmethod(c, (t_method)radio_loadbang, gensym("loadbang"), 0);
class_addmethod(c, (t_method)radio_set, gensym("set"), A_FLOAT, 0);
! class_addmethod(c, (t_method)radio_size, gensym("size"), A_GIMME, 0);
! class_addmethod(c, (t_method)radio_init, gensym("init"), A_FLOAT, 0);
class_addmethod(c, (t_method)radio_fout, gensym("fout"), A_FLOAT, 0);
class_addmethod(c, (t_method)radio_number, gensym("number"), A_FLOAT, 0);
--- 216,221 ----
class_addmethod(c, (t_method)radio_loadbang, gensym("loadbang"), 0);
class_addmethod(c, (t_method)radio_set, gensym("set"), A_FLOAT, 0);
! class_addmethod(c, (t_method)radio_size, gensym("size"), A_FLOAT, 0);
! class_addmethod(c, (t_method)iemgui_init, gensym("init"), A_FLOAT, 0);
class_addmethod(c, (t_method)radio_fout, gensym("fout"), A_FLOAT, 0);
class_addmethod(c, (t_method)radio_number, gensym("number"), A_FLOAT, 0);
***************
*** 288,292 ****
wb.w_deletefn = iemgui_delete;
wb.w_visfn = iemgui_vis;
! wb.w_clickfn = 0 /*radio_newclick*/;
sym_hdl = gensym("hdl");
--- 229,233 ----
wb.w_deletefn = iemgui_delete;
wb.w_visfn = iemgui_vis;
! wb.w_clickfn = 0;
sym_hdl = gensym("hdl");
Index: g_vumeter.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_vumeter.c,v
retrieving revision 1.1.1.3.2.2.2.17
retrieving revision 1.1.1.3.2.2.2.18
diff -C2 -d -r1.1.1.3.2.2.2.17 -r1.1.1.3.2.2.2.18
*** g_vumeter.c 4 May 2004 07:15:49 -0000 1.1.1.3.2.2.2.17
--- g_vumeter.c 8 May 2004 21:13:34 -0000 1.1.1.3.2.2.2.18
***************
*** 22,33 ****
#endif
- #define IEM_VU_DEFAULTSIZE 3
- #define IEM_VU_LARGESMALL 2
- #define IEM_VU_MINSIZE 2
- #define IEM_VU_MAXSIZE 25
#define IEM_VU_STEPS 40
- #define IEM_VU_MINDB -99.9
- #define IEM_VU_MAXDB 12.0
- #define IEM_VU_OFFSET 100.0
static int iemgui_vu_db2i[]=
--- 22,26 ----
***************
*** 53,72 ****
/* widget helper functions */
! static void vu_update_rms(t_vu *x, t_glist *glist)
! {if(glist_isvisible(glist)) sys_mgui((t_iemgui *)x,"vu","set","i",x->x_rms);}
! static void vu_update_peak(t_vu *x, t_glist *glist)
! {if(glist_isvisible(glist)) sys_mgui((t_iemgui *)x,"vu","peak","i",x->x_peak);}
! void vu_draw(t_vu *x, t_glist *glist, int mode)
! {
if(mode == IEM_GUI_DRAW_MODE_SELECT) {
- sys_mgui((t_iemgui *)x,"vu","select","i",x->x_gui.x_selected);
} else if(mode == IEM_GUI_DRAW_MODE_ERASE) {
- sys_mgui((t_iemgui *)x,"vu","erase","");
} else {
! pd_upload((t_gobj *)x,glist);
! sys_mgui((t_iemgui *)x,"vu","draw","");
! sys_mgui((t_iemgui *)x,"vu","set","i",x->x_rms);
! sys_mgui((t_iemgui *)x,"vu","peak","i",x->x_peak);
}
}
--- 46,58 ----
/* widget helper functions */
! static void vu_update(t_vu *x, t_glist *glist)
! {if(glist_isvisible(glist)) sys_mgui((t_iemgui *)x,"set","ii",x->x_rms,x->x_peak);}
! void vu_draw(t_vu *x, t_glist *glist, int mode) {
! iemgui_draw((t_iemgui *)x,glist,mode);
if(mode == IEM_GUI_DRAW_MODE_SELECT) {
} else if(mode == IEM_GUI_DRAW_MODE_ERASE) {
} else {
! sys_mgui((t_iemgui *)x,"set","ii",x->x_rms,x->x_peak);
}
}
***************
*** 90,109 ****
t_symbol *srl[3];
iemgui_save(&x->x_gui, srl, 0);
! binbuf_addv(b, "ssiisiissiiiiiiii", gensym("#X"),gensym("obj"),
! (t_int)x->x_gui.x_obj.te_xpix, (t_int)x->x_gui.x_obj.te_ypix,
! gensym("vu"), x->x_gui.x_w, x->x_gui.x_h,
! srl[1], srl[2],
! x->x_gui.x_ldx, x->x_gui.x_ldy,
! x->x_gui.x_font_style, x->x_gui.x_fontsize,
convert_color2(y->x_bcol), convert_color2(y->x_lcol),
! x->x_scale,
! iem_symargstoint(&x->x_gui));
! binbuf_addv(b, ";");
}
void vu_check_height(t_vu *x, int h)
{
! int n=h/IEM_VU_STEPS;
! n = MAX(n,IEM_VU_MINSIZE);
x->x_led_size = n-1;
x->x_gui.x_h = IEM_VU_STEPS * n;
--- 76,90 ----
t_symbol *srl[3];
iemgui_save(&x->x_gui, srl, 0);
! binbuf_addv(b, "ssiisiissiiiiiiii;", gensym("#X"),gensym("obj"),
! (t_int)y->x_obj.te_xpix, (t_int)y->x_obj.te_ypix,
! gensym("vu"), y->x_w, y->x_h, srl[1], srl[2],
! y->x_ldx, y->x_ldy, y->x_font_style, y->x_fontsize,
convert_color2(y->x_bcol), convert_color2(y->x_lcol),
! x->x_scale, iem_symargstoint(y));
}
void vu_check_height(t_vu *x, int h)
{
! int n=MAX(h/IEM_VU_STEPS,2);
x->x_led_size = n-1;
x->x_gui.x_h = IEM_VU_STEPS * n;
***************
*** 111,115 ****
static void vu_scale(t_vu *x, t_floatarg fscale)
! {x->x_scale = !!fscale; x->x_gui.x_draw(x, x->x_gui.x_glist,0);}
static void vu_size(t_vu *x, t_symbol *s, int ac, t_atom *av)
--- 92,96 ----
static void vu_scale(t_vu *x, t_floatarg fscale)
! {x->x_scale = !!fscale; iemgui_dodraw((t_iemgui *)x);}
static void vu_size(t_vu *x, t_symbol *s, int ac, t_atom *av)
***************
*** 118,158 ****
if(ac > 1) vu_check_height(x, (int)atom_getintarg(1, ac, av));
if(glist_isvisible(x->x_gui.x_glist)) {
! x->x_gui.x_draw(x, x->x_gui.x_glist, 0);
canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x);
}
}
! static void vu_float(t_vu *x, t_floatarg rms)
! {
! int i;
! if(rms <= IEM_VU_MINDB) x->x_rms = 0;
! else if(rms >= IEM_VU_MAXDB)x->x_rms = IEM_VU_STEPS;
! else x->x_rms = iemgui_vu_db2i[ (int)(2.0*(rms + IEM_VU_OFFSET)) ];
! i = (int)(100.0*rms + 10000.5);
! rms = 0.01*(float)(i - 10000);
! x->x_fr = rms;
! outlet_float(x->x_out_rms, rms);
! vu_update_rms(x, x->x_gui.x_glist);
}
! static void vu_ft1(t_vu *x, t_floatarg peak)
! {
! int i;
! if(peak <= IEM_VU_MINDB) x->x_peak = 0;
! else if(peak >= IEM_VU_MAXDB)x->x_peak = IEM_VU_STEPS;
! else x->x_peak = iemgui_vu_db2i[ (int)(2.0*(peak + IEM_VU_OFFSET)) ];
! i = (int)(100.0*peak + 10000.5);
! peak = 0.01*(float)(i - 10000);
! x->x_fp = peak;
! outlet_float(x->x_out_peak, peak);
! vu_update_peak(x, x->x_gui.x_glist);
! }
static void vu_bang(t_vu *x)
{
outlet_float(x->x_out_peak, x->x_fp);
! outlet_float(x->x_out_rms, x->x_fr);
! vu_update_rms(x, x->x_gui.x_glist);
! vu_update_peak(x, x->x_gui.x_glist);
}
--- 99,125 ----
if(ac > 1) vu_check_height(x, (int)atom_getintarg(1, ac, av));
if(glist_isvisible(x->x_gui.x_glist)) {
! iemgui_dodraw((t_iemgui *)x);
canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x);
}
}
! static int vuify(t_vu *x, float v) {
! return v<=-99.9 ? 0 :
! v>=12.0 ? IEM_VU_STEPS :
! iemgui_vu_db2i[(int)(2.0*(v+100.0))];
}
! static void vu_float0(t_vu *x, t_floatarg v) {
! x->x_rms = vuify(x,v); x->x_fr = 0.01*(int)(100.0*v+0.5);
! outlet_float(x->x_out_rms, x->x_fr); vu_update(x, x->x_gui.x_glist);}
! static void vu_float1(t_vu *x, t_floatarg v) {
! x->x_peak = vuify(x,v); x->x_fp = 0.01*(int)(100.0*v+0.5);
! outlet_float(x->x_out_peak, x->x_fp); vu_update(x, x->x_gui.x_glist);}
static void vu_bang(t_vu *x)
{
outlet_float(x->x_out_peak, x->x_fp);
! outlet_float(x->x_out_rms, x->x_fr);
! vu_update(x, x->x_gui.x_glist);
}
***************
*** 160,172 ****
{
t_iemgui *y = (t_iemgui *)x;
! int isa=0;
if(!pd_scanargs(argc,argv,"iiaaiiiiccb;i",
&y->x_w,&y->x_h,&y->x_rcv,&y->x_lab,&y->x_ldx,&y->x_ldy,&y->x_font_style,&y->x_fontsize,
&y->x_bcol,&y->x_lcol,&x->x_scale,&isa)) return;
! iem_inttosymargs(&x->x_gui,isa);
iemgui_constrain(y);
y->x_rcv_able = y->x_rcv!=sym_empty;
if(y->x_rcv_able) pd_bind((t_pd *)x, y->x_rcv);
! if (glist_isvisible(glist_getcanvas(y->x_glist))) x->x_gui.x_draw(x, y->x_glist, 0);
}
--- 127,139 ----
{
t_iemgui *y = (t_iemgui *)x;
! int isa;
if(!pd_scanargs(argc,argv,"iiaaiiiiccb;i",
&y->x_w,&y->x_h,&y->x_rcv,&y->x_lab,&y->x_ldx,&y->x_ldy,&y->x_font_style,&y->x_fontsize,
&y->x_bcol,&y->x_lcol,&x->x_scale,&isa)) return;
! iem_inttosymargs(y,isa);
iemgui_constrain(y);
y->x_rcv_able = y->x_rcv!=sym_empty;
if(y->x_rcv_able) pd_bind((t_pd *)x, y->x_rcv);
! if (glist_isvisible(glist_getcanvas(y->x_glist))) iemgui_dodraw((t_iemgui *)x);
}
***************
*** 178,182 ****
x->x_out_rms = outlet_new(&y->x_obj, &s_float);
x->x_out_peak = outlet_new(&y->x_obj, &s_float);
! y->x_h=IEM_VU_STEPS*IEM_VU_DEFAULTSIZE;
x->x_scale = 1;
x->x_peak = 0;
--- 145,149 ----
x->x_out_rms = outlet_new(&y->x_obj, &s_float);
x->x_out_peak = outlet_new(&y->x_obj, &s_float);
! y->x_h=IEM_VU_STEPS*3;
x->x_scale = 1;
x->x_peak = 0;
***************
*** 204,209 ****
iemgui_subclass(c);
class_addbang(c,vu_bang);
! class_addfloat(c,vu_float);
! class_addmethod(c, (t_method)vu_ft1, gensym("ft1"), A_FLOAT, 0);
class_addmethod(c, (t_method)vu_reload, gensym("reload"), A_GIMME, 0);
class_addmethod(c, (t_method)vu_size, gensym("size"), A_GIMME, 0);
--- 171,176 ----
iemgui_subclass(c);
class_addbang(c,vu_bang);
! class_addfloat(c,vu_float0);
! class_addmethod(c, (t_method)vu_float1, gensym("ft1"), A_FLOAT, 0);
class_addmethod(c, (t_method)vu_reload, gensym("reload"), A_GIMME, 0);
class_addmethod(c, (t_method)vu_size, gensym("size"), A_GIMME, 0);