2014-11-30 18:20:35 +00:00
|
|
|
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
|
|
|
|
*
|
2014-12-01 04:26:06 +00:00
|
|
|
* @extends {Tone.SignalBase}
|
2014-11-30 01:30:52 +00:00
|
|
|
* @constructor
|
|
|
|
*/
|
|
|
|
Tone.AudioToGain = function(){
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @type {WaveShaperNode}
|
|
|
|
* @private
|
|
|
|
*/
|
2014-11-30 18:20:35 +00:00
|
|
|
this._norm = this.input = this.output = new Tone.WaveShaper([0,1]);
|
2014-11-30 01:30:52 +00:00
|
|
|
};
|
|
|
|
|
2014-12-01 04:26:06 +00:00
|
|
|
Tone.extend(Tone.AudioToGain, Tone.SignalBase);
|
2014-11-30 18:20:35 +00:00
|
|
|
|
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;
|
|
|
|
});
|