[PD] multi source convolution help

J. Scott Hildebrand jshildebrand at ucdavis.edu
Wed Aug 13 23:09:26 CEST 2003


the way i want it to work is have the first inlet be azimuth, the second
inlet be elevation, and the third inlet be which signal inlet to use. at
creation time the user specifies how many inputs they want, and i think i
have that working now... finally. the first three inlets will be floats,
and the other ones will be signals based on how many the user wants to
use.

additionally, i'd like to store the pointers to each signal inlet in an
array somehow, so that i can access a specific one based on the select
input (i'm not sure how to do this). any help is appreciated! here's the
code i have so far that only makes a specified amount of signal inlets,
but i don't know how to get rid of the first DSP inlet and make that a
float.


static void
multi_source_convolution_tilde_dsp(t_multi_source_convolution_tilde *x,
t_signal **sp)
{
  //dsp_add(multi_source_convolution_tilde_perform, 6, x, sp[0]->s_vec,
sp[1]->s_vec, sp[2]->s_vec, sp[3]->s_vec, sp[0]->s_n);
}

static void
multi_source_convolution_first(t_multi_source_convolution_tilde *x,
t_floatarg f)
{
	x->firstfloat = f;
}


static void
multi_source_convolution_bound(t_multi_source_convolution_tilde *x,
t_floatarg f)
{
	x->secondfloat = f;
}

static void *multi_source_convolution_tilde_new(t_floatarg f)
{

int b;
//int a = (int)atom_getintarg(0, argc, argv);
//int i = (int)atom_getintarg(1, argc, argv);


t_multi_source_convolution_tilde *x = (t_multi_source_convolution_tilde
*)pd_new(multi_source_convolution_tilde_class);

  x->f_multi_source_convolution = f;

  x->i_count=f;

  //additional signal and float inlets

  //inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"),
gensym("first"));
  //inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"),
gensym("bound"));

  for(b = 0; b < x->i_count; b++)
  {
    inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
  }

//i = argv[2].a_w.w_float;

//i = argv[2].a_w->w_float;

/*
i = atom_getintarg(2, argc, argv);
if(argc == 2)
{
for(a = 0; a < i; a++)
{
	inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
}
}
*/

  //two signal outlets for stereo
  outlet_new(&x->x_obj, &s_signal);
  outlet_new(&x->x_obj, &s_signal);

  return (void *)x;
}

//setup declares new classes and their properties
void multi_source_convolution_tilde_setup(void) {
  multi_source_convolution_tilde_class =
class_new(gensym("multi_source_convolution~"),
        (t_newmethod)multi_source_convolution_tilde_new,
        0, sizeof(t_multi_source_convolution_tilde),
        CLASS_DEFAULT,
        A_DEFFLOAT, 0);

  class_addmethod(multi_source_convolution_tilde_class,
(t_method)multi_source_convolution_tilde_dsp, gensym("dsp"), 0);
  class_addmethod(multi_source_convolution_tilde_class,
(t_method)multi_source_convolution_first, gensym("first"), A_FLOAT, 0);
  class_addmethod(multi_source_convolution_tilde_class,
(t_method)multi_source_convolution_bound, gensym("bound"), A_FLOAT, 0);
  CLASS_MAINSIGNALIN(multi_source_convolution_tilde_class,
t_multi_source_convolution_tilde, f);
}





--------------------------------------------------------------------

	"640K ought to be enough for anybody." -- Bill Gates, 1981

--------------------------------------------------------------------





More information about the Pd-list mailing list