On Tue, 6 May 2008, Matt Barber wrote:
Is there a way to make an abstraction that has one inlet that takes both signal and control messages (like osc~, e.g., or fiddle~ which gets audio and setting info, etc.)?
My solution has been to make an external that contains no objectclass and load it using -lib. It contains this code:
#define ALIAS(y,x)
class_addcreator((t_newmethod)getfn(m,gensym(x)),gensym(y),A_GIMME,0);
t_pd *m = &pd_objectmaker;
ALIAS( "inlet.f","inlet" );
ALIAS( "inlet.~","inlet~" );
So after that, Pd 0.40 can instantiate it as [inlet.$1]
If you are stuck with Pd 0.39 you will need to swap it around because [inlet.$1] won't work but [$1.inlet] will.
But this is just an alternative to what Charles Henry said. I prefer mine because the syntax looks better. Then I pass either "f" or "~" as argument to an abstraction. I would later add more single-character suffixes such as "s" and such perhaps, but only to the extent that polymorphism makes sense - first, an analogy has to be made between two types such that one behaviour one one type can be likened to one behaviour on the other. From that point, the two behaviours can be unified, partially or totally, and then [inlet.$1] (or equivalent) becomes useful.
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801, Montréal, Québec