[PD-dev] Sending list of floats out an outlet

Ben Bogart - FMPM/F1999 bbogart at acs.ryerson.ca
Tue Jul 16 16:50:40 CEST 2002


Ok I think I got it now, but I could use a little clarification. Here is 
my code:

        t_atom f_out[9];
        t_atom* myf = f_out;
        SETFLOAT(myf,f);
        SETFLOAT(myf+1,f+10);
        outlet_list(x->myobj.ob_outlet,&s_list,2,myf);

where f is a floatarg to the method. Why is it that Guenter is using 
(t_atom*)&a_out rather than a_out as the *argv pointer? I copied the same 
array and pointer declarations from his code. 

Thanks for all the help!
Ben


On Tue, 16 Jul 2002, Ben Bogart - FMPM/F1999 wrote:

> Thanks Krzysztof,
> 
> I think I'm getting somewhere, based on code from prepend in ggee (Thanks 
> Guenter!) I'm not clear on how to use SETFLOAT to set multiple values in 
> my atom array. Here is some of my code:
> 
>         t_atom f_out[9];
>         t_atom* myf = f_out;
> 
> I can use SETFLOAT(myf,f); to set the first value of the list, but I 
> don't know how to set multiple list atoms... (I tried running SETFLOAT 
> multiple times with the same pointer, but different values and I get a 
> list "2Consistency check failed: atom_string2" Where 2 is the second 
> value I set via SETFLOAT. 
> 
> Pointers would be appriciated.
> Thanks
> 
> The simplest possible example of outputing a list of floats would be helpful.
> 
> Ben
> 
> 
> On Tue, 16 Jul 2002, Krzysztof Czaja wrote:
> 
> > hi Ben,
> > 
> > if 'x' is your object pointer, 'n' is the number of floats, and
> > you already store them in an array of atoms 'a', then the call
> > will be
> > 
> > outlet_list(x, &s_list, n, a);
> > 
> > If the floats are kept in a float* array, then you need to
> > allocate an array of atoms, and copy the floats into it, using
> > SETFLOAT macro in a loop.
> > 
> > The tricky part could be deciding, how to allocate this output
> > array -- this was discussed some time ago on pd-dev.  Also, there
> > are several examples in zexy, ggee, cyclone, etc.
> > 
> > Krzysztof
> > 
> > Ben Bogart - FMPM/F1999 wrote:
> >  > I want to calculate a series of floats and output them as a list out the
> >  > outlet, I see:
> >  >
> >  > void outlet_list(t_outlet *x,
> >  >                  t_symbol *s, int argc, t_atom *argv);
> >  >
> >  > but don't know how to set the contents of the list, ie I'm not sure how
> >  > to use gensym("list").
> > 
> > 
> 
> 
> 
> B. Bogart
> ---------
> 
> 
> _______________________________________________
> PD-dev mailing list
> PD-dev at iem.kug.ac.at
> http://iem.kug.ac.at/cgi-bin/mailman/listinfo/pd-dev
> 



B. Bogart
---------





More information about the Pd-dev mailing list