示例#1
0
// MSG "fm" symbol input, controls modulation amounts via list of 2 ints and a float (from, to, amt)
void	bounce_fm_set(t_bounce *x, t_symbol *msg, short argc, t_atom *argv)
{
	t_int in, out;
	t_double val = 0;
	if(argc == 3){
			in =  atom_getintarg(0,argc, argv);
			out = atom_getintarg(1,argc, argv);
			atom_arg_getdouble(&val, 2, argc, argv);
			in -= 1, out -=1;

			if(in <0 || in >= x->voice_count || out <0 || out >= x->voice_count){
				post("ERROR - invalid cross mod argument");
				in = 0, out = 0, val = 0;
			} else {
			x->fm[in][out] = val < MAXFM ? val: MAXFM;
			}
			
			if(val == 0.){
				// check if any other modulation is on, and set fm_on flag accordingly
				for(in = 0; in < x->voice_count; in++){
					for(out = 0; out < x->voice_count; out++){
						if(fabs(x->fm[in][out]) > 0.0001){
							x->fm_on = 1;
							goto quit_check_loop;
						}
					}
					x->fm_on = 0; // only reached if no modulation is on
				}
			}else{
				x->fm_on = 1;
			}
	}
quit_check_loop:
	;
}
示例#2
0
    /* new values from dialog window */
void glob_midi_dialog(t_pd *dummy, t_symbol *s, int argc, t_atom *argv)
{
    int nmidiindev, midiindev[MAXMIDIINDEV];
    int nmidioutdev, midioutdev[MAXMIDIOUTDEV];
    int i, nindev, noutdev;
    int newmidiindev[4], newmidioutdev[4];

    for (i = 0; i < 4; i++)
    {
    	newmidiindev[i] = atom_getintarg(i, argc, argv);
    	newmidioutdev[i] = atom_getintarg(i+4, argc, argv);
    }

    for (i = 0, nindev = 0; i < 4; i++)
    {
    	if (newmidiindev[i] > 0)
	{
	    newmidiindev[nindev] = newmidiindev[i]-1;
	    nindev++;
	}
    }
    for (i = 0, noutdev = 0; i < 4; i++)
    {
    	if (newmidioutdev[i] > 0)
	{
	    newmidioutdev[noutdev] = newmidioutdev[i]-1;
	    noutdev++;
	}
    }

    sys_close_midi();
    sys_open_midi(nindev, newmidiindev, noutdev, newmidioutdev);
}
示例#3
0
文件: bthresher~.c 项目: Angeldude/pd
void *bthresher_new(t_symbol *s, int argc, t_atom *argv)
{
#if MSP
  t_bthresher *x = (t_bthresher *)newobject(bthresher_class);
  x->list_outlet = listout((t_pxobject *)x);
  dsp_setup((t_pxobject *)x,3);
  outlet_new((t_pxobject *)x, "signal");
#endif

#if PD
    t_bthresher *x = (t_bthresher *)pd_new(bthresher_class);
    inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("signal"), gensym("signal"));
    inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("signal"), gensym("signal"));
    outlet_new(&x->x_obj, gensym("signal"));
    x->list_outlet = outlet_new(&x->x_obj,gensym("list"));
#endif


  x->D = sys_getblksize();
  x->R = sys_getsr();
  
  x->init_thresh = atom_getfloatarg(0,argc,argv);
  x->init_damping = atom_getfloatarg(1,argc,argv);
  x->overlap = atom_getintarg(2,argc,argv);
  x->winfac = atom_getintarg(3,argc,argv);
  
  bthresher_init(x,0);
  


  return (x);
}
示例#4
0
void iemgui_pos(t_iemgui *x, t_symbol *s, int ac, t_atom *av)
{
    x->x_obj.te_xpix = atom_getintarg(0, ac, av);
    x->x_obj.te_ypix = atom_getintarg(1, ac, av);
    if(glist_isvisible(x->x_glist))
        iemgui_shouldvis(x, IEM_GUI_DRAW_MODE_MOVE);
}
示例#5
0
文件: cavoc~.c 项目: Angeldude/pd
void *cavoc_new(t_symbol *msg, short argc, t_atom *argv)
{
#if MSP
  t_cavoc *x = (t_cavoc *)newobject(cavoc_class);
  dsp_setup((t_pxobject *)x,1);
  outlet_new((t_pxobject *)x, "signal");
 #endif

#if PD
	t_cavoc *x = (t_cavoc *)pd_new(cavoc_class);
  outlet_new(&x->x_obj, gensym("signal"));
#endif

  x->D = sys_getblksize();
  x->R = sys_getsr();

  x->density = atom_getfloatarg(0,argc,argv);
  x->hold_time = atom_getintarg(1,argc,argv);
  x->overlap = atom_getintarg(2,argc,argv);
  x->winfac = atom_getintarg(3,argc,argv);

  
	cavoc_init(x,0);
  return (x);
}
示例#6
0
static void *iem_i_route_new(t_symbol *s, int argc, t_atom *argv)
{
  int n, i;
  t_outlet **out;
  t_iem_i_route *x = (t_iem_i_route *)pd_new(iem_i_route_class);
  
  if((argc >= 2)&&IS_A_FLOAT(argv,0)&&IS_A_FLOAT(argv,1))
  {
    x->x_first_element = (int)atom_getintarg(0, argc, argv);
    x->x_last_element = (int)atom_getintarg(1, argc, argv);
    if((argc >= 3)&&IS_A_FLOAT(argv,2))
    {
      i = (int)atom_getintarg(2, argc, argv);
      x->x_first_element += i;
      x->x_last_element += i;
    }
    x->x_out = (t_outlet **)getbytes((x->x_last_element-x->x_first_element+2) * sizeof(t_outlet *));
    n = x->x_last_element - x->x_first_element + 2;
    for(i=0, out=x->x_out; i<n; i++, out++)
      *out = outlet_new(&x->x_obj, &s_list);
    return (x);
  }
  else
  {
    post("iem_i_route-ERROR: needs 3 floats!!");
    return(0);
  }
}
示例#7
0
void glob_initfromgui(void *dummy, t_symbol *s, int argc, t_atom *argv)
{
    char *cwd = atom_getsymbolarg(0, argc, argv)->s_name;
    t_namelist *nl;
    unsigned int i;
    int j;
    int nhostfont = (argc-2)/3;
    sys_oldtclversion = atom_getfloatarg(1, argc, argv);
    if (argc != 2 + 3 * nhostfont) bug("glob_initfromgui");
    for (i = 0; i < NFONT; i++)
    {
        int best = 0;
        int wantheight = sys_fontlist[i].fi_maxheight;
        int wantwidth = sys_fontlist[i].fi_maxwidth;
        for (j = 1; j < nhostfont; j++)
        {
            if (atom_getintarg(3 * j + 4, argc, argv) <= wantheight &&
                atom_getintarg(3 * j + 3, argc, argv) <= wantwidth)
                    best = j;
        }
            /* best is now the host font index for the desired font index i. */
        sys_fontlist[i].fi_hostfontsize =
            atom_getintarg(3 * best + 2, argc, argv);
        sys_fontlist[i].fi_width = atom_getintarg(3 * best + 3, argc, argv);
        sys_fontlist[i].fi_height = atom_getintarg(3 * best + 4, argc, argv);
    }
#if 0
    for (i = 0; i < 6; i++)
        fprintf(stderr, "font (%d %d %d) -> (%d %d %d)\n",
            sys_fontlist[i].fi_fontsize,
            sys_fontlist[i].fi_maxwidth,
            sys_fontlist[i].fi_maxheight,
            sys_fontlist[i].fi_hostfontsize,
            sys_fontlist[i].fi_width,
            sys_fontlist[i].fi_height);
#endif
        /* auto-load anything in that is in startupdir */
    if(!sys_nostartup)
        sys_loadstartup();
        /* load dynamic libraries specified with "-lib" args */
    for  (nl = sys_externlist; nl; nl = nl->nl_next)
        if (!sys_load_lib(0, nl->nl_string))
            post("%s: can't load library", nl->nl_string);
        /* open patches specifies with "-open" args */
    for  (nl = sys_openlist; nl; nl = nl->nl_next)
        openit(cwd, nl->nl_string);
    namelist_free(sys_openlist);
    sys_openlist = 0;
        /* send messages specified with "-send" args */
    for  (nl = sys_messagelist; nl; nl = nl->nl_next)
    {
        t_binbuf *b = binbuf_new();
        binbuf_text(b, nl->nl_string, strlen(nl->nl_string));
        binbuf_eval(b, 0, 0, 0);
        binbuf_free(b);
    }
    namelist_free(sys_messagelist);
    sys_messagelist = 0;
}
示例#8
0
static void tab_lt_list(t_tab_lt *x, t_symbol *s, int argc, t_atom *argv)
{
    int beg_src1, beg_src2, beg_dst;
    int i, n;
    int ok_src1, ok_src2, ok_dst;
    iemarray_t *vec_src1, *vec_src2, *vec_dst;

    if((argc >= 4) &&
            IS_A_FLOAT(argv,0) &&
            IS_A_FLOAT(argv,1) &&
            IS_A_FLOAT(argv,2) &&
            IS_A_FLOAT(argv,3))
    {
        beg_src1 = (int)atom_getintarg(0, argc, argv);
        beg_src2 = (int)atom_getintarg(1, argc, argv);
        beg_dst = (int)atom_getintarg(2, argc, argv);
        n = (int)atom_getintarg(3, argc, argv);
        if(beg_src1 < 0)
            beg_src1 = 0;
        if(beg_src2 < 0)
            beg_src2 = 0;
        if(beg_dst < 0)
            beg_dst = 0;
        if(n < 0)
            n = 0;

        ok_src1 = iem_tab_check_arrays(gensym("tab_lt"), x->x_sym_scr1, &x->x_beg_mem_src1, &x->x_size_src1, beg_src1+n);
        ok_src2 = iem_tab_check_arrays(gensym("tab_lt"), x->x_sym_scr2, &x->x_beg_mem_src2, &x->x_size_src2, beg_src2+n);
        ok_dst = iem_tab_check_arrays(gensym("tab_lt"), x->x_sym_dst, &x->x_beg_mem_dst, &x->x_size_dst, beg_dst+n);

        if(ok_src1 && ok_src2 && ok_dst)
        {
            vec_src1 = x->x_beg_mem_src1 + beg_src1;
            vec_src2 = x->x_beg_mem_src2 + beg_src2;
            vec_dst = x->x_beg_mem_dst + beg_dst;
            if(n)
            {
                t_garray *a;

                for(i=0; i<n; i++)
                {
                    if(iemarray_getfloat(vec_src1, i) < iemarray_getfloat(vec_src2, i))
                        iemarray_setfloat(vec_dst, i, 1.0f);
                    else
                        iemarray_setfloat(vec_dst, i, 0.0f);
                }
                outlet_bang(x->x_obj.ob_outlet);
                a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
                garray_redraw(a);
            }
        }
    }
    else
    {
        post("tab_lt-ERROR: list need 4 float arguments:");
        post("  source1_offset + source2_offset + destination_offset + number_of_samples_to_compare");
    }
}
示例#9
0
void iemgui_label_pos(t_iemgui *x, t_symbol *s, int ac, t_atom *av)
{
    x->x_ldx = atom_getintarg(0, ac, av);
    x->x_ldy = atom_getintarg(1, ac, av);
    if(glist_isvisible(x->x_glist))
    {
        sys_vgui(".x%lx.c coords %lxLABEL %d %d\n",
            glist_getcanvas(x->x_glist), x,
            text_xpix((t_object *)x,x->x_glist)+x->x_ldx,
            text_ypix((t_object *)x,x->x_glist)+x->x_ldy);
        iemgui_shouldvis(x, IEM_GUI_DRAW_MODE_CONFIG);
    }
}
示例#10
0
void iemgui_label_font(t_iemgui *x, t_symbol *s, int ac, t_atom *av)
{
    int f = atom_getintarg(0, ac, av);
    if (f<0 || f>2) f=0;
    x->x_font_style = f;
    x->x_fontsize = maxi(atom_getintarg(1, ac, av),4);
    if(glist_isvisible(x->x_glist))
    {
        sys_vgui(".x%lx.c itemconfigure %lxLABEL -font %s\n",
            glist_getcanvas(x->x_glist), x, iemgui_font(x));
        iemgui_shouldvis(x, IEM_GUI_DRAW_MODE_CONFIG);
    }
}
示例#11
0
    /* new values from dialog window */
void glob_path_dialog(t_pd *dummy, t_symbol *s, int argc, t_atom *argv)
{
    int i;
    namelist_free(sys_searchpath);
    sys_searchpath = 0;
    sys_usestdpath = atom_getintarg(0, argc, argv);
    sys_verbose = atom_getintarg(1, argc, argv);
    for (i = 0; i < argc-2; i++)
    {
        t_symbol *s = sys_decodedialog(atom_getsymbolarg(i+2, argc, argv));
        if (*s->s_name)
            sys_searchpath = namelist_append_files(sys_searchpath, s->s_name);
    }
}
示例#12
0
void chopper_set_loop(t_chopper *x, t_symbol *msg, short argc, t_atom *argv)
{
  if( argc < 3 ){
    error("format: start samples increment");
    return;
  }
  x->loop_start = atom_getintarg(0,argc,argv);
  x->loop_samps = atom_getintarg(1,argc,argv);
  x->increment = atom_getfloatarg(2,argc,argv);
  x->data_recalled = 1;

  x->samps_to_go = x->loop_samps;
  x->fbindex = x->bindex = x->loop_start;
//  post("loop set to: st %d samps %d incr %f", x->loop_start, x->loop_samps,x->increment);
}
示例#13
0
static void *hfadl_scale_new(t_symbol *s, int argc, t_atom *argv)
{
  t_hfadl_scale *x = (t_hfadl_scale *)pd_new(hfadl_scale_class);
  
  if((argc >= 1)&&IS_A_FLOAT(argv,0))
  {
    int j, i = (int)atom_getintarg(0, argc, argv);
    
    if(i >= 0)
    {
      j = iemgui_modulo_color(i);
      x->x_gui.x_lcol = my_iemgui_color_hex[j];
    }
    else
    {
      j = -1 - i;
      x->x_gui.x_lcol = ((j & 0x3f000) << 6)|((j & 0xfc0) << 4)|((j & 0x3f) << 2);
    }
  }
  else
    x->x_gui.x_lcol = 0;
  x->x_gui.x_draw = (t_iemfunptr)hfadl_scale_draw;
  x->x_gui.x_glist = (t_glist *)canvas_getcurrent();
  x->x_gui.x_w = 126;
  x->x_gui.x_h = 21;
  strcpy(x->x_gif, my_iemgui_black_hlscale_gif);
  my_iemgui_change_scale_col(x->x_gif, x->x_gui.x_lcol);
  x->x_gui.x_fsf.x_selected = 0;
  return(x);
}
示例#14
0
文件: list2send.c 项目: Angeldude/pd
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);
        }
      }
    }
  }
}
示例#15
0
文件: list2send.c 项目: Angeldude/pd
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));
          }
        }
      }
    }
  }
}
示例#16
0
文件: any2bytes.c 项目: Angeldude/pd
/*--------------------------------------------------------------------
 * new
 */
static void *any2bytes_new(MOO_UNUSED t_symbol *sel, int argc, t_atom *argv)
{
    t_any2bytes *x = (t_any2bytes *)pd_new(any2bytes_class);
    int bufsize = ANY2BYTES_DEFAULT_BUFLEN;

    //-- defaults
    x->x_eos      = 0;

    //-- args: 0: bufsize
    if (argc > 0) {
      int initial_bufsize = atom_getintarg(0, argc, argv);
      if (initial_bufsize > 0) { bufsize = initial_bufsize; }
    }
    //-- args: 1: eos
    if (argc > 1) {
      x->x_eos = atom_getfloatarg(1, argc, argv);
    }

    //-- allocate
    pdstring_bytes_init(&x->x_bytes, 0); //-- x_bytes gets clobbered by binbuf_gettext()
    pdstring_atoms_init(&x->x_atoms, bufsize);
    x->x_binbuf = binbuf_new();

    //-- inlets
    x->x_eos_in = floatinlet_new(&x->x_obj, &x->x_eos);

    //-- outlets
    x->x_outlet = outlet_new(&x->x_obj, &s_list);

    //-- report
    A2SDEBUG(post("any2bytes_new(): x=%p, eos=%d, binbuf=%p", x, x->x_eos, x->x_binbuf));

    return (void *)x;
}
示例#17
0
文件: trento.c 项目: amurtet/pd-dis
void trento_resize(t_trento *x, t_symbol *msg, int argc, t_atom *argv)
{
  t_word *samples;
  int new_frames;
  int i;
  int old_frames;
  if(argc!=1) {
    pd_error(x,"resize take 1 argument, not %d",argc);
    return;
  }
  new_frames = atom_getintarg(0,argc,argv);
  if(new_frames<0) {
    pd_error(x,"resize must be larger than 0");
    return;
  }
  if(!attach_array(x))
    return;
  old_frames = x->b_frames;
  if(new_frames<old_frames)
    pd_error(x,"Warning: some output may be delete");
  garray_resize(x->buffy, new_frames);
  if(!attach_array(x))
    return;
  samples = x->b_samples;
  for(i=old_frames;i<new_frames;i++)
    samples[i].w_float = 0.f;
  garray_redraw(x->buffy);
  return;
}
示例#18
0
static void dac_set(t_dac *x, t_symbol *s, int argc, t_atom *argv)
{
    int i;
    for (i = 0; i < argc && i < x->x_n; i++)
        x->x_vec[i] = atom_getintarg(i, argc, argv);
    canvas_update_dsp();
}
示例#19
0
文件: bthresher~.c 项目: Angeldude/pd
void bthresher_list (t_bthresher *x, t_symbol *msg, short argc, t_atom *argv) {
  int i, bin, idiv;
  float fdiv;
  float *damping_factor = x->damping_factor;
  float *move_threshold = x->move_threshold;

  //	post("reading %d elements", argc);
  idiv = fdiv = (float) argc / 3.0 ;
  if( fdiv - idiv > 0.0 ) {
    post("list must be in triplets");
    return;
  }
/*  for( i = 0; i < x->N2+1; i++) {
    move_threshold[i] = 0.0 ;
  }*/

  for( i = 0; i < argc; i += 3 ) {
    bin = atom_getintarg(i,argc,argv);
    damping_factor[bin] = atom_getfloatarg(i+1,argc,argv);
    move_threshold[bin] = atom_getfloatarg(i+2,argc,argv);
/*    bin = argv[i].a_w.w_long ;
    damping_factor[bin] = argv[i + 1].a_w.w_float;
    move_threshold[bin] = argv[i + 2].a_w.w_float;*/
  }
}
示例#20
0
void iemgui_color(t_iemgui *x, t_symbol *s, int ac, t_atom *av)
{
    x->x_bcol = iemgui_compatible_col(atom_getintarg(0, ac, av));
    if(ac > 2)
    {
        x->x_fcol = iemgui_compatible_col(atom_getintarg(1, ac, av));
        x->x_lcol = iemgui_compatible_col(atom_getintarg(2, ac, av));
    }
    else
        x->x_lcol = iemgui_compatible_col(atom_getintarg(1, ac, av));
    if(glist_isvisible(x->x_glist))
    {
        x->x_draw(x, x->x_glist, IEM_GUI_DRAW_MODE_CONFIG);
        iemgui_label_draw_config(x);
    }
}
示例#21
0
文件: d_dac.c 项目: 4nykey/rockbox
static void *adc_new(t_symbol *s, int argc, t_atom *argv)
{
    t_adc *x = (t_adc *)pd_new(adc_class);
#ifdef ROCKBOX
    t_atom defarg[2];
#else
    t_atom defarg[2], *ap;
#endif
    int i;

#ifdef ROCKBOX
    (void) s;
#endif

    if (!argc)
    {
    	argv = defarg;
    	argc = 2;
    	SETFLOAT(&defarg[0], 1);
    	SETFLOAT(&defarg[1], 2);
    }
    x->x_n = argc;
    x->x_vec = (t_int *)getbytes(argc * sizeof(*x->x_vec));
    for (i = 0; i < argc; i++)
    	x->x_vec[i] = atom_getintarg(i, argc, argv);
    for (i = 0; i < argc; i++)
    	outlet_new(&x->x_obj, &s_signal);
    return (x);
}
示例#22
0
/*--------------------------------------------------------------------
 * new
 */
static void *bytes2any_new(MOO_UNUSED t_symbol *sel, int argc, t_atom *argv)
{
    t_bytes2any *x = (t_bytes2any *)pd_new(bytes2any_class);
    int bufsize    = BYTES2ANY_DEFAULT_BUFLEN;

    //-- defaults
    x->x_binbuf = binbuf_new();
    x->x_eos    = -1;

    //-- args: 0: bufsize
    if (argc > 0) {
      int initial_bufsize = atom_getintarg(0,argc,argv);
      if (initial_bufsize > 0) bufsize = initial_bufsize;
      x->x_eos = -1;   //-- backwards-compatibility hack: no default eos character if only bufsize is specified
    } 
    //-- args: 1: separator
    if (argc > 1) {
      x->x_eos = atom_getfloatarg(1,argc,argv);
    }

    //-- allocate x_bytes
    pdstring_bytes_init(&x->x_bytes, bufsize);

    //-- inlets
    x->x_eos_in = floatinlet_new(&x->x_obj, &x->x_eos);

    //-- outlets
    x->x_outlet      = outlet_new(&x->x_obj, &s_list);
    x->x_outlet_done = outlet_new(&x->x_obj, &s_bang);

    //-- debug
    S2ADEBUG(post("bytes2any_new: x=%p, binbuf=%p, bytes.alloc=%d", x, x->x_eos, x->x_binbuf, x->x_bytes.b_alloc));

    return (void *)x;
}
示例#23
0
文件: NLMS~.c 项目: ma4u/pd-macambira
static void *NLMS_tilde_new(t_symbol *s, t_int argc, t_atom *argv)
{
    t_NLMS_tilde *x = (t_NLMS_tilde *)pd_new(NLMS_tilde_class);
    t_int i, n_order=39;
    t_symbol    *w_name;
    t_float beta=0.1f;
    t_float gammax=0.00001f;

    if((argc >= 4) &&
            IS_A_FLOAT(argv,0) &&   //IS_A_FLOAT/SYMBOL from iemlib.h
            IS_A_FLOAT(argv,1) &&
            IS_A_FLOAT(argv,2) &&
            IS_A_SYMBOL(argv,3))
    {
        n_order = (t_int)atom_getintarg(0, argc, argv);
        beta    = (t_float)atom_getfloatarg(1, argc, argv);
        gammax  = (t_float)atom_getfloatarg(2, argc, argv);
        w_name  = (t_symbol *)atom_getsymbolarg(3, argc, argv);

        if(beta < 0.0f)
            beta = 0.0f;
        if(beta > 2.0f)
            beta = 2.0f;

        if(gammax < 0.0f)
            gammax = 0.0f;
        if(gammax > 1.0f)
            gammax = 1.0f;

        if(n_order < 2)
            n_order = 2;
        if(n_order > 11111)
            n_order = 11111;

        inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
        outlet_new(&x->x_obj, &s_signal);
        outlet_new(&x->x_obj, &s_signal);

        x->x_msi = 0;
        x->x_n_order = n_order;
        x->x_update = 0;
        x->x_beta = beta;
        x->x_gamma = gammax;
        // 2 times in and one time desired_in memory allocation (history)
        x->x_in_hist = (t_float *)getbytes(2*x->x_n_order*sizeof(t_float));

        // table-symbols will be linked to their memory in future (dsp_routine)
        x->x_w_array_sym_name = gensym(w_name->s_name);
        x->x_w_array_mem_beg = (t_float *)0;

        return(x);
    }
    else
    {
        post("NLMS~-ERROR: need 3 float- + 1 symbol-arguments:");
        post("  order_of_filter + learnrate_beta + security_value + array_name_taps");
        return(0);
    }
}
示例#24
0
文件: iem_image.c 项目: Tzero2/pd
static void *iem_image_new(t_symbol *s, int argc, t_atom *argv)
{
    t_iem_image *x = (t_iem_image *)pd_new(iem_image_class);
    t_symbol *gifsym=(t_symbol *)0;
    x->x_gui.x_snd = gensym("empty");
    x->x_gui.x_rcv = gensym("empty");
    x->x_gui.x_lab = gensym("empty");
    x->x_gui.x_fsf.x_font_style = 0;
    if(argc >= 1)
    {
        if(IS_A_SYMBOL(argv,0))
            gifsym = atom_getsymbolarg(0, argc, argv);
        else if(IS_A_FLOAT(argv,0))
            gifsym = (t_symbol *)0;
    }
    else if(argc >= 5)
    {
        if(IS_A_SYMBOL(argv,0))
            gifsym = atom_getsymbolarg(0, argc, argv);
        else if(IS_A_FLOAT(argv,0))
            gifsym = (t_symbol *)0;
        iem_inttosymargs(&x->x_gui.x_isa, atom_getintarg(1, argc, argv));
        iem_inttofstyle(&x->x_gui.x_fsf, atom_getintarg(2, argc, argv));
        iemgui_new_getnames(&x->x_gui, 3, argv);
    }

    x->x_gui.x_draw = (t_iemfunptr)iem_image_draw;
    x->x_gui.x_fsf.x_snd_able = 1;
    x->x_gui.x_fsf.x_rcv_able = 1;
    x->x_gui.x_glist = (t_glist *)canvas_getcurrent();
    if(!strcmp(x->x_gui.x_snd->s_name, "empty"))
        x->x_gui.x_fsf.x_snd_able = 0;
    if(!strcmp(x->x_gui.x_rcv->s_name, "empty"))
        x->x_gui.x_fsf.x_rcv_able = 0;
    if(x->x_gui.x_fsf.x_rcv_able)
        pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
    x->x_gui.x_w = 100;
    x->x_gui.x_h = 60;
    x->x_gifsym = gifsym;
    x->x_have_image=0;
    x->x_gui.x_fsf.x_selected = 0;
    iemgui_verify_snd_ne_rcv(&x->x_gui);
    outlet_new(&x->x_gui.x_obj, &s_list);
    return(x);
}
示例#25
0
/*-------------------------------------------------------------
 * values()
 */
static void holmes_mask_values(t_holmes_mask *x, t_symbol *sel, int argc, t_atom *argv)
{
  int i;
  for (i=0; i < argc; i += 2) {
    holmes_mask_set_byname(x,
			   atom_getsymbolarg(i, argc, argv),
			   atom_getintarg(i+1, argc, argv));
  }
}
示例#26
0
static void hdspm_mixer_get_matrix_element(t_hdspm_mixer *x, t_symbol *s, int argc, t_atom *argv)
{
  int col;
  int help_col, src_index, n=x->x_n_src;
  
  if((argc >= 2)&&IS_A_FLOAT(argv,0)&&IS_A_FLOAT(argv,1))
  {
    src_index = (int)atom_getintarg(0, argc, argv) - 1;
  }
}
示例#27
0
文件: db.drag~.c 项目: EQ4/db.drag
// MSG "dc" symbol input, turns on/off clipping to -1...1
void	drag_dcblock_set(t_drag *x, t_symbol *msg, short argc, t_atom *argv)
{
    int i;

    if(argc >= 1) {
        for(i =0; i < argc && i < x->voice_count; i++) {
            x->dcblock_on[i] = (t_bool) atom_getintarg(i,argc,argv);
        }
    }
}
示例#28
0
文件: iem_vu.c 项目: Angeldude/pd
static void iem_vu_size(t_iem_vu *x, t_symbol *s, int ac, t_atom *av)
{
  x->x_gui.x_w = iem_vu_clip_width((int)atom_getintarg(0, ac, av)+1);
  x->x_gui.x_h = 120;
  if(glist_isvisible(x->x_gui.x_glist))
  {
    (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE);
    (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_CONFIG);
    canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x);
  }
}
示例#29
0
t_symbol *iemgui_new_dogetname(t_iemgui *iemgui, int indx, t_atom *argv)
{
    if (IS_A_SYMBOL(argv, indx))
        return (atom_getsymbolarg(indx, 100000, argv));
    else if (IS_A_FLOAT(argv, indx))
    {
        char str[80];
        sprintf(str, "%d", (int)atom_getintarg(indx, 100000, argv));
        return (gensym(str));
    }
    else return (gensym("empty"));
}
示例#30
0
文件: pique.c 项目: Gaz5700/pd-double
static void pique_list(t_pique *x, t_symbol *s, int argc, t_atom *argv)
{
    int npts = atom_getintarg(0, argc, argv);
    t_symbol *symreal = atom_getsymbolarg(1, argc, argv);
    t_symbol *symimag = atom_getsymbolarg(2, argc, argv);
    int npeak = atom_getintarg(3, argc, argv);
    int n;
    t_garray *a;
    t_word *fpreal, *fpimag;
    if (npts < 8 || npeak < 1) error("pique: bad npoints or npeak");
    if (npeak > x->x_n) npeak = x->x_n;
    if (!(a = (t_garray *)pd_findbyclass(symreal, garray_class)) ||
        !garray_getfloatwords(a, &n, &fpreal) ||
            n < npts)
                error("%s: missing or bad array", symreal->s_name);
    else if (!(a = (t_garray *)pd_findbyclass(symimag, garray_class)) ||
        !garray_getfloatwords(a, &n, &fpimag) ||
            n < npts)
                error("%s: missing or bad array", symimag->s_name);
    else
    {
        int nfound, i;
        t_float *fpfreq = x->x_freq;
        t_float *fpamp = x->x_amp;
        t_float *fpampre = x->x_ampre;
        t_float *fpampim = x->x_ampim;
        pique_doit(npts, fpreal, fpimag, npeak,
            &nfound, fpfreq, fpamp, fpampre, fpampim, x->x_errthresh);
        for (i = 0; i < nfound; i++, fpamp++, fpfreq++, fpampre++, fpampim++)
        {
            t_atom at[5];
            SETFLOAT(at, (t_float)i);
            SETFLOAT(at+1, *fpfreq);
            SETFLOAT(at+2, *fpamp);
            SETFLOAT(at+3, *fpampre);
            SETFLOAT(at+4, *fpampim);
            outlet_list(x->x_obj.ob_outlet, &s_list, 5, at);   
        }
    }
}