diff --git a/Tone/component/MidSideMerge.js b/Tone/component/MidSideMerge.js index 635d7eb5..735bd81b 100644 --- a/Tone/component/MidSideMerge.js +++ b/Tone/component/MidSideMerge.js @@ -61,25 +61,12 @@ define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/signal/Expr", "Tone/compon this.side.connect(this._right, 0, 1); this._left.connect(this._merge, 0, 0); this._right.connect(this._merge, 0, 1); - sqrtTwo.connect(this._left, 0, 2); - sqrtTwo.connect(this._right, 0, 2); + this.context._sqrtTwo.connect(this._left, 0, 2); + this.context._sqrtTwo.connect(this._right, 0, 2); }; Tone.extend(Tone.MidSideMerge); - /** - * A constant signal equal to 1 / sqrt(2). - * @type {Number} - * @signal - * @private - * @static - */ - var sqrtTwo = null; - - Tone._initAudioContext(function(){ - sqrtTwo = new Tone.Signal(1 / Math.sqrt(2)); - }); - /** * clean up * @returns {Tone.MidSideMerge} this diff --git a/Tone/component/MidSideSplit.js b/Tone/component/MidSideSplit.js index 9a14c99a..96f0a473 100644 --- a/Tone/component/MidSideSplit.js +++ b/Tone/component/MidSideSplit.js @@ -43,25 +43,12 @@ define(["Tone/core/Tone", "Tone/signal/Expr", "Tone/signal/Signal", "Tone/compon this._split.connect(this.mid, 1, 1); this._split.connect(this.side, 0, 0); this._split.connect(this.side, 1, 1); - sqrtTwo.connect(this.mid, 0, 2); - sqrtTwo.connect(this.side, 0, 2); + this.context._sqrtTwo.connect(this.mid, 0, 2); + this.context._sqrtTwo.connect(this.side, 0, 2); }; Tone.extend(Tone.MidSideSplit); - /** - * a constant signal equal to 1 / sqrt(2) - * @type {Number} - * @signal - * @private - * @static - */ - var sqrtTwo = null; - - Tone._initAudioContext(function(){ - sqrtTwo = new Tone.Signal(1 / Math.sqrt(2)); - }); - /** * clean up * @returns {Tone.MidSideSplit} this diff --git a/Tone/signal/Signal.js b/Tone/signal/Signal.js index 4938f1ea..702cf5f7 100644 --- a/Tone/signal/Signal.js +++ b/Tone/signal/Signal.js @@ -41,7 +41,7 @@ define(["Tone/core/Tone", "Tone/signal/WaveShaper", "Tone/type/Type", "Tone/core this.input = this._param = this._gain.gain; //connect the const output to the node output - Tone.Signal._constant.chain(this._gain); + this.context._ones.chain(this._gain); }; Tone.extend(Tone.Signal, Tone.Param); @@ -84,35 +84,5 @@ define(["Tone/core/Tone", "Tone/signal/WaveShaper", "Tone/type/Type", "Tone/core return this; }; - /////////////////////////////////////////////////////////////////////////// - // STATIC - /////////////////////////////////////////////////////////////////////////// - - /** - * Generates a constant output of 1. - * @static - * @private - * @const - * @type {AudioBufferSourceNode} - */ - Tone.Signal._constant = null; - - /** - * initializer function - */ - Tone._initAudioContext(function(audioContext){ - var buffer = audioContext.createBuffer(1, 128, audioContext.sampleRate); - var arr = buffer.getChannelData(0); - for (var i = 0; i < arr.length; i++){ - arr[i] = 1; - } - Tone.Signal._constant = audioContext.createBufferSource(); - Tone.Signal._constant.channelCount = 1; - Tone.Signal._constant.channelCountMode = "explicit"; - Tone.Signal._constant.buffer = buffer; - Tone.Signal._constant.loop = true; - Tone.Signal._constant.start(0); - }); - return Tone.Signal; }); \ No newline at end of file