mirror of
https://github.com/Tonejs/Tone.js
synced 2024-11-17 00:58:09 +00:00
71af6ca206
a few classes were not being disposed correctly and leaving some garbage attached.
51 lines
1.1 KiB
JavaScript
51 lines
1.1 KiB
JavaScript
define(["Tone/core/Tone", "Tone/signal/Signal"], function(Tone){
|
|
|
|
"use strict";
|
|
|
|
/**
|
|
* @class Multiply the incoming signal by some factor
|
|
*
|
|
* @constructor
|
|
* @extends {Tone}
|
|
* @param {number=} value constant value to multiple
|
|
*/
|
|
Tone.Multiply = function(value){
|
|
/**
|
|
* the input node is the same as the output node
|
|
* it is also the GainNode which handles the scaling of incoming signal
|
|
*
|
|
* @type {GainNode}
|
|
*/
|
|
this.input = this.output = this.context.createGain();
|
|
|
|
//apply the inital scale factor
|
|
this.input.gain.value = this.defaultArg(value, 1);
|
|
};
|
|
|
|
Tone.extend(Tone.Multiply);
|
|
|
|
/**
|
|
* set the constant multiple
|
|
*
|
|
* @param {number} value
|
|
*/
|
|
Tone.Multiply.prototype.setValue = function(value){
|
|
this.input.gain.value = value;
|
|
};
|
|
|
|
/**
|
|
* borrows the method from {@link Tone.Signal}
|
|
*
|
|
* @function
|
|
*/
|
|
Tone.Multiply.prototype.connect = Tone.Signal.prototype.connect;
|
|
|
|
/**
|
|
* clean up
|
|
*/
|
|
Tone.Multiply.prototype.dispose = function(){
|
|
Tone.prototype.dispose.call(this);
|
|
};
|
|
|
|
return Tone.Multiply;
|
|
});
|