OpenObject:
Filter:
OpenObject/Classes (extension) | OpenSoundControl

OpenObject
ExtensionExtension

talk to objects over the network

Description

Publish any object for remote access via network (OSC, see http://opensoundcontrol.org ). This allows to create easy access for other languages and systems, such as Pd, Processing or Max.

For more examples and demos see http://www.fredrikolofsson.com/f0blog/?q=node/401

OpenObject API has two levels:

There is only one instance for each instance of sc-lang. Any functionality within sclang can be remote controlled, for instance by using environments with functions (example below).

NOTE: There are examples for Processing, Max/MSP and PureData bundled with this Quark. You'll find them next to where you installed this class.

Class Methods

.start

Start listening to addr (if nil, it listens to all addresses). SClang listens on the port 57120. If for some reason it was given a different one by the OS, an error message is posted. Restarting SuperCollider helps.

.replyPort

Some applications do not allow to receive messages through the same port they are passing in the OSC message as reply port. As a workaround, this port can be explicitly overridden here.

.end

Stop listening.

.clear

Remove all objects.

.isListening

Check if listening.

.put

Add an object for remote access under a name.

.keyFor

The key under which object is published.

.remove

Remove an object.

.removeAt

Remove an object published under name.

Remote controlling proxies and environments

.lookup

The default is false, but if set to true, any objects or classes that implement the message " at " can be accessed remotely. As name, use the scheme: name_key, e.g. Tdef_x for Tdef(\x).

.openProxies

Register the proxy classes Tdef, Ndef, Pdef, Pdefn, Ndef and Fdef (convenience method).

*lookup is set to true.

Interpreting

For remote code execution, OpenObject can be opened to the interpreter.

WARNING: Use with care! Any code can be executed from the network, so the connection should be trustworthy.
/oo_i
Interpret the string on the remote sclang interpreter.
/oo_p
Set the proxy source with the interpreted code string (used for remote live coding).

.openInterpreter

Open the interpreter for external access. Do this only if you know what you are doing.

Arguments:

addr

Address from which the messages come. nil means any.

If a replyID (an Integer) is given, sends back a reply: The results are sent back to the sender under the OSC command "/oo_reply" replyID val1 val2 …

.avoidTheWorst

A Boolean to de/activate a layer of extra protection. By default this is true and will block strings that contain unixCmd, systemCmd, Pipe and File. To turn off the protection set this to false.

.closeInterpreter

Close the interpreter.

OpenSoundControl API

Once an object has been published under a name, methods can be called via OSC messages:

name
The name under which the object has been published.
selector
The message to be called on the object.
arg
a float, integer, symbol. (strings are converted to symbols). Array arguments can be nested by bracket chars as type tags (see example below).
replyID
If a replyID (an Integer) is given, sends back a reply: The results are sent back to the sender under the OSC command "/oo_reply" replyID val1 val2 ...
/oo
passes arguments in sequence
/oo_k
passes keyword arguments, in pairs of argument name and value.