Connection:
Filter:
Connection/Classes (extension) | Connection

Connection
ExtensionExtension

Represents a dependancy connection between two objects

Description

Connection represents a dependency connection between two objects. When the Object: -changed method of the left-hand object is called, the Object: -update method of the right-hand object is called.

Creating a connection using:

is roughly equivalent to calling

Connections operate on top of the existing changed/update/addDependant functionality, so they can interoperate with other SuperCollider functionality based around these methods (for example, SimpleController).

NOTE: Connection's are not usually created via the Connection constructor. Instead, they should be created using Object: -connectTo. This allows objects to override default behaviors when connecting.

Class Methods

.new

Create a new Connection between object and dependant.

Arguments:

object

Object that will be broadcasting changes.

dependant

Object that will be receiving notification of changes.

autoConnect

If false, object will not be connected to the dependant immediately. It can be connected later using the -connected method.

.traceAll

When traceAll == true, all new Connections will be created with tracing turned on. See Connection: -traceNote that this will not turn on tracing for Connections that have already been created.

.untraceAll

Turn off tracing on all Connections that are currently being traced. See Connection: -trace

.traceWith

Execute function func and trace ALL connections created during that function, ONLY for the duration of the function. If traceAll == true, all created connections will continue to be traced after the function is finished, otherwise they will not.

Instance Methods

.connected

When connected == true, Object: -changed messages will be passed from the object to the dependant.

Arguments:

connect

Boolean. false will disconnect the object from it's dependant.

Discussion:

.connect

Synonym for connection.connected = true;

.disconnect

Synonym for connection.connected = false;

.disconnectWith

Execute function func - disconnect the Connection for the duration, and return it to it's previous state after func is done. Note that, if the connection was already disconnected, the connection will remain in a disconnected state.

.free

Permanently disconnect the connection. This will free up resources and ensure all objects will be garbage collected. Connections cannot be reconnected after freeing.

++

Concatenate with another Connection or ConnectionList.

Returns:

Filters and modifiers

.transform

Insert an UpdateTransform between the object and it's dependant.

Arguments:

func

A Function to be used as the argument to the UpdateTransform constructor.

Discussion:

.filter

Insert an UpdateFilter between the object and it's dependant.

Arguments:

filter

A Function or Symbol, to be used as the argument to the UpdateFilter constructor.

Discussion:

.oneShot

Disconnect the connection the next time a signal is recieved.

Arguments:

shouldFree

If shouldFree == true, Connection will be free'd instead of disconnected.

Discussion:

.defer

Insert an DeferredUpdater between the object and it's dependant.

Arguments:

delta, clock, force

Arguments passed along to the DeferredUpdater constructor.

Discussion:

.collapse

Insert an CollapsedUpdater between the object and it's dependant.

Arguments:

delta, clock, force

Arguments passed along to the CollapsedUpdater constructor.

Discussion:

Debugging

.trace

Enable or disable tracing for this connection. When tracing a connection, all signals passed from the object to the dependant will be displayed in the post window even if the Connection is currently disconnected.

⋯⋯ indicates that the signal was passed along (e.g. connected == true);

⋰⋰ indicates that the signal was not passed along (e.g. connected == false);

Discussion:

.traceWith

Turn tracing on for this connection for the duration of func