[PD] Instantiating an array field in a struct

Frank Barknecht fbar at footils.org
Sun Jul 8 08:55:46 CEST 2007


Hallo,
Samuel Rye hat gesagt: // Samuel Rye wrote:

> I've been playing around with Pure Data data structures for the first time,
> and I've managed to create a simple struct with two float fields and
> instantiate the struct in a pd subpatch.  However, I can't figure out how to
> create an array field in a struct (as in making a breakpoint envelope).
> 
> i.e.
> 
> I can create these by using the [append] object:
> 
> [struct point float x float y]
> 
> 
> But I can figure out how to build these:
> 
> [ struct points array array1 point ]

You create a "points" instance with [append] as well. The problem is,
that [append] needs to set one field of the struct, when creating an
instance through an incoming message. But you cannot set an array with
a message directly, so you should extend your struct definition by at
least one float variable. The implicit variables "x" or "y" come to
mind. 

So the solution is: you use [struct points float x array array1 point]
instead of your defintion, and then append with [append points x].

Ciao
-- 
 Frank Barknecht                 _ ______footils.org_ __goto10.org__




More information about the Pd-list mailing list