[PD] Beginner's Question: templates

Andrew Dabrowski dabrowsa at indiana.edu
Tue Mar 18 16:56:41 CET 2008


I posted this to the puredata.hurleur.com forum, but didn't get any
responses.

I'm brand new to pd.

I'd like to make a template that represents the midi channel by color.
So I'd like to change the channel number to one between 0-999, say

     [channel]
      |
     [* 171]
      |
     [mod 1000]
      |
     [drawpolygon $1 .....]

The problem is, how do I call the channel field of the struct from
inside the template?  I know I can call channel directly inside
[drawpolygon ....], but then I can't do any arithmetic on it before
using it as a color.

I know I could define a new field in the struct, say clr, set up an
abstraction to define it correctly from channel, then call clr inside
[drawpolygon ....], but that seems ugly.





More information about the Pd-list mailing list