vvopensource
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Groups Pages
Instance Methods | Protected Attributes
OSCManager Class Reference

Main VVOSC class- manages in & out port creation, zero configuration networking (bonjour/zeroconf) More...

#import <OSCManager.h>

Inherits NSObject.

Instance Methods

(void) - deleteAllInputs
 Deletes all input ports.
 
(void) - deleteAllOutputs
 Deletes all output ports.
 
(OSCInPort *) - createNewInputFromSnapshot:
 Creates a new input from a snapshot dict (the snapshot must have been created via OSCInPort's createSnapshot method)
 
(OSCInPort *) - createNewInputForPort:withLabel:
 Creates a new input for a given port and label.
 
(OSCInPort *) - createNewInputForPort:
 Creates a new input for a given port, automatically generates a label.
 
(OSCInPort *) - createNewInput
 Creates a new input at an arbitrary port (it tries to use port 1234) and label.
 
(OSCOutPort *) - createNewOutputFromSnapshot:
 Creates a new output from a snapshot dict (the snapshot must have been created via OSCOutPort's createSnapshot method)
 
(OSCOutPort *) - createNewOutputToAddress:atPort:withLabel:
 Creates a new output to a given address and port with the given label.
 
(OSCOutPort *) - createNewOutputToAddress:atPort:
 Creates a new output to a given address and port, automatically generates a label.
 
(OSCOutPort *) - createNewOutput
 Creates a new output to this machine at port 1234.
 
(void) - receivedOSCMessage:
 Called when OSCInPorts are processing received messages serially (by default, the manager is an OSCInPort's delegate) More...
 
(void) - dispatchQuery:toOutPort:timeout:replyHandler:
 Only used to support the (non-specification) OSC query protocol. All queries MUST be sent from the manager via this method to one of its outputs (the manager has to actually send the message through an input for technical reasons). The reply handler is called when a reply is received or when the timeout expires.
 
(void) - dispatchQuery:toOutPort:timeout:replyDelegate:
 Only used to support the (non-specification) OSC query protocol. All queries MUST be sent from the manager via this method to one of its outputs (the manager has to actually send the message through an input for technical reasons). The delegate is called when a reply is received or when the timeout expires.
 
(void) - transmitReplyOrError:
 Used to support the (non-specification) OSC query protocol. If you've received a query and have assembled a reply or an error, this is how you send the reply/error back to the other app/device/whatever sent the query. Only works if the passed message is a reply (OSCMessageTypeReply) or error (OSCMessageTypeError) and has a valid (non-0) queryTXAddress & queryTXPort. locates the corresponding OSCOutPort- creating one if necessary- and sends the OSCMessage out it.
 
(void) - removeInput:
 Removes the passed input from the inPortArray.
 
(void) - removeOutput:
 Removes the passed output from the outPortArray.
 
(void) - removeOutputWithLabel:
 Removes the first output with the passed label.
 
(void) - removeAllOutputs
 Removes all the outputs from the outPortArray.
 
(NSArray *) - outPortLabelArray
 Generates and returns an array of strings which correspond to the labels of this manager's out ports.
 
(id) - inPortClass
 By default, returns [OSCInPort class]- subclass around to use different subclasses of OSCInPort. More...
 
(id) - outPortClass
 By default, returns [OSCOutPort class]- subclass around to use different subclasses of OSCOutPort. More...
 
(id) - delegate
 Returns the delegate (by default, an OSCManager doesn't have a delegate)
 
(void) - setDelegate:
 Sets the delegate; the delegate is NOT retained, make sure you tell the manager's nil before releasing it!
 

Protected Attributes

id delegate
 If there's a delegate, it will be notified when OSC messages are received.
 
OSCZeroConfManager * zeroConfManager
 Creates OSCOutPorts for any OSC destinations detected via bonjour/zeroconf.
 

Detailed Description

Main VVOSC class- manages in & out port creation, zero configuration networking (bonjour/zeroconf)

The OSCManager will probably be the main class that you're working with: it creates/deletes inputs (which receive data) and outputs (which send data), passes any OSC data received to its delegate (your application), optionally handles distribution of all received OSC messages, and does other manager-ish things. You should only need one instance of OSCManager in your application. One of your objects should be OSCManager's delegate (see the "OSCDelegateProtocol" below) so you may receive OSC data.

Incoming OSC data is initially received by an OSCInPort; fundamentally, in ports are running a loop which checks a socket for data received since the last loop. By default, the OSCInPort's delegate is the OSCManager which created it. Every time the loop runs, it passes the received data off to its delegate (the manager) as the raw address/value pairs in the order they're received. When the OSCManager receives data from its in port it immediately passes the received data to its delegate, which should respond to one of the following methods (referred to as the 'OSCDelegateProtocol'):

@protocol OSCDelegateProtocol
- (void) receivedOSCMessage:(OSCMessage *)m;
@end

...if you want to work with received OSC data, OSCManager's delegate must respond to this method!

Method Documentation

- (id) inPortClass

By default, returns [OSCInPort class]- subclass around to use different subclasses of OSCInPort.

by default, this method returns [OSCInPort class]. itŐs called when creating an input port. this method exists so if you subclass OSCInPort you can override this method to have your manager create your custom subclass with the default port creation methods

- (id) outPortClass

By default, returns [OSCOutPort class]- subclass around to use different subclasses of OSCOutPort.

by default, this method returns [OSCOutPort class]. itŐs called when creating an input port. this method exists so if you subclass OSCOutPort you can override this method to have your manager create your custom subclass with the default port creation methods

- (void) receivedOSCMessage: (OSCMessage *)  m

Called when OSCInPorts are processing received messages serially (by default, the manager is an OSCInPort's delegate)

the passed OSCMessage has both the address and the value (or values- a message can have more than one value). this method is called immediately, as the incoming OSC data is received- no attempt is made to coalesce the updates and sort them by address.

important: this method will be called from any of a number of threads- each port is running in its own thread!

input ports tell their delegates when they receive data. by default, the osc manager is the input port's delegate- so this method will be called by default if your input port doesn't have another delegate. as such, this method tells the manager's delegate about any received osc messages.


The documentation for this class was generated from the following files: