Tone.js/Tone/signal/AudioToGain.js
tambien ed71d8141b amd to es6 import/export
no longer using AMD (require.js) style imports, and beginning to move to es6 "import/export" statements everywhere.
2019-01-27 13:05:20 -05:00

40 lines
836 B
JavaScript

import Tone from "../core/Tone";
import "../signal/WaveShaper";
import "../signal/Signal";
/**
* @class AudioToGain converts an input in AudioRange [-1,1] to NormalRange [0,1].
* See Tone.GainToAudio.
*
* @extends {Tone.SignalBase}
* @constructor
* @example
* var a2g = new Tone.AudioToGain();
*/
Tone.AudioToGain = function(){
Tone.SignalBase.call(this);
/**
* @type {WaveShaperNode}
* @private
*/
this._norm = this.input = this.output = new Tone.WaveShaper(function(x){
return (x + 1) / 2;
});
};
Tone.extend(Tone.AudioToGain, Tone.SignalBase);
/**
* clean up
* @returns {Tone.AudioToGain} this
*/
Tone.AudioToGain.prototype.dispose = function(){
Tone.SignalBase.prototype.dispose.call(this);
this._norm.dispose();
this._norm = null;
return this;
};
export default Tone.AudioToGain;