Recent Changes - Search:

edit SideBar


A accessor may instantiate any number of contained accessors in the body of its setup() function and then connect them using

  • connect(a, b, [c, [d]]): Connect the specified inputs and outputs.

There are four forms of this function:

  1. connect(sourceAccessor, outputName, destinationAccessor, inputName);
  2. connect(myInputName, destinationAccessor, inputName);
  3. connect(sourceAccessor, outputName, myOutputName);
  4. connect(myInputName, myOutputName);

In all cases, this connects a data source to a destination. In form 1, the output of one contained accessor is connected to the input of another contained accessor. An input port of the container accessor, with name myInputName, can also be a source of data for a contained accessor (form 2) or for an output port of the container accessor (form 4), with name myOutputName. And a contained accessor can be a source of data for an output (myOutputName) of the container accessor.

The accessor arguments (sourceAccessor and destinationAccessor) should be the JavaScript object returned by the instantiate function. The port names (outputName, inputName, myInputName, and myOutputName) are all strings.

For example:

exports.setup = function() {
    this.input('input', {'type':'number', 'value':0});
    this.output('output', {'type':'number'});
    var gain = this.instantiate('TestGain', 'test/TestGain');
    gain.setParameter('gain', 4);
    var adder = this.instantiate('TestAdder', 'test/TestAdder');
    this.connect('input', adder, 'inputLeft');
    this.connect('input', gain, 'input');
    this.connect(gain, 'scaled', adder, 'inputRight');
    this.connect(adder, 'sum', 'output');
  • Container - Accessors hosts are not required to provide access to the container

Back to Accessor Specification

Edit - History - Print - Recent Changes - Search
Page last modified on May 24, 2016, at 06:35 AM