Class OscReceiver

  • All Implemented Interfaces:
    java.lang.Cloneable, oscP5.OscEventListener, Actor, Executable, FiringsRecordable, Initializable, TypedActor, Changeable, Debuggable, DebugListener, Derivable, Instantiable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

    public class OscReceiver
    extends TypedAtomicActor
    implements oscP5.OscEventListener

    Receive Open Sound Control (OSC) Messages by listening to the specified port and send each message to the corresponding output by name matching. This implies that the user will have to manually add output ports to the receiver, according to the messages they would like to listen for. Type of each port is determined by the first token that is received at that port. Allowed types are int, double, float and string. If input type is not specified by OSC, or if the defined type does not match any of the allowed types, tokens will still be produced as ObjectTokens.

    See: http://opensoundcontrol.org/ for the full OSC Specification.

    Since:
    Ptolemy II 10.0
    Version:
    $Id$
    Author:
    Ilge Akkaya
    See Also:
    OscSender
    Pt.AcceptedRating:
    Pt.ProposedRating:
    Red (ilgea)
    • Field Detail

      • port

        public Parameter port
        The receive port.
    • Method Detail

      • attributeChanged

        public void attributeChanged​(Attribute attribute)
                              throws IllegalActionException
        React to a change in an attribute. In this case, check port. if port changes, need to reinitialize the OSCreceiver with that port if possible
        Overrides:
        attributeChanged in class NamedObj
        Parameters:
        attribute - The attribute that changed.
        Throws:
        IllegalActionException - If the change is not acceptable to this container (not thrown in this base class).
      • postfire

        public boolean postfire()
                         throws IllegalActionException
        Description copied from class: AtomicActor
        Return true, unless stop() has been called, in which case, return false. Derived classes override this method to define operations to be performed at the end of every iteration of its execution, after one invocation of the prefire() method and any number of invocations of the fire() method. This method typically wraps up an iteration, which may involve updating local state. In derived classes, this method returns false to indicate that this actor should not be fired again.
        Specified by:
        postfire in interface Executable
        Overrides:
        postfire in class AtomicActor<TypedIOPort>
        Returns:
        True if execution can continue into the next iteration.
        Throws:
        IllegalActionException - Not thrown in this base class.
      • oscEvent

        public void oscEvent​(oscP5.OscMessage theMessage)
        Specified by:
        oscEvent in interface oscP5.OscEventListener
      • oscStatus

        public void oscStatus​(oscP5.OscStatus s)
        Specified by:
        oscStatus in interface oscP5.OscEventListener
      • wrapup

        public void wrapup()
                    throws IllegalActionException
        Description copied from class: AtomicActor
        Do nothing except invoke the wrapup() methods of any objects that have been registered with addInitializable(). Derived classes override this method to define operations to be performed exactly once at the end of a complete execution of an application. It typically closes files, displays final results, etc.
        Specified by:
        wrapup in interface Initializable
        Overrides:
        wrapup in class AtomicActor<TypedIOPort>
        Throws:
        IllegalActionException - Not thrown in this base class.