[PD-dev] string external & usage count

joerg piringer joerg at piringer.net
Wed Oct 13 14:08:55 CEST 2004


hi all,
i am trying to develop a string external that does not use symbols for 
string storage because of known problems with symbols.

what i am now doing is using string handles (int) and store the strings 
internally in my external. that works quite well. the only problem is 
that i had to introduce usage counters to free my string memory when it 
is no longer needed.
when a string is generated (each operation that returns a string 
generates a new string) the usage count is set to one and when an object 
receives a string at one of its inlets the usage count is reduced. if 
the usage count is zero the string mem is freed.
that works as long as i don't split outlets. my objects don't know how 
many connections are plugged into an outlet so it cannot set the usage 
count to the number of connections as it should be.
so my (not very beautiful) solution is to introduce an object that 
splits an inlet into multiple outlets and increases the usage counter 
accordingly.

i did not find a possibility to find out the number of connections 
attached to an outlet and i guess there is no method for that. is that 
correct?
or could maybe future versions of pd make it possible for externals to 
detect the number of connections?

anyway my solution works quite well but i'd like to improve it.

best
	joerg

-- 
http://joerg.piringer.net
http://www.transacoustic-research.com
http://www.iftaf.org
http://www.vegetableorchester.org




More information about the Pd-dev mailing list