Sine you're opening the patches via libpd through ofxPd, you already have the pointer to the patch instance. Simply use that to close each instance individually. If you want to have the patch close itself, you can have it send a message to the C++ layer with it's $0 or a custom index so you know which object to close.

On Nov 18, 2013, at 6:00 AM, pd-list-request@iem.at wrote:

From: Ronni Montoya <ronni.montoya@gmail.com>
Subject: [PD] Selfdestroying patches
Date: November 17, 2013 at 10:44:59 PM EST
To: PD List <pd-list@iem.at>


Hi, im opening multiple instances of a pd patch  from openframeworks
using the ofxPd library .

 My patch generates a grain, so when i create multiple instances of
this patch from openframeworks it generates a granular cloud.
I need that after the grain is generated ( when sound finishes)  the
patch can selfdestroy itself ( instance get closed) .

How can i do this?



cheers

R.

--------
Dan Wilcox
@danomatika