Tone.js/Tone/signal/Add.js
Yotam Mann 71af6ca206 testing dispose methods for all classes.
a few classes were not being disposed correctly and leaving some
garbage attached.
2014-09-06 18:55:11 -04:00

56 lines
No EOL
975 B
JavaScript

define(["Tone/core/Tone", "Tone/signal/Signal"], function(Tone){
"use strict";
/**
* @class Adds a value to an incoming signal
*
* @constructor
* @extends {Tone}
* @param {number} value
*/
Tone.Add = function(value){
/**
* @private
* @type {Tone}
*/
this._value = new Tone.Signal(value);
/**
* @type {GainNode}
*/
this.input = this.output = this.context.createGain();
//connections
this._value.connect(this.output);
};
Tone.extend(Tone.Add);
/**
* set the constant
*
* @param {number} value
*/
Tone.Add.prototype.setValue = function(value){
this._value.setValue(value);
};
/**
* borrows the method from {@link Tone.Signal}
*
* @function
*/
Tone.Add.prototype.connect = Tone.Signal.prototype.connect;
/**
* dispose method
*/
Tone.Add.prototype.dispose = function(){
Tone.prototype.dispose.call(this);
this._value.dispose();
this._value = null;
};
return Tone.Add;
});