de.sciss.jcollider
Class OSCMultiResponder

java.lang.Object
  extended by de.sciss.jcollider.OSCMultiResponder
All Implemented Interfaces:
de.sciss.net.OSCListener

public class OSCMultiResponder
extends java.lang.Object
implements de.sciss.net.OSCListener

Despite the name, the OSCMultiResponder mimics the SClang counter part only superficially. It absorbs the whole OSCResponder class and is based on the NetUtil OSC library.

While the super class OSCReceiver allows only a coarse message filtering, using the simple OSCListener interface, the OSCMultiResponder maintains a map of OSC command names and listeners (OSCResponderNodes) who wish to be informed about only this particular type of messages.

When a new node is added using the addNode method, the static list of all multi responders is searched for the given server address. If it exists, the corresponding multi responder is used, otherwise a new multi responder is created. Likewise, when removeNode is called, the multi responder checks if all nodes have been removed, and if so will terminate the OSC receiver.

To keep the responder permanently active, the server creates a multi responder for its address upon instantiation.

Version:
0.33, 08-Apr-08
Author:
Hanns Holger Rutz

Constructor Summary
protected OSCMultiResponder(de.sciss.net.OSCClient c)
          Creates a new responder for the given OSCClient.
 
Method Summary
protected  void addNode(OSCResponderNode node)
           
protected  void dispose()
           
protected  java.lang.Object getSync()
           
 void messageReceived(de.sciss.net.OSCMessage msg, java.net.SocketAddress sender, long time)
           
protected  void removeNode(OSCResponderNode node)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OSCMultiResponder

protected OSCMultiResponder(de.sciss.net.OSCClient c)
                     throws java.io.IOException
Creates a new responder for the given OSCClient. This is done by the server to create a permanent listener. Users should use the OSCResponderNode class instead.

Parameters:
c - the client to who's receiver we should listen
Throws:
java.io.IOException
See Also:
OSCResponderNode
Method Detail

getSync

protected java.lang.Object getSync()

addNode

protected void addNode(OSCResponderNode node)
                throws java.io.IOException
Throws:
java.io.IOException

removeNode

protected void removeNode(OSCResponderNode node)

dispose

protected void dispose()

messageReceived

public void messageReceived(de.sciss.net.OSCMessage msg,
                            java.net.SocketAddress sender,
                            long time)
Specified by:
messageReceived in interface de.sciss.net.OSCListener