Tone.js/Tone/signal/AudioToGain.js

34 lines
689 B
JavaScript
Raw Normal View History

define(["Tone/core/Tone", "Tone/signal/WaveShaper", "Tone/signal/Signal"], function(Tone){
2014-11-30 01:30:52 +00:00
"use strict";
/**
* @class AudioToGain converts an input range of -1,1 to 0,1
*
* @extends {Tone.SignalBase}
2014-11-30 01:30:52 +00:00
* @constructor
*/
Tone.AudioToGain = function(){
/**
* @type {WaveShaperNode}
* @private
*/
this._norm = this.input = this.output = new Tone.WaveShaper([0,1]);
2014-11-30 01:30:52 +00:00
};
Tone.extend(Tone.AudioToGain, Tone.SignalBase);
2014-11-30 01:30:52 +00:00
/**
* clean up
2015-02-02 03:56:33 +00:00
* @returns {Tone.AND} `this`
2014-11-30 01:30:52 +00:00
*/
Tone.AudioToGain.prototype.dispose = function(){
Tone.prototype.dispose.call(this);
this._norm.disconnect();
this._norm = null;
2015-02-02 03:56:33 +00:00
return this;
2014-11-30 01:30:52 +00:00
};
return Tone.AudioToGain;
});