static void dkgoertzel_list(t_dkgoertzel_tilde *x, t_symbol *s, int argc, t_atom * argv){ int argnum = 0; //current argument while(argc){ if(argv -> a_type == A_FLOAT){ t_float curf = atom_getfloatarg(0, argc, argv); switch(argnum){ case 0: //initdel if(curf < DKGOERTZEL_MINMS){ curf = DKGOERTZEL_MINMS; } else if(curf > x->x_maxdel){ curf = x->x_maxdel; }; pd_float((t_pd *)x->x_dellet, curf); break; case 1: //gain pd_float((t_pd *)x->x_gainlet, curf); break; default: break; }; argnum++; }; argc--; argv++; }; }
static void buffir_setrange(t_buffir *x, t_floatarg f1, t_floatarg f2) { int off = (int)f1; int siz = (int)f2; if (off < 0) off = 0; if (siz <= 0) siz = BUFFIR_DEFSIZE; if (siz > BUFFIR_MAXSIZE) siz = BUFFIR_MAXSIZE; pd_float((t_pd *)x->x_offlet, off); pd_float((t_pd *)x->x_sizlet, siz); }
static void *lowshelf_new(t_symbol *s, int argc, t_atom *argv) { t_lowshelf *x = (t_lowshelf *)pd_new(lowshelf_class); float freq = 0; float slope = 0; int db = 0; ///////////////////////////////////////////////////////////////////////////////////// int argnum = 0; while(argc > 0) { if(argv -> a_type == A_FLOAT) { //if current argument is a float t_float argval = atom_getfloatarg(0, argc, argv); switch(argnum) { case 0: freq = argval; break; case 1: slope = argval; break; case 2: db = argval; break; default: break; }; argnum++; argc--; argv++; } else if (argv -> a_type == A_SYMBOL) { goto errstate; } }; ///////////////////////////////////////////////////////////////////////////////////// x->x_inlet_freq = inlet_new((t_object *)x, (t_pd *)x, &s_signal, &s_signal); pd_float((t_pd *)x->x_inlet_freq, freq); x->x_inlet_q = inlet_new((t_object *)x, (t_pd *)x, &s_signal, &s_signal); pd_float((t_pd *)x->x_inlet_q, slope); x->x_inlet_amp = inlet_new((t_object *)x, (t_pd *)x, &s_signal, &s_signal); pd_float((t_pd *)x->x_inlet_amp, db); x->x_out = outlet_new((t_object *)x, &s_signal); return (x); errstate: pd_error(x, "lowshelf~: improper args"); return NULL; }
void radio_output(t_radio *x) { int i; t_atom av[256]; if(x->f_mode) { for(i = 0; i < x->f_nitems; i++) atom_setfloat(av+i, (float)x->f_items[i]); outlet_list(x->f_out, &s_list, x->f_nitems, av); if(ebox_getsender((t_ebox *) x)) pd_list(ebox_getsender((t_ebox *) x), &s_list, x->f_nitems, av); } else { for(i = 0; i < x->f_nitems; i++) { if(x->f_items[i] != 0) { outlet_float(x->f_out, (float)i); if(ebox_getsender((t_ebox *) x)) pd_float(ebox_getsender((t_ebox *) x), (float)i); } } } }
static void list2send_list(t_list2send *x, t_symbol *s, int ac, t_atom *av) { if((ac >= 2) && (IS_A_FLOAT(av,0))) { int identifier_index = (int)atom_getintarg(0, ac, av); if(identifier_index < x->x_max) { if(x->x_snd_able[identifier_index]) { t_symbol *sender = x->x_send_entries[identifier_index]; if(sender->s_thing) { if(ac == 2) { if(IS_A_FLOAT(av, 1)) pd_float(sender->s_thing, atom_getfloatarg(1, ac, av)); else if(IS_A_SYMBOL(av, 1)) pd_symbol(sender->s_thing, atom_getsymbolarg(1, ac, av)); } else pd_list(sender->s_thing, &s_list, ac-1, av+1); } } } } }
static void new_inlet_float(t_inlet *x, t_float f) { if (x->i_symfrom == &s_float) pd_vmess(x->i_dest, x->i_un.iu_symto, "f", (t_floatarg)f); else if (*x->i_dest == eproxy_class) { t_atom a; t_eproxy* proxy = (t_eproxy *)x->i_dest; t_eobj *z = (t_eobj *)proxy->p_owner; z->o_current_proxy = proxy->p_index; SETFLOAT(&a, f); pd_typedmess((t_pd *)x->i_dest, &s_float, 1, &a); z->o_current_proxy = 0; } else if (x->i_symfrom == &s_signal) x->i_un.iu_floatsignalvalue = f; else if (!x->i_symfrom) pd_float(x->i_dest, f); else if (x->i_symfrom == &s_list) { t_atom a; SETFLOAT(&a, f); new_inlet_list(x, &s_float, 1, &a); } else inlet_wrong(x, &s_float); }
static void list2send_from(t_list2send *x, t_symbol *s, int ac, t_atom *av) { int n=x->x_max; if(ac >= 1) { int i, j, beg=(int)atom_getintarg(0, ac, av); if((beg + ac - 1) <= n) { for(i=ac-1,j=beg+ac-2; i>=1; i--,j--)/*change*/ { if(x->x_snd_able[j]) { t_symbol *sender = x->x_send_entries[j]; if(sender->s_thing) { if(IS_A_FLOAT(av, i)) pd_float(sender->s_thing, atom_getfloatarg(i, ac, av)); else if(IS_A_SYMBOL(av, i)) pd_symbol(sender->s_thing, atom_getsymbolarg(i, ac, av)); } } } } } }
/* objects interpret lists by feeding them to the individual inlets. Before you call this check that the object doesn't have a more specific way to handle lists. */ void obj_list(t_object *x, t_symbol *s, int argc, t_atom *argv) { t_atom *ap; int count; t_inlet *ip = ((t_object *)x)->ob_inlet; if (!argc) return; for (count = argc-1, ap = argv+1; ip && count--; ap++, ip = ip->i_next) { if (ap->a_type == A_POINTER) pd_pointer(&ip->i_pd, ap->a_w.w_gpointer); else if (ap->a_type == A_FLOAT) pd_float(&ip->i_pd, ap->a_w.w_float); else pd_symbol(&ip->i_pd, ap->a_w.w_symbol); } if (argv->a_type == A_POINTER) pd_pointer(&x->ob_pd, argv->a_w.w_gpointer); else if (argv->a_type == A_FLOAT) pd_float(&x->ob_pd, argv->a_w.w_float); else pd_symbol(&x->ob_pd, argv->a_w.w_symbol); }
static void *modulo_new(t_floatarg f) { t_modulo *x = (t_modulo *)pd_new(modulo_class); x->x_inlet = inlet_new((t_object *)x, (t_pd *)x, &s_signal, &s_signal); pd_float((t_pd *)x->x_inlet, f); outlet_new((t_object *)x, &s_signal); return (x); }
static void *rdiv_tilde_new(t_floatarg f) { t_rdiv_tilde *x = (t_rdiv_tilde *)pd_new(rdiv_tilde_class); x->x_inlet = inlet_new((t_object *)x, (t_pd *)x, &s_signal, &s_signal); pd_float((t_pd *)x->x_inlet, f); outlet_new((t_object *)x, &s_signal); return (x); }
static void *greaterthaneq_new(t_floatarg f) { t_greaterthaneq *x = (t_greaterthaneq *)pd_new(greaterthaneq_class); x->x_inlet = inlet_new((t_object *)x, (t_pd *)x, &s_signal, &s_signal); pd_float((t_pd *)x->x_inlet, f); outlet_new((t_object *)x, &s_signal); return (x); }
static void *lessthan_new(t_floatarg f) { t_lessthan *x = (t_lessthan *)pd_new(lessthan_class); x->x_inlet = inlet_new((t_object *)x, (t_pd *)x, &s_signal, &s_signal); pd_float((t_pd *)x->x_inlet, f); outlet_new((t_object *)x, &s_signal); return (x); }
// --------------------------------------------------- // Functions signature // --------------------------------------------------- static void *rminus_new(t_floatarg f) { t_rminus *x = (t_rminus *)pd_new(rminus_class); x->x_inlet = inlet_new((t_object *)x, (t_pd *)x, &s_signal, &s_signal); pd_float((t_pd *)x->x_inlet, f); outlet_new((t_object *)x, &s_signal); return (x); }
void toggle_output(t_toggle *x) { ebox_invalidate_layer((t_ebox *)x, gensym("background_layer")); ebox_redraw((t_ebox *)x); outlet_float((t_outlet*)x->f_out, (float)x->f_active); if(ebox_getsender((t_ebox *) x)) pd_float(ebox_getsender((t_ebox *) x), (float)x->f_active); }
void Instance::send(BindingName const& name, float val) const noexcept { t_symbol* sy = reinterpret_cast<t_symbol*>(name.ptr); if(sy && sy->s_thing) { pd_float((t_pd *)sy->s_thing, val); } }
void outlet_float(t_outlet *x, t_float f) { t_outconnect *oc; char c; if (&c < stacklimit) outlet_stackerror(x); else for (oc = x->o_connections; oc; oc = oc->oc_next) pd_float(oc->oc_to, f); }
static void *overdrive_new(t_floatarg f) { t_overdrive *x = (t_overdrive *)pd_new(overdrive_class); x->x_drivefactor = f; x->x_inlet = inlet_new((t_object *)x, (t_pd *)x, &s_signal, &s_signal); pd_float((t_pd *)x->x_inlet, x->x_drivefactor); outlet_new((t_object *)x, &s_signal); return (x); }
static void *reson_new(t_floatarg f1, t_floatarg f2, t_floatarg f3) { t_reson *x = (t_reson *)pd_new(reson_class); x->x_srcoef = TWO_PI / sys_getsr(); if (f1 < 0.) f1 = 0.; if (f2 < 0.) f2 = 0.; if (f3 <= 0.) f3 = RESON_DEFQ; /* CHECKED */ x->x_gain_inlet = inlet_new((t_object *)x, (t_pd *)x, &s_signal, &s_signal); pd_float((t_pd *)x->x_gain_inlet, f1); x->x_freq_inlet = inlet_new((t_object *)x, (t_pd *)x, &s_signal, &s_signal); pd_float((t_pd *)x->x_freq_inlet, f2); x->x_q_inlet = inlet_new((t_object *)x, (t_pd *)x, &s_signal, &s_signal); pd_float((t_pd *)x->x_q_inlet, f3); outlet_new((t_object *)x, &s_signal); reson_clear(x); return (x); }
static void incdec_output(t_incdec *x) { t_pd* send = ebox_getsender((t_ebox *) x); outlet_float(x->f_out, (float)x->f_value); if(send) { pd_float(send, (float)x->f_value); } }
static void dist_float(t_dist *x, t_float f) { int i; for(i = 0; i <= x->x_rec; i++) { if (x->x_sym[i]->s_thing) pd_float(x->x_sym[i]->s_thing, f); } }
static void knob_output(t_knob *x) { t_pd* send = ebox_getsender((t_ebox *) x); const float val = ebox_parameter_getvalue((t_ebox *)x, 1); outlet_float(x->f_outlet, val); if(send) { pd_float(send, val); } }
static void bindlist_float(t_bindlist *x, t_float f) { t_bindelem *e; change_bindlist_via_graph = 1; for (e = x->b_list; e; e = e->e_next) if (e->e_who != NULL) pd_float(e->e_who, f); if (change_bindlist_via_graph > 1) bindlist_cleanup(x); change_bindlist_via_graph = 0; }
static void grab_float(t_grab *x, t_float f) { t_pd *grabbed; grab_start(x); while (grabbed = grab_next(x)) { pd_float(grabbed, f); grab_restore(x); } }
static void *downsamp_new(t_floatarg f) { t_downsamp *x = (t_downsamp *)pd_new(downsamp_class); x->x_inlet = inlet_new((t_object *)x, (t_pd *)x, &s_signal, &s_signal); pd_float((t_pd *)x->x_inlet, (f > 1. ? f : 1.)); outlet_new((t_object *)x, &s_signal); x->x_lastout = 0; x->x_phase = 0; return (x); }
static void inlet_float(t_inlet *x, t_float f) { if (x->i_symfrom == &s_float) pd_vmess(x->i_dest, x->i_symto, "f", (t_floatarg)f); else if (x->i_symfrom == &s_signal) x->i_un.iu_floatsignalvalue = ftofix(f); else if (!x->i_symfrom) pd_float(x->i_dest, f); else inlet_wrong(x, &s_float); }
void outlet_float(t_outlet *x, t_float f) { t_outconnect *oc; if(++stackcount >= STACKITER) outlet_stackerror(x); else for (oc = x->o_connections; oc; oc = oc->oc_next) pd_float(oc->oc_to, f); --stackcount; }
static void tab_output(t_tab *x) { t_pd* send = ebox_getsender((t_ebox *) x); const float index = ebox_parameter_getvalue((t_ebox *)x, 1); outlet_float(x->f_out_index, index); outlet_symbol(x->f_out_item, x->f_items[(int)index]); if(send) { pd_float(send, index); } }
int libpd_float(const char *recv, float x) { void *obj; sys_lock(); obj = get_object(recv); if (obj == NULL) { sys_unlock(); return -1; } pd_float(obj, x); sys_unlock(); return 0; }
static void allpass_list(t_allpass *x, t_symbol *s, int argc, t_atom * argv){ int argnum = 0; //current argument while(argc){ if(argv -> a_type == A_FLOAT){ t_float curf = atom_getfloatarg(0, argc, argv); switch(argnum){ case 0: //maxdel x->x_maxdel = curf > 0 ? curf : ALLPASS_DELAY; allpass_sz(x); break; case 1: //initdel if(curf < ALLPASS_MINMS){ curf = ALLPASS_MINMS; } else if(curf > x->x_maxdel){ curf = x->x_maxdel; }; pd_float((t_pd *)x->x_dellet, curf); break; case 2: //gain pd_float((t_pd *)x->x_alet, curf); break; default: break; }; argnum++; }; argc--; argv++; }; }
static void *hilbert_new(t_floatarg f) { t_hilbert *x = (t_hilbert *)pd_new(hilbert_class); x->x_inlet_freq = inlet_new((t_object *)x, (t_pd *)x, &s_signal, &s_signal); pd_float((t_pd *)x->x_inlet_freq, f); x->x_out1 = outlet_new((t_object *)x, &s_signal); x->x_out2 = outlet_new((t_object *)x, &s_signal); x->x_r1x1 = x->x_r1x2 = x->x_r1y1 = x->x_r1y2 = 0.; x->x_r2x1 = x->x_r2x2 = x->x_r2y1 = x->x_r2y2 = 0.; x->x_i1x1 = x->x_i1x2 = x->x_i1y1 = x->x_i1y2 = 0.; x->x_i2x1 = x->x_i2x2 = x->x_i2y1 = x->x_i2y2 = 0.; return (x); }