Version1 /
ConnectA accessor may instantiate any number of contained accessors in the body of its
There are four forms of this function:
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'); }
Back to Accessor Specification |