Update of /cvsroot/pure-data/externals/iem/iemgui/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8481
Modified Files: iem_vu.c Log Message: new set method
Index: iem_vu.c =================================================================== RCS file: /cvsroot/pure-data/externals/iem/iemgui/src/iem_vu.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** iem_vu.c 31 Oct 2007 11:37:45 -0000 1.4 --- iem_vu.c 9 Nov 2007 14:59:59 -0000 1.5 *************** *** 608,611 **** --- 608,656 ---- }
+ static void iem_vu_set(t_iem_vu *x, t_symbol *s, int ac, t_atom *av) + { + t_float rms=-100.0f, peak=-100.0f; + int i; + + if( (ac >= 2) && IS_A_FLOAT(av,0) && IS_A_FLOAT(av,1) ) + { + rms = (t_float)atom_getfloatarg(0, ac, av); + peak = (t_float)atom_getfloatarg(1, ac, av); + } + else if( (ac == 1) && IS_A_FLOAT(av,0) ) + { + rms = (t_float)atom_getfloatarg(0, ac, av); + peak = rms; + } + if(rms <= IEM_VU_MINDB) + x->x_rms = 0; + else if(rms >= IEM_VU_MAXDB) + x->x_rms = IEM_VU_STEPS; + else + { + int i = (int)(2.0*(rms + IEM_VU_OFFSET)); + x->x_rms = iem_vu_db2i[i]; + } + i = (int)(100.0*rms + 10000.5); + rms = 0.01*(t_float)(i - 10000); + x->x_fr = rms; + + if(peak <= IEM_VU_MINDB) + x->x_peak = 0; + else if(peak >= IEM_VU_MAXDB) + x->x_peak = IEM_VU_STEPS; + else + { + int i = (int)(2.0*(peak + IEM_VU_OFFSET)); + x->x_peak = iem_vu_db2i[i]; + } + i = (int)(100.0*peak + 10000.5); + peak = 0.01*(t_float)(i - 10000); + x->x_fp = peak; + + iem_vu_update_rms(x, x->x_gui.x_glist); + iem_vu_update_peak(x, x->x_gui.x_glist); + } + static void iem_vu_bang(t_iem_vu *x) { *************** *** 814,819 **** class_addfloat(iem_vu_class, iem_vu_float); class_addmethod(iem_vu_class, (t_method)iem_vu_ft1, gensym("ft1"), A_FLOAT, 0); ! class_addmethod(iem_vu_class, (t_method)iem_vu_dialog, gensym("dialog"), ! A_GIMME, 0); class_addmethod(iem_vu_class, (t_method)iem_vu_size, gensym("size"), A_GIMME, 0); class_addmethod(iem_vu_class, (t_method)iem_vu_scale, gensym("scale"), A_DEFFLOAT, 0); --- 859,864 ---- class_addfloat(iem_vu_class, iem_vu_float); class_addmethod(iem_vu_class, (t_method)iem_vu_ft1, gensym("ft1"), A_FLOAT, 0); ! class_addmethod(iem_vu_class, (t_method)iem_vu_set, gensym("set"), A_GIMME, 0); ! class_addmethod(iem_vu_class, (t_method)iem_vu_dialog, gensym("dialog"), A_GIMME, 0); class_addmethod(iem_vu_class, (t_method)iem_vu_size, gensym("size"), A_GIMME, 0); class_addmethod(iem_vu_class, (t_method)iem_vu_scale, gensym("scale"), A_DEFFLOAT, 0);