Re: [PD-dev] allow only one instance of external object

2008-03-23 Thread Claude Heiland-Allen
best boy wrote:
 hi
 is there a way to keep track of the number of opened instances of an 
 external?

Is this an external you are writing?  Then yes.  Otherwise there's weird 
tricks you can probably do to keep track, but not control.

 if so, can anyone point me to an example object?

Just have a global counter variable that you initialise to 0 in 
foo_setup(), and in foo_new() you increment it, and in foo_free() you 
decrement it.

 thanks
 olli

Claude
-- 
http://claudiusmaximus.goto10.org


___
PD-dev mailing list
PD-dev@iem.at
http://lists.puredata.info/listinfo/pd-dev


Re: [PD-dev] allow only one instance of external object

2008-03-23 Thread Frank Barknecht
Hallo,
best boy hat gesagt: // best boy wrote:

 is there a way to keep track of the number of opened instances of an external?
 if so, can anyone point me to an example object?

You could wrap it inside an abstraction which has a running counter
stored in a [value MYOBJECTCOUNT] object. MYOBJECTCOUNT should be
unique. The counter then gets incremented with each new instance of
your abstraction. You cannot delete objects though without the counter
getting out of sync unless you use a Pd with [closebang] or so.

For various obvious reasons, this is not a very good general
solution, though.

Ciao
-- 
 Frank Barknecht _ __footils.org__


objcounter.pd
Description: application/puredata


objcounter-help.pd
Description: application/puredata
___
PD-dev mailing list
PD-dev@iem.at
http://lists.puredata.info/listinfo/pd-dev


Re: [PD-dev] allow only one instance of external object

2008-03-23 Thread best boy

hi
yes, it's for an external i'm writing.
i tried the global counter variable thing you recommended and it works, except 
for
when the first instance is duplicated, or copy/pasted in a patcher. this 
crashes pd.

do you, or anyone else, know of a working example of the global counter 
variable thing?

thanks
olli

 Date: Sun, 23 Mar 2008 10:43:36 +
 From: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 CC: pd-dev@iem.at
 Subject: Re: [PD-dev] allow only one instance of external object
 
 best boy wrote:
  hi
  is there a way to keep track of the number of opened instances of an 
  external?
 
 Is this an external you are writing?  Then yes.  Otherwise there's weird 
 tricks you can probably do to keep track, but not control.
 
  if so, can anyone point me to an example object?
 
 Just have a global counter variable that you initialise to 0 in 
 foo_setup(), and in foo_new() you increment it, and in foo_free() you 
 decrement it.
 
  thanks
  olli
 
 Claude
 -- 
 http://claudiusmaximus.goto10.org
 

_
Testen Sie Live.com - das Zentrum Ihrer Online-Welt, das Sie mit aktuellen 
Nachrichten, Sport- und Wetterinfos und vielem mehr versorgt.
http://www.live.com/getstarted___
PD-dev mailing list
PD-dev@iem.at
http://lists.puredata.info/listinfo/pd-dev


Re: [PD-dev] allow only one instance of external object

2008-03-23 Thread best boy

hi
thanks for your help.
i checked out nopoly4 and polypoly, but they both seem to be abstractions and 
are not very helpful in my case.
i need a working solution that prevents the user from creating more than one 
instance of an external i'm writing.
thanks anyway
olli

CC: pd-dev@iem.at
From: [EMAIL PROTECTED]
Subject: Re: [PD-dev] allow only one instance of external object
Date: Sat, 22 Mar 2008 23:43:23 -0400
To: [EMAIL PROTECTED]


Check out nqpoly4 or polypoly, they are both included in Pd-extended and in 
SVN..hc
On Mar 22, 2008, at 11:33 PM, best boy wrote: hi
is there a way to keep track of the number of opened instances of an external?
if so, can anyone point me to an example object?
thanks
olli

Kostenlos bloggen + eigene Homepage + Fotospeicher = MSN Spaces 
Kostenlos!___PD-dev mailing [EMAIL 
PROTECTED]://lists.puredata.info/listinfo/pd-dev 
 

As we enjoy great advantages from inventions of others, we should be glad of an 
opportunity to serve others by any invention of ours; and this we should do 
freely and generously. - Benjamin Franklin 

_
Testen Sie Live.com - das Zentrum Ihrer Online-Welt, das Sie mit aktuellen 
Nachrichten, Sport- und Wetterinfos und vielem mehr versorgt.
http://www.live.com/getstarted___
PD-dev mailing list
PD-dev@iem.at
http://lists.puredata.info/listinfo/pd-dev


Re: [PD-dev] allow only one instance of external object

2008-03-23 Thread Hans-Christoph Steiner


Check out [singleton] and search the archives for discussions on that:

http://lists.puredata.info/pipermail/pd-list/2007-03/048424.html

.hc

On Mar 23, 2008, at 4:13 PM, best boy wrote:


hi
thanks for your help.
i checked out nopoly4 and polypoly, but they both seem to be  
abstractions and are not very helpful in my case.
i need a working solution that prevents the user from creating more  
than one instance of an external i'm writing.

thanks anyway
olli

CC: pd-dev@iem.at
From: [EMAIL PROTECTED]
Subject: Re: [PD-dev] allow only one instance of external object
Date: Sat, 22 Mar 2008 23:43:23 -0400
To: [EMAIL PROTECTED]


Check out nqpoly4 or polypoly, they are both included in Pd- 
extended and in SVN.


.hc

On Mar 22, 2008, at 11:33 PM, best boy wrote:

hi
is there a way to keep track of the number of opened instances of  
an external?

if so, can anyone point me to an example object?
thanks
olli

Kostenlos bloggen + eigene Homepage + Fotospeicher = MSN Spaces  
Kostenlos!

___
PD-dev mailing list
PD-dev@iem.at
http://lists.puredata.info/listinfo/pd-dev



-- 
--


As we enjoy great advantages from inventions of others, we should  
be glad of an opportunity to serve others by any invention of ours;  
and this we should do freely and generously. - Benjamin  
Franklin




Jetzt dabei sein und Windows Live Mail testen. Windows Live Mail.




 



Terrorism is not an enemy.  It cannot be defeated.  It's a tactic.   
It's about as sensible to say we declare war on night attacks and  
expect we're going to win that war.  We're not going to win the war  
on terrorism.- retired U.S. Army general, William Odom



___
PD-dev mailing list
PD-dev@iem.at
http://lists.puredata.info/listinfo/pd-dev