[PD-dev] namespaces for send/receive

Frank Barknecht fbar at footils.org
Tue Nov 17 10:53:12 CET 2009


Hallo,
Hans-Christoph Steiner hat gesagt: // Hans-Christoph Steiner wrote:

>> (*) Pd has no non-globals, just obfuscated names..
>
> Yeah, I also try to avoid globals as much as possible.  With this  
> library, its kind of mirroring the audio clock of tilde objects, so  
> [fps] is like [samplerate~]  and the frameclock is transparent, just  
> like you don't have to tell tilde objects which audio clock to use.  I  
> am trying to address situations when you are scoring to a video.  I  
> can't see a time when you would have to deal with multiple video  
> framerates within the same project.
>
> I want to avoid having all this as arguments, since some of the objects 
> already have 4 arguments.  But I am open to suggestions to how else to 
> deal with this.  It would be nice to have the frame clock and fps within 
> a project namespace, I just can't think of a way to do it without making 
> things too complicated.

If you really want to use globals I think you should minimize the number of
global names in use by using a [route]-based approach like this:

 [r GLOBAL_FRAMESYNC_RECEIVER]
 | 
 [route fps pos ...]
 |   |    ...

Personally I have all my globals in UPPERCASE. In sssad, I used "SSSAD_" as
prefix with divider.

A way to give users some flexibility in regard to globals is to let them name
the globals with a $1 argument. This would make it possible for users to create
groups of related code sections that are still independend from each other, for
example to have two things playing at different FPS values, which would be
impossible if "fps" is global. In the audio system of Pd the samplerate can be
changed in subpatches, although a different approach is used for that.

Passing $0 as $1 would even make things "local" again.

Ciao
-- 
Frank




More information about the Pd-dev mailing list