[PD] where to find $ args

Mathieu Bouchard matju at artengine.ca
Sun Jan 23 14:45:48 CET 2011

On Sun, 23 Jan 2011, Rich E wrote:

> If I were to make an external that has access to $ arguments, does 
> anyone know where I can find the necessary methods for retrieving this 
> information?  Or is it only available at instantiation?
> Most importantly, I am looking for a way to get the $0 value of a patch from C.  

In all cases, you need to get a canvas environment (there is one per file 
loaded, that is, one per distinct value of $0) :

   t_canvasenvironment *e = canvas_getenv(x->parent);

but you need to have a variable in your struct for accessing your parent :

   t_canvas *parent;

that you need to set in the creator (constructor) because that's the only 
time you can obtain that information :

   x->parent = canvas_getcurrent();

but when you need to get the $0, you need the e and you use this :


and if you need to get $1, $2, $3, ... you use these :

   e->ce_argv[0] /* $1 */
   e->ce_argv[1] /* $2 */
   e->ce_argv[2] /* $3 */

but you don't use indices that are >= e->ce_argc, which is the number of 

| Mathieu Bouchard ---- tél: +1.514.383.3801 ---- Villeray, Montréal, QC

More information about the Pd-list mailing list