Personal tools
You are here: Home documentation Style Guide StyleGuideDraft2
Views

Edit history

Edit: -1 of 1
Time: 2009-03-17 09:45:30
Note: /pd/pd/docs/style-guide/StyleGuideDraft2/edit

changed:
-
== Send/Receive Naming Conventions ==

''Using $0+ & Spaces & Hierarchies''

It is often useful to create a hierarchy of names when patching.  The most common example of this is the use of $0 when creating localized send/receives: one writes {{{[send $0-frequency]}}}, with "$0" as the "parent" and "frequency" as the "child".  We separate hierarchical levels with a "-".  For example, a "cutoff" parameter of a filter in the local namespace might be written {{{[receive $0-filter-cutoff]}}}.  This also applies if one is using a different argument than $0, such as passing in "foobar" for $1: one would write {{{[receive $1-baz]}}} to get the full name of "foobar-baz".

Sometimes a parameter is made up of more than one word.  For clarity, use "_" to separate words, like {{{[receive $0-resonance_peak]}}}.

''Global Variables''

Due to the confusing bugs that can result from widespread usage of global variables, they are written in all caps, like {{{[send SSSAD_ADMIN]}}}.  Use "_" as above to separate words.

''Argument passing''

If passing the arguments of a parent abstraction to a child, place them such that they reside in the same $# slots as they do in the parent (when possible).  E.g., if the parent was called like {{{[parent a b c]}}}, and {{{[child]}}} also needs "a b c" plus "x y z", design and call {{{[child]}}} so it can be called as {{{[child a b c x y z]}}}.

''Channel naming''

For the special case of {{{[send~/receive~]}}} or {{{[throw~/catch~]}}} pairs with multiple parallel channels, name your channels with numbers rather than "left" or "right".  E.g., {{{[throw~ $0-wavetable_osc-ch1]}}} and {{{[throw~ $0-wavetable_osc-ch2]}}}.  This makes it easier to later expand your patch for higher-than-2-channel audio.

Powered by IEM Powered by Plone Section 508 WCAG Valid XHTML Valid CSS Usable in any browser