asTarget:
Filter:
Reference | Server > Nodes

asTarget

Convert to a valid Node Target

asTarget

The classes listed below implement the method asTarget. This is used widely in the Node classes ( Group and Synth ) to convert non-Node objects to an appropriate target. This allows nil and instances of Server to be used as targets. This can be useful when writing classes which create nodes internally, but in most cases there should be little need to call asTarget in normal use.

For an updated list of which classes that implements asTarget, see asTarget in Methods: asTarget

Node: -asTarget
Returns the instance of Node itself. The subclasses of Node (Synth and Group) are valid targets and require no conversion.
Server: -asTarget
Returns a Group object representing the Default Group of this instance of Server. Note that this object may not be identical with other objects representing the default group, but will be equivalent.
Nil: -asTarget
Returns a Group object representing the Default Group of the current default Server.
Integer: -asTarget
Returns a Group object representing a group node on the current default Server with this Integer as its node ID number.
NOTE: Although this can be convenient in some cases, it does not create the corresponding node on the default server, nor does it check to make sure that it exists. As well it does not directly access the server's NodeIDAllocator, so duplication of node IDs is possible. For these reasons this method should be used with care. When not dealing with the default Server, Group-basicNew is safer and simpler, as otherwise one needs to set the server instance variable to ensure correct targeting.