Classes | Control | Server > Nodes

NodeWatcher : BasicNodeWatcher : AbstractNodeWatcher : Object

notify sc-lang side node objects of their server sided state

Description

Node instances (Synths and Groups) can be registered with the NodeWatcher. It watches for server node status messages: n_go n_end n_off n_on

and sets the isPlaying and isRunning variables on the Node instance accordingly. A Node that ends is unregistered at that time.

In some cases this can be an invaluable service. The use of an independant object to maintain the state keeps the implementation of the Node classes simple. Note that server notification should be on. (this is default. see: aServer.notify)

//the most common use:
NodeWatcher.register(aNode);

Class Methods

NodeWatcher.new(server)

From superclass: AbstractNodeWatcher

Create a new instance listening to the server's address

NodeWatcher.newFrom(server)

Create a new instance listening to the server's address. If there is one present already return that one.

NodeWatcher.register(node, assumePlaying: false)

Arguments:

node

Can be a Group or a Synth. The NodeWatcher is created internally.

assumePlaying

If true, the node's isPlaying field is set to true.

NodeWatcher.unregister(node)

Remove the node from the list of nodes. This happens also when a node is freed.

Inherited class methods

Undocumented class methods

NodeWatcher.all

NodeWatcher.all = value

NodeWatcher.cmdPeriod

NodeWatcher.doOnServerBoot(aServer)

NodeWatcher.doOnServerQuit(aServer)

Instance Methods

.start

From superclass: AbstractNodeWatcher

Add the OSCFunc to listen to the address.

.stop

From superclass: AbstractNodeWatcher

Remove the OSCFunc to stop listen to the address.

Inherited instance methods

Undocumented instance methods

.clear

.cmds

.n_end(node)

.n_go(node)

.n_off(node)

.n_on(node)

.register(node, assumePlaying: false)

.respond(method, msg)

.unregister(node)

Examples

(
b = s.makeBundle(false, {
    a = Group.new(s);    //create a node object
    NodeWatcher.register(a); // register before creating on the server
});
)
a.isPlaying;
s.listSendBundle(nil, b);    //start the node on the server
a.isPlaying;
a.isRunning;
a.run(false);
a.isRunning;
s.freeAll;    //free all nodes
a.isPlaying;
a.isRunning;