Tone.js/Tone/signal/GainToAudio.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

41 lines
830 B
JavaScript

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