mirror of
https://github.com/Tonejs/Tone.js
synced 2024-11-16 00:27:58 +00:00
classes which generate or process sound extend Tone.AudioNode
This commit is contained in:
parent
112b8081a7
commit
e6faa39dba
43 changed files with 572 additions and 571 deletions
|
@ -3,20 +3,20 @@ define(["Tone/core/Tone", "Tone/component/Envelope", "Tone/core/Gain"], function
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Tone.AmplitudeEnvelope is a Tone.Envelope connected to a gain node.
|
* @class Tone.AmplitudeEnvelope is a Tone.Envelope connected to a gain node.
|
||||||
* Unlike Tone.Envelope, which outputs the envelope's value, Tone.AmplitudeEnvelope accepts
|
* Unlike Tone.Envelope, which outputs the envelope's value, Tone.AmplitudeEnvelope accepts
|
||||||
* an audio signal as the input and will apply the envelope to the amplitude
|
* an audio signal as the input and will apply the envelope to the amplitude
|
||||||
* of the signal. Read more about ADSR Envelopes on [Wikipedia](https://en.wikipedia.org/wiki/Synthesizer#ADSR_envelope).
|
* of the signal. Read more about ADSR Envelopes on [Wikipedia](https://en.wikipedia.org/wiki/Synthesizer#ADSR_envelope).
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {Tone.Envelope}
|
* @extends {Tone.Envelope}
|
||||||
* @param {Time|Object} [attack] The amount of time it takes for the envelope to go from
|
* @param {Time|Object} [attack] The amount of time it takes for the envelope to go from
|
||||||
* 0 to it's maximum value.
|
* 0 to it's maximum value.
|
||||||
* @param {Time} [decay] The period of time after the attack that it takes for the envelope
|
* @param {Time} [decay] The period of time after the attack that it takes for the envelope
|
||||||
* to fall to the sustain value.
|
* to fall to the sustain value.
|
||||||
* @param {NormalRange} [sustain] The percent of the maximum value that the envelope rests at until
|
* @param {NormalRange} [sustain] The percent of the maximum value that the envelope rests at until
|
||||||
* the release is triggered.
|
* the release is triggered.
|
||||||
* @param {Time} [release] The amount of time after the release is triggered it takes to reach 0.
|
* @param {Time} [release] The amount of time after the release is triggered it takes to reach 0.
|
||||||
* @example
|
* @example
|
||||||
* var ampEnv = new Tone.AmplitudeEnvelope({
|
* var ampEnv = new Tone.AmplitudeEnvelope({
|
||||||
* "attack": 0.1,
|
* "attack": 0.1,
|
||||||
|
@ -50,11 +50,9 @@ define(["Tone/core/Tone", "Tone/component/Envelope", "Tone/core/Gain"], function
|
||||||
* @return {Tone.AmplitudeEnvelope} this
|
* @return {Tone.AmplitudeEnvelope} this
|
||||||
*/
|
*/
|
||||||
Tone.AmplitudeEnvelope.prototype.dispose = function(){
|
Tone.AmplitudeEnvelope.prototype.dispose = function(){
|
||||||
this.input.dispose();
|
|
||||||
this.input = null;
|
|
||||||
Tone.Envelope.prototype.dispose.call(this);
|
Tone.Envelope.prototype.dispose.call(this);
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
return Tone.AmplitudeEnvelope;
|
return Tone.AmplitudeEnvelope;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
define(["Tone/core/Tone"], function (Tone) {
|
define(["Tone/core/Tone", "Tone/core/AudioNode"], function (Tone) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ define(["Tone/core/Tone"], function (Tone) {
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
if (window.AnalyserNode && !AnalyserNode.prototype.getFloatTimeDomainData){
|
if (window.AnalyserNode && !AnalyserNode.prototype.getFloatTimeDomainData){
|
||||||
//referenced https://github.com/mohayonao/get-float-time-domain-data
|
//referenced https://github.com/mohayonao/get-float-time-domain-data
|
||||||
AnalyserNode.prototype.getFloatTimeDomainData = function(array){
|
AnalyserNode.prototype.getFloatTimeDomainData = function(array){
|
||||||
var uint8 = new Uint8Array(array.length);
|
var uint8 = new Uint8Array(array.length);
|
||||||
this.getByteTimeDomainData(uint8);
|
this.getByteTimeDomainData(uint8);
|
||||||
|
@ -19,18 +19,18 @@ define(["Tone/core/Tone"], function (Tone) {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Wrapper around the native Web Audio's
|
* @class Wrapper around the native Web Audio's
|
||||||
* [AnalyserNode](http://webaudio.github.io/web-audio-api/#idl-def-AnalyserNode).
|
* [AnalyserNode](http://webaudio.github.io/web-audio-api/#idl-def-AnalyserNode).
|
||||||
* Extracts FFT or Waveform data from the incoming signal.
|
* Extracts FFT or Waveform data from the incoming signal.
|
||||||
* @extends {Tone}
|
* @extends {Tone.AudioNode}
|
||||||
* @param {String=} type The return type of the analysis, either "fft", or "waveform".
|
* @param {String=} type The return type of the analysis, either "fft", or "waveform".
|
||||||
* @param {Number=} size The size of the FFT. Value must be a power of
|
* @param {Number=} size The size of the FFT. Value must be a power of
|
||||||
* two in the range 32 to 32768.
|
* two in the range 32 to 32768.
|
||||||
*/
|
*/
|
||||||
Tone.Analyser = function(){
|
Tone.Analyser = function(){
|
||||||
|
|
||||||
var options = Tone.defaults(arguments, ["type", "size"], Tone.Analyser);
|
var options = Tone.defaults(arguments, ["type", "size"], Tone.Analyser);
|
||||||
Tone.call(this);
|
Tone.AudioNode.call(this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The analyser node.
|
* The analyser node.
|
||||||
|
@ -58,7 +58,7 @@ define(["Tone/core/Tone"], function (Tone) {
|
||||||
this.type = options.type;
|
this.type = options.type;
|
||||||
};
|
};
|
||||||
|
|
||||||
Tone.extend(Tone.Analyser);
|
Tone.extend(Tone.Analyser, Tone.AudioNode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default values.
|
* The default values.
|
||||||
|
@ -81,8 +81,8 @@ define(["Tone/core/Tone"], function (Tone) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run the analysis given the current settings and return the
|
* Run the analysis given the current settings and return the
|
||||||
* result as a TypedArray.
|
* result as a TypedArray.
|
||||||
* @returns {TypedArray}
|
* @returns {TypedArray}
|
||||||
*/
|
*/
|
||||||
Tone.Analyser.prototype.analyse = function(){
|
Tone.Analyser.prototype.analyse = function(){
|
||||||
|
@ -111,7 +111,7 @@ define(["Tone/core/Tone"], function (Tone) {
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The analysis function returned by Tone.Analyser.analyse(), either "fft" or "waveform".
|
* The analysis function returned by Tone.Analyser.analyse(), either "fft" or "waveform".
|
||||||
* @memberOf Tone.Analyser#
|
* @memberOf Tone.Analyser#
|
||||||
* @type {String}
|
* @type {String}
|
||||||
* @name type
|
* @name type
|
||||||
|
@ -148,11 +148,11 @@ define(["Tone/core/Tone"], function (Tone) {
|
||||||
* @return {Tone.Analyser} this
|
* @return {Tone.Analyser} this
|
||||||
*/
|
*/
|
||||||
Tone.Analyser.prototype.dispose = function(){
|
Tone.Analyser.prototype.dispose = function(){
|
||||||
Tone.prototype.dispose.call(this);
|
Tone.AudioNode.prototype.dispose.call(this);
|
||||||
this._analyser.disconnect();
|
this._analyser.disconnect();
|
||||||
this._analyser = null;
|
this._analyser = null;
|
||||||
this._buffer = null;
|
this._buffer = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
return Tone.Analyser;
|
return Tone.Analyser;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
define(["Tone/core/Tone", "Tone/core/Param"], function(Tone){
|
define(["Tone/core/Tone", "Tone/core/Param", "Tone/core/AudioNode"], function(Tone){
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Tone.Compressor is a thin wrapper around the Web Audio
|
* @class Tone.Compressor is a thin wrapper around the Web Audio
|
||||||
* [DynamicsCompressorNode](http://webaudio.github.io/web-audio-api/#the-dynamicscompressornode-interface).
|
* [DynamicsCompressorNode](http://webaudio.github.io/web-audio-api/#the-dynamicscompressornode-interface).
|
||||||
* Compression reduces the volume of loud sounds or amplifies quiet sounds
|
* Compression reduces the volume of loud sounds or amplifies quiet sounds
|
||||||
* by narrowing or "compressing" an audio signal's dynamic range.
|
* by narrowing or "compressing" an audio signal's dynamic range.
|
||||||
* Read more on [Wikipedia](https://en.wikipedia.org/wiki/Dynamic_range_compression).
|
* Read more on [Wikipedia](https://en.wikipedia.org/wiki/Dynamic_range_compression).
|
||||||
*
|
*
|
||||||
* @extends {Tone}
|
* @extends {Tone.AudioNode}
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param {Decibels|Object} [threshold] The value above which the compression starts to be applied.
|
* @param {Decibels|Object} [threshold] The value above which the compression starts to be applied.
|
||||||
* @param {Positive} [ratio] The gain reduction ratio.
|
* @param {Positive} [ratio] The gain reduction ratio.
|
||||||
|
@ -19,7 +19,7 @@ define(["Tone/core/Tone", "Tone/core/Param"], function(Tone){
|
||||||
Tone.Compressor = function(){
|
Tone.Compressor = function(){
|
||||||
|
|
||||||
var options = Tone.defaults(arguments, ["threshold", "ratio"], Tone.Compressor);
|
var options = Tone.defaults(arguments, ["threshold", "ratio"], Tone.Compressor);
|
||||||
Tone.call(this);
|
Tone.AudioNode.call(this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the compressor node
|
* the compressor node
|
||||||
|
@ -34,7 +34,7 @@ define(["Tone/core/Tone", "Tone/core/Param"], function(Tone){
|
||||||
* @signal
|
* @signal
|
||||||
*/
|
*/
|
||||||
this.threshold = new Tone.Param({
|
this.threshold = new Tone.Param({
|
||||||
"param" : this._compressor.threshold,
|
"param" : this._compressor.threshold,
|
||||||
"units" : Tone.Type.Decibels,
|
"units" : Tone.Type.Decibels,
|
||||||
"convert" : false
|
"convert" : false
|
||||||
});
|
});
|
||||||
|
@ -59,7 +59,7 @@ define(["Tone/core/Tone", "Tone/core/Param"], function(Tone){
|
||||||
* @signal
|
* @signal
|
||||||
*/
|
*/
|
||||||
this.knee = new Tone.Param({
|
this.knee = new Tone.Param({
|
||||||
"param" : this._compressor.knee,
|
"param" : this._compressor.knee,
|
||||||
"units" : Tone.Type.Decibels,
|
"units" : Tone.Type.Decibels,
|
||||||
"convert" : false
|
"convert" : false
|
||||||
});
|
});
|
||||||
|
@ -70,7 +70,7 @@ define(["Tone/core/Tone", "Tone/core/Param"], function(Tone){
|
||||||
* @signal
|
* @signal
|
||||||
*/
|
*/
|
||||||
this.ratio = new Tone.Param({
|
this.ratio = new Tone.Param({
|
||||||
"param" : this._compressor.ratio,
|
"param" : this._compressor.ratio,
|
||||||
"convert" : false
|
"convert" : false
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ define(["Tone/core/Tone", "Tone/core/Param"], function(Tone){
|
||||||
this.set(options);
|
this.set(options);
|
||||||
};
|
};
|
||||||
|
|
||||||
Tone.extend(Tone.Compressor);
|
Tone.extend(Tone.Compressor, Tone.AudioNode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @static
|
* @static
|
||||||
|
@ -99,7 +99,7 @@ define(["Tone/core/Tone", "Tone/core/Param"], function(Tone){
|
||||||
* @returns {Tone.Compressor} this
|
* @returns {Tone.Compressor} this
|
||||||
*/
|
*/
|
||||||
Tone.Compressor.prototype.dispose = function(){
|
Tone.Compressor.prototype.dispose = function(){
|
||||||
Tone.prototype.dispose.call(this);
|
Tone.AudioNode.prototype.dispose.call(this);
|
||||||
this._writable(["knee", "release", "attack", "ratio", "threshold"]);
|
this._writable(["knee", "release", "attack", "ratio", "threshold"]);
|
||||||
this._compressor.disconnect();
|
this._compressor.disconnect();
|
||||||
this._compressor = null;
|
this._compressor = null;
|
||||||
|
@ -117,4 +117,4 @@ define(["Tone/core/Tone", "Tone/core/Param"], function(Tone){
|
||||||
};
|
};
|
||||||
|
|
||||||
return Tone.Compressor;
|
return Tone.Compressor;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/signal/Expr",
|
define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/signal/Expr",
|
||||||
"Tone/signal/EqualPowerGain", "Tone/core/Gain"], function(Tone){
|
"Tone/signal/EqualPowerGain", "Tone/core/Gain", "Tone/core/AudioNode"], function(Tone){
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Tone.Crossfade provides equal power fading between two inputs.
|
* @class Tone.Crossfade provides equal power fading between two inputs.
|
||||||
* More on crossfading technique [here](https://en.wikipedia.org/wiki/Fade_(audio_engineering)#Crossfading).
|
* More on crossfading technique [here](https://en.wikipedia.org/wiki/Fade_(audio_engineering)#Crossfading).
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {Tone}
|
* @extends {Tone.AudioNode}
|
||||||
* @param {NormalRange} [initialFade=0.5]
|
* @param {NormalRange} [initialFade=0.5]
|
||||||
* @example
|
* @example
|
||||||
* var crossFade = new Tone.CrossFade(0.5);
|
* var crossFade = new Tone.CrossFade(0.5);
|
||||||
|
@ -23,29 +23,29 @@ define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/signal/Expr",
|
||||||
* crossFade.fade.value = 1;
|
* crossFade.fade.value = 1;
|
||||||
* // ^ only effectB is output
|
* // ^ only effectB is output
|
||||||
* crossFade.fade.value = 0.5;
|
* crossFade.fade.value = 0.5;
|
||||||
* // ^ the two signals are mixed equally.
|
* // ^ the two signals are mixed equally.
|
||||||
*/
|
*/
|
||||||
Tone.CrossFade = function(initialFade){
|
Tone.CrossFade = function(initialFade){
|
||||||
|
|
||||||
Tone.call(this);
|
Tone.AudioNode.call(this);
|
||||||
this.createInsOuts(2, 1);
|
this.createInsOuts(2, 1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Alias for <code>input[0]</code>.
|
* Alias for <code>input[0]</code>.
|
||||||
* @type {Tone.Gain}
|
* @type {Tone.Gain}
|
||||||
*/
|
*/
|
||||||
this.a = this.input[0] = new Tone.Gain();
|
this.a = this.input[0] = new Tone.Gain();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Alias for <code>input[1]</code>.
|
* Alias for <code>input[1]</code>.
|
||||||
* @type {Tone.Gain}
|
* @type {Tone.Gain}
|
||||||
*/
|
*/
|
||||||
this.b = this.input[1] = new Tone.Gain();
|
this.b = this.input[1] = new Tone.Gain();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The mix between the two inputs. A fade value of 0
|
* The mix between the two inputs. A fade value of 0
|
||||||
* will output 100% <code>input[0]</code> and
|
* will output 100% <code>input[0]</code> and
|
||||||
* a value of 1 will output 100% <code>input[1]</code>.
|
* a value of 1 will output 100% <code>input[1]</code>.
|
||||||
* @type {NormalRange}
|
* @type {NormalRange}
|
||||||
* @signal
|
* @signal
|
||||||
*/
|
*/
|
||||||
|
@ -64,7 +64,7 @@ define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/signal/Expr",
|
||||||
* @type {Tone.EqualPowerGain}
|
* @type {Tone.EqualPowerGain}
|
||||||
*/
|
*/
|
||||||
this._equalPowerB = new Tone.EqualPowerGain();
|
this._equalPowerB = new Tone.EqualPowerGain();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* invert the incoming signal
|
* invert the incoming signal
|
||||||
* @private
|
* @private
|
||||||
|
@ -80,14 +80,14 @@ define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/signal/Expr",
|
||||||
this._readOnly("fade");
|
this._readOnly("fade");
|
||||||
};
|
};
|
||||||
|
|
||||||
Tone.extend(Tone.CrossFade);
|
Tone.extend(Tone.CrossFade, Tone.AudioNode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clean up
|
* clean up
|
||||||
* @returns {Tone.CrossFade} this
|
* @returns {Tone.CrossFade} this
|
||||||
*/
|
*/
|
||||||
Tone.CrossFade.prototype.dispose = function(){
|
Tone.CrossFade.prototype.dispose = function(){
|
||||||
Tone.prototype.dispose.call(this);
|
Tone.AudioNode.prototype.dispose.call(this);
|
||||||
this._writable("fade");
|
this._writable("fade");
|
||||||
this._equalPowerA.dispose();
|
this._equalPowerA.dispose();
|
||||||
this._equalPowerA = null;
|
this._equalPowerA = null;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
define(["Tone/core/Tone", "Tone/component/MultibandSplit", "Tone/core/Gain"], function(Tone){
|
define(["Tone/core/Tone", "Tone/component/MultibandSplit", "Tone/core/Gain", "Tone/core/AudioNode"], function(Tone){
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
@ -7,8 +7,8 @@ define(["Tone/core/Tone", "Tone/component/MultibandSplit", "Tone/core/Gain"], fu
|
||||||
* well as the low and high crossover frequencies.
|
* well as the low and high crossover frequencies.
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {Tone}
|
* @extends {Tone.AudioNode}
|
||||||
*
|
*
|
||||||
* @param {Decibels|Object} [lowLevel] The gain applied to the lows.
|
* @param {Decibels|Object} [lowLevel] The gain applied to the lows.
|
||||||
* @param {Decibels} [midLevel] The gain applied to the mid.
|
* @param {Decibels} [midLevel] The gain applied to the mid.
|
||||||
* @param {Decibels} [highLevel] The gain applied to the high.
|
* @param {Decibels} [highLevel] The gain applied to the high.
|
||||||
|
@ -18,7 +18,7 @@ define(["Tone/core/Tone", "Tone/component/MultibandSplit", "Tone/core/Gain"], fu
|
||||||
Tone.EQ3 = function(){
|
Tone.EQ3 = function(){
|
||||||
|
|
||||||
var options = Tone.defaults(arguments, ["low", "mid", "high"], Tone.EQ3);
|
var options = Tone.defaults(arguments, ["low", "mid", "high"], Tone.EQ3);
|
||||||
Tone.call(this);
|
Tone.AudioNode.call(this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the output node
|
* the output node
|
||||||
|
@ -80,21 +80,21 @@ define(["Tone/core/Tone", "Tone/component/MultibandSplit", "Tone/core/Gain"], fu
|
||||||
this.high = this._highGain.gain;
|
this.high = this._highGain.gain;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Q value for all of the filters.
|
* The Q value for all of the filters.
|
||||||
* @type {Positive}
|
* @type {Positive}
|
||||||
* @signal
|
* @signal
|
||||||
*/
|
*/
|
||||||
this.Q = this._multibandSplit.Q;
|
this.Q = this._multibandSplit.Q;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The low/mid crossover frequency.
|
* The low/mid crossover frequency.
|
||||||
* @type {Frequency}
|
* @type {Frequency}
|
||||||
* @signal
|
* @signal
|
||||||
*/
|
*/
|
||||||
this.lowFrequency = this._multibandSplit.lowFrequency;
|
this.lowFrequency = this._multibandSplit.lowFrequency;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The mid/high crossover frequency.
|
* The mid/high crossover frequency.
|
||||||
* @type {Frequency}
|
* @type {Frequency}
|
||||||
* @signal
|
* @signal
|
||||||
*/
|
*/
|
||||||
|
@ -107,7 +107,7 @@ define(["Tone/core/Tone", "Tone/component/MultibandSplit", "Tone/core/Gain"], fu
|
||||||
this._readOnly(["low", "mid", "high", "lowFrequency", "highFrequency"]);
|
this._readOnly(["low", "mid", "high", "lowFrequency", "highFrequency"]);
|
||||||
};
|
};
|
||||||
|
|
||||||
Tone.extend(Tone.EQ3);
|
Tone.extend(Tone.EQ3, Tone.AudioNode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the default values
|
* the default values
|
||||||
|
@ -125,7 +125,7 @@ define(["Tone/core/Tone", "Tone/component/MultibandSplit", "Tone/core/Gain"], fu
|
||||||
* @returns {Tone.EQ3} this
|
* @returns {Tone.EQ3} this
|
||||||
*/
|
*/
|
||||||
Tone.EQ3.prototype.dispose = function(){
|
Tone.EQ3.prototype.dispose = function(){
|
||||||
Tone.prototype.dispose.call(this);
|
Tone.AudioNode.prototype.dispose.call(this);
|
||||||
this._writable(["low", "mid", "high", "lowFrequency", "highFrequency"]);
|
this._writable(["low", "mid", "high", "lowFrequency", "highFrequency"]);
|
||||||
this._multibandSplit.dispose();
|
this._multibandSplit.dispose();
|
||||||
this._multibandSplit = null;
|
this._multibandSplit = null;
|
||||||
|
@ -145,4 +145,4 @@ define(["Tone/core/Tone", "Tone/component/MultibandSplit", "Tone/core/Gain"], fu
|
||||||
};
|
};
|
||||||
|
|
||||||
return Tone.EQ3;
|
return Tone.EQ3;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
define(["Tone/core/Tone", "Tone/signal/TimelineSignal",
|
define(["Tone/core/Tone", "Tone/signal/TimelineSignal",
|
||||||
"Tone/signal/Pow", "Tone/type/Type"], function(Tone){
|
"Tone/signal/Pow", "Tone/type/Type", "Tone/core/AudioNode"], function(Tone){
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Tone.Envelope is an [ADSR](https://en.wikipedia.org/wiki/Synthesizer#ADSR_envelope)
|
* @class Tone.Envelope is an [ADSR](https://en.wikipedia.org/wiki/Synthesizer#ADSR_envelope)
|
||||||
* envelope generator. Tone.Envelope outputs a signal which
|
* envelope generator. Tone.Envelope outputs a signal which
|
||||||
* can be connected to an AudioParam or Tone.Signal.
|
* can be connected to an AudioParam or Tone.Signal.
|
||||||
* <img src="https://upload.wikimedia.org/wikipedia/commons/e/ea/ADSR_parameter.svg">
|
* <img src="https://upload.wikimedia.org/wikipedia/commons/e/ea/ADSR_parameter.svg">
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {Tone}
|
* @extends {Tone.AudioNode}
|
||||||
* @param {Time} [attack] The amount of time it takes for the envelope to go from
|
* @param {Time} [attack] The amount of time it takes for the envelope to go from
|
||||||
* 0 to it's maximum value.
|
* 0 to it's maximum value.
|
||||||
* @param {Time} [decay] The period of time after the attack that it takes for the envelope
|
* @param {Time} [decay] The period of time after the attack that it takes for the envelope
|
||||||
* to fall to the sustain value.
|
* to fall to the sustain value.
|
||||||
* @param {NormalRange} [sustain] The percent of the maximum value that the envelope rests at until
|
* @param {NormalRange} [sustain] The percent of the maximum value that the envelope rests at until
|
||||||
* the release is triggered.
|
* the release is triggered.
|
||||||
* @param {Time} [release] The amount of time after the release is triggered it takes to reach 0.
|
* @param {Time} [release] The amount of time after the release is triggered it takes to reach 0.
|
||||||
* @example
|
* @example
|
||||||
* //an amplitude envelope
|
* //an amplitude envelope
|
||||||
* var gainNode = Tone.context.createGain();
|
* var gainNode = Tone.context.createGain();
|
||||||
|
@ -33,26 +33,26 @@ define(["Tone/core/Tone", "Tone/signal/TimelineSignal",
|
||||||
|
|
||||||
//get all of the defaults
|
//get all of the defaults
|
||||||
var options = Tone.defaults(arguments, ["attack", "decay", "sustain", "release"], Tone.Envelope);
|
var options = Tone.defaults(arguments, ["attack", "decay", "sustain", "release"], Tone.Envelope);
|
||||||
Tone.call(this);
|
Tone.AudioNode.call(this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When triggerAttack is called, the attack time is the amount of
|
* When triggerAttack is called, the attack time is the amount of
|
||||||
* time it takes for the envelope to reach it's maximum value.
|
* time it takes for the envelope to reach it's maximum value.
|
||||||
* @type {Time}
|
* @type {Time}
|
||||||
*/
|
*/
|
||||||
this.attack = options.attack;
|
this.attack = options.attack;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* After the attack portion of the envelope, the value will fall
|
* After the attack portion of the envelope, the value will fall
|
||||||
* over the duration of the decay time to it's sustain value.
|
* over the duration of the decay time to it's sustain value.
|
||||||
* @type {Time}
|
* @type {Time}
|
||||||
*/
|
*/
|
||||||
this.decay = options.decay;
|
this.decay = options.decay;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The sustain value is the value
|
* The sustain value is the value
|
||||||
* which the envelope rests at after triggerAttack is
|
* which the envelope rests at after triggerAttack is
|
||||||
* called, but before triggerRelease is invoked.
|
* called, but before triggerRelease is invoked.
|
||||||
* @type {NormalRange}
|
* @type {NormalRange}
|
||||||
*/
|
*/
|
||||||
this.sustain = options.sustain;
|
this.sustain = options.sustain;
|
||||||
|
@ -60,7 +60,7 @@ define(["Tone/core/Tone", "Tone/signal/TimelineSignal",
|
||||||
/**
|
/**
|
||||||
* After triggerRelease is called, the envelope's
|
* After triggerRelease is called, the envelope's
|
||||||
* value will fall to it's miminum value over the
|
* value will fall to it's miminum value over the
|
||||||
* duration of the release time.
|
* duration of the release time.
|
||||||
* @type {Time}
|
* @type {Time}
|
||||||
*/
|
*/
|
||||||
this.release = options.release;
|
this.release = options.release;
|
||||||
|
@ -92,7 +92,7 @@ define(["Tone/core/Tone", "Tone/signal/TimelineSignal",
|
||||||
this.releaseCurve = options.releaseCurve;
|
this.releaseCurve = options.releaseCurve;
|
||||||
};
|
};
|
||||||
|
|
||||||
Tone.extend(Tone.Envelope);
|
Tone.extend(Tone.Envelope, Tone.AudioNode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the default parameters
|
* the default parameters
|
||||||
|
@ -109,8 +109,8 @@ define(["Tone/core/Tone", "Tone/signal/TimelineSignal",
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read the current value of the envelope. Useful for
|
* Read the current value of the envelope. Useful for
|
||||||
* syncronizing visual output to the envelope.
|
* syncronizing visual output to the envelope.
|
||||||
* @memberOf Tone.Envelope#
|
* @memberOf Tone.Envelope#
|
||||||
* @type {Number}
|
* @type {Number}
|
||||||
* @name value
|
* @name value
|
||||||
|
@ -123,7 +123,7 @@ define(["Tone/core/Tone", "Tone/signal/TimelineSignal",
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The shape of the attack.
|
* The shape of the attack.
|
||||||
* Can be any of these strings:
|
* Can be any of these strings:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>linear</li>
|
* <li>linear</li>
|
||||||
|
@ -136,7 +136,7 @@ define(["Tone/core/Tone", "Tone/signal/TimelineSignal",
|
||||||
* </ul>
|
* </ul>
|
||||||
* Can also be an array which describes the curve. Values
|
* Can also be an array which describes the curve. Values
|
||||||
* in the array are evenly subdivided and linearly
|
* in the array are evenly subdivided and linearly
|
||||||
* interpolated over the duration of the attack.
|
* interpolated over the duration of the attack.
|
||||||
* @memberOf Tone.Envelope#
|
* @memberOf Tone.Envelope#
|
||||||
* @type {String|Array}
|
* @type {String|Array}
|
||||||
* @name attackCurve
|
* @name attackCurve
|
||||||
|
@ -160,7 +160,7 @@ define(["Tone/core/Tone", "Tone/signal/TimelineSignal",
|
||||||
//otherwise just return the array
|
//otherwise just return the array
|
||||||
return this._attackCurve;
|
return this._attackCurve;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
set : function(curve){
|
set : function(curve){
|
||||||
//check if it's a valid type
|
//check if it's a valid type
|
||||||
if (Tone.Envelope.Type.hasOwnProperty(curve)){
|
if (Tone.Envelope.Type.hasOwnProperty(curve)){
|
||||||
|
@ -179,7 +179,7 @@ define(["Tone/core/Tone", "Tone/signal/TimelineSignal",
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The shape of the release. See the attack curve types.
|
* The shape of the release. See the attack curve types.
|
||||||
* @memberOf Tone.Envelope#
|
* @memberOf Tone.Envelope#
|
||||||
* @type {String|Array}
|
* @type {String|Array}
|
||||||
* @name releaseCurve
|
* @name releaseCurve
|
||||||
|
@ -200,7 +200,7 @@ define(["Tone/core/Tone", "Tone/signal/TimelineSignal",
|
||||||
//otherwise just return the array
|
//otherwise just return the array
|
||||||
return this._releaseCurve;
|
return this._releaseCurve;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
set : function(curve){
|
set : function(curve){
|
||||||
//check if it's a valid type
|
//check if it's a valid type
|
||||||
if (Tone.Envelope.Type.hasOwnProperty(curve)){
|
if (Tone.Envelope.Type.hasOwnProperty(curve)){
|
||||||
|
@ -219,7 +219,7 @@ define(["Tone/core/Tone", "Tone/signal/TimelineSignal",
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Trigger the attack/decay portion of the ADSR envelope.
|
* Trigger the attack/decay portion of the ADSR envelope.
|
||||||
* @param {Time} [time=now] When the attack should start.
|
* @param {Time} [time=now] When the attack should start.
|
||||||
* @param {NormalRange} [velocity=1] The velocity of the envelope scales the vales.
|
* @param {NormalRange} [velocity=1] The velocity of the envelope scales the vales.
|
||||||
* number between 0-1
|
* number between 0-1
|
||||||
|
@ -265,10 +265,10 @@ define(["Tone/core/Tone", "Tone/signal/TimelineSignal",
|
||||||
this._sig.exponentialRampToValue(velocity * this.sustain, decay, attack + time);
|
this._sig.exponentialRampToValue(velocity * this.sustain, decay, attack + time);
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Triggers the release of the envelope.
|
* Triggers the release of the envelope.
|
||||||
* @param {Time} [time=now] When the release portion of the envelope should start.
|
* @param {Time} [time=now] When the release portion of the envelope should start.
|
||||||
* @returns {Tone.Envelope} this
|
* @returns {Tone.Envelope} this
|
||||||
* @example
|
* @example
|
||||||
* //trigger release immediately
|
* //trigger release immediately
|
||||||
|
@ -306,10 +306,10 @@ define(["Tone/core/Tone", "Tone/signal/TimelineSignal",
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* triggerAttackRelease is shorthand for triggerAttack, then waiting
|
* triggerAttackRelease is shorthand for triggerAttack, then waiting
|
||||||
* some duration, then triggerRelease.
|
* some duration, then triggerRelease.
|
||||||
* @param {Time} duration The duration of the sustain.
|
* @param {Time} duration The duration of the sustain.
|
||||||
* @param {Time} [time=now] When the attack should be triggered.
|
* @param {Time} [time=now] When the attack should be triggered.
|
||||||
* @param {number} [velocity=1] The velocity of the envelope.
|
* @param {number} [velocity=1] The velocity of the envelope.
|
||||||
* @returns {Tone.Envelope} this
|
* @returns {Tone.Envelope} this
|
||||||
* @example
|
* @example
|
||||||
* //trigger the attack and then the release after 0.6 seconds.
|
* //trigger the attack and then the release after 0.6 seconds.
|
||||||
|
@ -333,14 +333,14 @@ define(["Tone/core/Tone", "Tone/signal/TimelineSignal",
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Borrows the connect method from Tone.Signal.
|
* Borrows the connect method from Tone.Signal.
|
||||||
* @function
|
* @function
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
Tone.Envelope.prototype.connect = Tone.Signal.prototype.connect;
|
Tone.Envelope.prototype.connect = Tone.Signal.prototype.connect;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate some complex envelope curves.
|
* Generate some complex envelope curves.
|
||||||
*/
|
*/
|
||||||
(function _createCurves(){
|
(function _createCurves(){
|
||||||
|
|
||||||
|
@ -369,7 +369,7 @@ define(["Tone/core/Tone", "Tone/signal/TimelineSignal",
|
||||||
var steps = 5;
|
var steps = 5;
|
||||||
for (i = 0; i < curveLen; i++){
|
for (i = 0; i < curveLen; i++){
|
||||||
stairsCurve[i] = Math.ceil((i / (curveLen - 1)) * steps) / steps;
|
stairsCurve[i] = Math.ceil((i / (curveLen - 1)) * steps) / steps;
|
||||||
}
|
}
|
||||||
|
|
||||||
//in-out easing curve
|
//in-out easing curve
|
||||||
var sineCurve = [];
|
var sineCurve = [];
|
||||||
|
@ -444,7 +444,7 @@ define(["Tone/core/Tone", "Tone/signal/TimelineSignal",
|
||||||
* @returns {Tone.Envelope} this
|
* @returns {Tone.Envelope} this
|
||||||
*/
|
*/
|
||||||
Tone.Envelope.prototype.dispose = function(){
|
Tone.Envelope.prototype.dispose = function(){
|
||||||
Tone.prototype.dispose.call(this);
|
Tone.AudioNode.prototype.dispose.call(this);
|
||||||
this._sig.dispose();
|
this._sig.dispose();
|
||||||
this._sig = null;
|
this._sig = null;
|
||||||
this._attackCurve = null;
|
this._attackCurve = null;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
define(["Tone/core/Tone", "Tone/signal/ScaleExp", "Tone/signal/Signal",
|
define(["Tone/core/Tone", "Tone/signal/ScaleExp", "Tone/signal/Signal",
|
||||||
"Tone/core/Param", "Tone/core/Delay", "Tone/core/Gain"], function(Tone){
|
"Tone/core/Param", "Tone/core/Delay", "Tone/core/Gain", "Tone/core/AudioNode"], function(Tone){
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
@ -7,15 +7,15 @@ define(["Tone/core/Tone", "Tone/signal/ScaleExp", "Tone/signal/Signal",
|
||||||
* @class Comb filters are basic building blocks for physical modeling. Read more
|
* @class Comb filters are basic building blocks for physical modeling. Read more
|
||||||
* about comb filters on [CCRMA's website](https://ccrma.stanford.edu/~jos/pasp/Feedback_Comb_Filters.html).
|
* about comb filters on [CCRMA's website](https://ccrma.stanford.edu/~jos/pasp/Feedback_Comb_Filters.html).
|
||||||
*
|
*
|
||||||
* @extends {Tone}
|
* @extends {Tone.AudioNode}
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param {Time|Object} [delayTime] The delay time of the filter.
|
* @param {Time|Object} [delayTime] The delay time of the filter.
|
||||||
* @param {NormalRange=} resonance The amount of feedback the filter has.
|
* @param {NormalRange=} resonance The amount of feedback the filter has.
|
||||||
*/
|
*/
|
||||||
Tone.FeedbackCombFilter = function(){
|
Tone.FeedbackCombFilter = function(){
|
||||||
|
|
||||||
var options = Tone.defaults(arguments, ["delayTime", "resonance"], Tone.FeedbackCombFilter);
|
var options = Tone.defaults(arguments, ["delayTime", "resonance"], Tone.FeedbackCombFilter);
|
||||||
Tone.call(this);
|
Tone.AudioNode.call(this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the delay node
|
* the delay node
|
||||||
|
@ -25,7 +25,7 @@ define(["Tone/core/Tone", "Tone/signal/ScaleExp", "Tone/signal/Signal",
|
||||||
this._delay = this.input = this.output = new Tone.Delay(options.delayTime);
|
this._delay = this.input = this.output = new Tone.Delay(options.delayTime);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The amount of delay of the comb filter.
|
* The amount of delay of the comb filter.
|
||||||
* @type {Time}
|
* @type {Time}
|
||||||
* @signal
|
* @signal
|
||||||
*/
|
*/
|
||||||
|
@ -39,7 +39,7 @@ define(["Tone/core/Tone", "Tone/signal/ScaleExp", "Tone/signal/Signal",
|
||||||
this._feedback = new Tone.Gain(options.resonance, Tone.Type.NormalRange);
|
this._feedback = new Tone.Gain(options.resonance, Tone.Type.NormalRange);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The amount of feedback of the delayed signal.
|
* The amount of feedback of the delayed signal.
|
||||||
* @type {NormalRange}
|
* @type {NormalRange}
|
||||||
* @signal
|
* @signal
|
||||||
*/
|
*/
|
||||||
|
@ -49,7 +49,7 @@ define(["Tone/core/Tone", "Tone/signal/ScaleExp", "Tone/signal/Signal",
|
||||||
this._readOnly(["resonance", "delayTime"]);
|
this._readOnly(["resonance", "delayTime"]);
|
||||||
};
|
};
|
||||||
|
|
||||||
Tone.extend(Tone.FeedbackCombFilter);
|
Tone.extend(Tone.FeedbackCombFilter, Tone.AudioNode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the default parameters
|
* the default parameters
|
||||||
|
@ -67,7 +67,7 @@ define(["Tone/core/Tone", "Tone/signal/ScaleExp", "Tone/signal/Signal",
|
||||||
* @returns {Tone.FeedbackCombFilter} this
|
* @returns {Tone.FeedbackCombFilter} this
|
||||||
*/
|
*/
|
||||||
Tone.FeedbackCombFilter.prototype.dispose = function(){
|
Tone.FeedbackCombFilter.prototype.dispose = function(){
|
||||||
Tone.prototype.dispose.call(this);
|
Tone.AudioNode.prototype.dispose.call(this);
|
||||||
this._writable(["resonance", "delayTime"]);
|
this._writable(["resonance", "delayTime"]);
|
||||||
this._delay.dispose();
|
this._delay.dispose();
|
||||||
this._delay = null;
|
this._delay = null;
|
||||||
|
@ -79,4 +79,4 @@ define(["Tone/core/Tone", "Tone/signal/ScaleExp", "Tone/signal/Signal",
|
||||||
};
|
};
|
||||||
|
|
||||||
return Tone.FeedbackCombFilter;
|
return Tone.FeedbackCombFilter;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
define(["Tone/core/Tone", "Tone/signal/Signal"], function(Tone){
|
define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/core/AudioNode"], function(Tone){
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Tone.Filter is a filter which allows for all of the same native methods
|
* @class Tone.Filter is a filter which allows for all of the same native methods
|
||||||
* as the [BiquadFilterNode](http://webaudio.github.io/web-audio-api/#the-biquadfilternode-interface).
|
* as the [BiquadFilterNode](http://webaudio.github.io/web-audio-api/#the-biquadfilternode-interface).
|
||||||
* Tone.Filter has the added ability to set the filter rolloff at -12
|
* Tone.Filter has the added ability to set the filter rolloff at -12
|
||||||
* (default), -24 and -48.
|
* (default), -24 and -48.
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {Tone}
|
* @extends {Tone.AudioNode}
|
||||||
* @param {Frequency|Object} [frequency] The cutoff frequency of the filter.
|
* @param {Frequency|Object} [frequency] The cutoff frequency of the filter.
|
||||||
* @param {string=} type The type of filter.
|
* @param {string=} type The type of filter.
|
||||||
* @param {number=} rolloff The drop in decibels per octave after the cutoff frequency.
|
* @param {number=} rolloff The drop in decibels per octave after the cutoff frequency.
|
||||||
|
@ -20,7 +20,7 @@ define(["Tone/core/Tone", "Tone/signal/Signal"], function(Tone){
|
||||||
Tone.Filter = function(){
|
Tone.Filter = function(){
|
||||||
|
|
||||||
var options = Tone.defaults(arguments, ["frequency", "type", "rolloff"], Tone.Filter);
|
var options = Tone.defaults(arguments, ["frequency", "type", "rolloff"], Tone.Filter);
|
||||||
Tone.call(this);
|
Tone.AudioNode.call(this);
|
||||||
this.createInsOuts(1, 1);
|
this.createInsOuts(1, 1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -31,7 +31,7 @@ define(["Tone/core/Tone", "Tone/signal/Signal"], function(Tone){
|
||||||
this._filters = [];
|
this._filters = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The cutoff frequency of the filter.
|
* The cutoff frequency of the filter.
|
||||||
* @type {Frequency}
|
* @type {Frequency}
|
||||||
* @signal
|
* @signal
|
||||||
*/
|
*/
|
||||||
|
@ -50,7 +50,7 @@ define(["Tone/core/Tone", "Tone/signal/Signal"], function(Tone){
|
||||||
* @signal
|
* @signal
|
||||||
*/
|
*/
|
||||||
this.gain = new Tone.Signal({
|
this.gain = new Tone.Signal({
|
||||||
"value" : options.gain,
|
"value" : options.gain,
|
||||||
"convert" : false
|
"convert" : false
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ define(["Tone/core/Tone", "Tone/signal/Signal"], function(Tone){
|
||||||
this._readOnly(["detune", "frequency", "gain", "Q"]);
|
this._readOnly(["detune", "frequency", "gain", "Q"]);
|
||||||
};
|
};
|
||||||
|
|
||||||
Tone.extend(Tone.Filter);
|
Tone.extend(Tone.Filter, Tone.AudioNode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the default parameters
|
* the default parameters
|
||||||
|
@ -97,8 +97,8 @@ define(["Tone/core/Tone", "Tone/signal/Signal"], function(Tone){
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The type of the filter. Types: "lowpass", "highpass",
|
* The type of the filter. Types: "lowpass", "highpass",
|
||||||
* "bandpass", "lowshelf", "highshelf", "notch", "allpass", or "peaking".
|
* "bandpass", "lowshelf", "highshelf", "notch", "allpass", or "peaking".
|
||||||
* @memberOf Tone.Filter#
|
* @memberOf Tone.Filter#
|
||||||
* @type {string}
|
* @type {string}
|
||||||
* @name type
|
* @name type
|
||||||
|
@ -138,7 +138,7 @@ define(["Tone/core/Tone", "Tone/signal/Signal"], function(Tone){
|
||||||
//check the rolloff is valid
|
//check the rolloff is valid
|
||||||
if (cascadingCount === -1){
|
if (cascadingCount === -1){
|
||||||
throw new RangeError("Tone.Filter: rolloff can only be -12, -24, -48 or -96");
|
throw new RangeError("Tone.Filter: rolloff can only be -12, -24, -48 or -96");
|
||||||
}
|
}
|
||||||
cascadingCount += 1;
|
cascadingCount += 1;
|
||||||
this._rolloff = rolloff;
|
this._rolloff = rolloff;
|
||||||
//first disconnect the filters and throw them away
|
//first disconnect the filters and throw them away
|
||||||
|
@ -164,11 +164,11 @@ define(["Tone/core/Tone", "Tone/signal/Signal"], function(Tone){
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clean up.
|
* Clean up.
|
||||||
* @return {Tone.Filter} this
|
* @return {Tone.Filter} this
|
||||||
*/
|
*/
|
||||||
Tone.Filter.prototype.dispose = function(){
|
Tone.Filter.prototype.dispose = function(){
|
||||||
Tone.prototype.dispose.call(this);
|
Tone.AudioNode.prototype.dispose.call(this);
|
||||||
for (var i = 0; i < this._filters.length; i++) {
|
for (var i = 0; i < this._filters.length; i++) {
|
||||||
this._filters[i].disconnect();
|
this._filters[i].disconnect();
|
||||||
this._filters[i] = null;
|
this._filters[i] = null;
|
||||||
|
@ -187,4 +187,4 @@ define(["Tone/core/Tone", "Tone/signal/Signal"], function(Tone){
|
||||||
};
|
};
|
||||||
|
|
||||||
return Tone.Filter;
|
return Tone.Filter;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,28 +1,28 @@
|
||||||
define(["Tone/core/Tone", "Tone/signal/Abs", "Tone/signal/Subtract", "Tone/signal/Multiply",
|
define(["Tone/core/Tone", "Tone/signal/Abs", "Tone/signal/Subtract", "Tone/signal/Multiply",
|
||||||
"Tone/signal/Signal", "Tone/signal/WaveShaper", "Tone/type/Type", "Tone/core/Delay"],
|
"Tone/signal/Signal", "Tone/signal/WaveShaper", "Tone/type/Type", "Tone/core/Delay", "Tone/core/AudioNode"],
|
||||||
function(Tone){
|
function(Tone){
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Tone.Follower is a crude envelope follower which will follow
|
* @class Tone.Follower is a crude envelope follower which will follow
|
||||||
* the amplitude of an incoming signal.
|
* the amplitude of an incoming signal.
|
||||||
* Take care with small (< 0.02) attack or decay values
|
* Take care with small (< 0.02) attack or decay values
|
||||||
* as follower has some ripple which is exaggerated
|
* as follower has some ripple which is exaggerated
|
||||||
* at these values. Read more about envelope followers (also known
|
* at these values. Read more about envelope followers (also known
|
||||||
* as envelope detectors) on [Wikipedia](https://en.wikipedia.org/wiki/Envelope_detector).
|
* as envelope detectors) on [Wikipedia](https://en.wikipedia.org/wiki/Envelope_detector).
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {Tone}
|
* @extends {Tone.AudioNode}
|
||||||
* @param {Time|Object} [attack] The rate at which the follower rises.
|
* @param {Time|Object} [attack] The rate at which the follower rises.
|
||||||
* @param {Time=} release The rate at which the folower falls.
|
* @param {Time=} release The rate at which the folower falls.
|
||||||
* @example
|
* @example
|
||||||
* var follower = new Tone.Follower(0.2, 0.4);
|
* var follower = new Tone.Follower(0.2, 0.4);
|
||||||
*/
|
*/
|
||||||
Tone.Follower = function(){
|
Tone.Follower = function(){
|
||||||
|
|
||||||
var options = Tone.defaults(arguments, ["attack", "release"], Tone.Follower);
|
var options = Tone.defaults(arguments, ["attack", "release"], Tone.Follower);
|
||||||
Tone.call(this);
|
Tone.AudioNode.call(this);
|
||||||
this.createInsOuts(1, 1);
|
this.createInsOuts(1, 1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -46,7 +46,7 @@ function(Tone){
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this._frequencyValues = new Tone.WaveShaper();
|
this._frequencyValues = new Tone.WaveShaper();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {Tone.Subtract}
|
* @type {Tone.Subtract}
|
||||||
* @private
|
* @private
|
||||||
|
@ -89,21 +89,21 @@ function(Tone){
|
||||||
this._setAttackRelease(this._attack, this._release);
|
this._setAttackRelease(this._attack, this._release);
|
||||||
};
|
};
|
||||||
|
|
||||||
Tone.extend(Tone.Follower);
|
Tone.extend(Tone.Follower, Tone.AudioNode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @static
|
* @static
|
||||||
* @type {Object}
|
* @type {Object}
|
||||||
*/
|
*/
|
||||||
Tone.Follower.defaults = {
|
Tone.Follower.defaults = {
|
||||||
"attack" : 0.05,
|
"attack" : 0.05,
|
||||||
"release" : 0.5
|
"release" : 0.5
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sets the attack and release times in the wave shaper
|
* sets the attack and release times in the wave shaper
|
||||||
* @param {Time} attack
|
* @param {Time} attack
|
||||||
* @param {Time} release
|
* @param {Time} release
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
Tone.Follower.prototype._setAttackRelease = function(attack, release){
|
Tone.Follower.prototype._setAttackRelease = function(attack, release){
|
||||||
|
@ -117,7 +117,7 @@ function(Tone){
|
||||||
return attack;
|
return attack;
|
||||||
} else {
|
} else {
|
||||||
return release;
|
return release;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ function(Tone){
|
||||||
},
|
},
|
||||||
set : function(attack){
|
set : function(attack){
|
||||||
this._attack = attack;
|
this._attack = attack;
|
||||||
this._setAttackRelease(this._attack, this._release);
|
this._setAttackRelease(this._attack, this._release);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ function(Tone){
|
||||||
},
|
},
|
||||||
set : function(release){
|
set : function(release){
|
||||||
this._release = release;
|
this._release = release;
|
||||||
this._setAttackRelease(this._attack, this._release);
|
this._setAttackRelease(this._attack, this._release);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ function(Tone){
|
||||||
* @returns {Tone.Follower} this
|
* @returns {Tone.Follower} this
|
||||||
*/
|
*/
|
||||||
Tone.Follower.prototype.dispose = function(){
|
Tone.Follower.prototype.dispose = function(){
|
||||||
Tone.prototype.dispose.call(this);
|
Tone.AudioNode.prototype.dispose.call(this);
|
||||||
this._filter.disconnect();
|
this._filter.disconnect();
|
||||||
this._filter = null;
|
this._filter = null;
|
||||||
this._frequencyValues.disconnect();
|
this._frequencyValues.disconnect();
|
||||||
|
@ -183,4 +183,4 @@ function(Tone){
|
||||||
};
|
};
|
||||||
|
|
||||||
return Tone.Follower;
|
return Tone.Follower;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,28 +1,28 @@
|
||||||
define(["Tone/core/Tone", "Tone/component/Follower", "Tone/signal/GreaterThan"], function(Tone){
|
define(["Tone/core/Tone", "Tone/component/Follower", "Tone/signal/GreaterThan", "Tone/core/AudioNode"], function(Tone){
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Tone.Gate only passes a signal through when the incoming
|
* @class Tone.Gate only passes a signal through when the incoming
|
||||||
* signal exceeds a specified threshold. To do this, Gate uses
|
* signal exceeds a specified threshold. To do this, Gate uses
|
||||||
* a Tone.Follower to follow the amplitude of the incoming signal.
|
* a Tone.Follower to follow the amplitude of the incoming signal.
|
||||||
* A common implementation of this class is a [Noise Gate](https://en.wikipedia.org/wiki/Noise_gate).
|
* A common implementation of this class is a [Noise Gate](https://en.wikipedia.org/wiki/Noise_gate).
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {Tone}
|
* @extends {Tone.AudioNode}
|
||||||
* @param {Decibels|Object} [threshold] The threshold above which the gate will open.
|
* @param {Decibels|Object} [threshold] The threshold above which the gate will open.
|
||||||
* @param {Time=} attack The follower's attack time
|
* @param {Time=} attack The follower's attack time
|
||||||
* @param {Time=} release The follower's release time
|
* @param {Time=} release The follower's release time
|
||||||
* @example
|
* @example
|
||||||
* var gate = new Tone.Gate(-30, 0.2, 0.3).toMaster();
|
* var gate = new Tone.Gate(-30, 0.2, 0.3).toMaster();
|
||||||
* var mic = new Tone.UserMedia().connect(gate);
|
* var mic = new Tone.UserMedia().connect(gate);
|
||||||
* //the gate will only pass through the incoming
|
* //the gate will only pass through the incoming
|
||||||
* //signal when it's louder than -30db
|
* //signal when it's louder than -30db
|
||||||
*/
|
*/
|
||||||
Tone.Gate = function(){
|
Tone.Gate = function(){
|
||||||
|
|
||||||
var options = Tone.defaults(arguments, ["threshold", "attack", "release"], Tone.Gate);
|
var options = Tone.defaults(arguments, ["threshold", "attack", "release"], Tone.Gate);
|
||||||
Tone.call(this);
|
Tone.AudioNode.call(this);
|
||||||
this.createInsOuts(1, 1);
|
this.createInsOuts(1, 1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -43,7 +43,7 @@ define(["Tone/core/Tone", "Tone/component/Follower", "Tone/signal/GreaterThan"],
|
||||||
this.input.chain(this._gt, this._follower, this.output.gain);
|
this.input.chain(this._gt, this._follower, this.output.gain);
|
||||||
};
|
};
|
||||||
|
|
||||||
Tone.extend(Tone.Gate);
|
Tone.extend(Tone.Gate, Tone.AudioNode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @const
|
* @const
|
||||||
|
@ -51,7 +51,7 @@ define(["Tone/core/Tone", "Tone/component/Follower", "Tone/signal/GreaterThan"],
|
||||||
* @type {Object}
|
* @type {Object}
|
||||||
*/
|
*/
|
||||||
Tone.Gate.defaults = {
|
Tone.Gate.defaults = {
|
||||||
"attack" : 0.1,
|
"attack" : 0.1,
|
||||||
"release" : 0.1,
|
"release" : 0.1,
|
||||||
"threshold" : -40
|
"threshold" : -40
|
||||||
};
|
};
|
||||||
|
@ -65,7 +65,7 @@ define(["Tone/core/Tone", "Tone/component/Follower", "Tone/signal/GreaterThan"],
|
||||||
Object.defineProperty(Tone.Gate.prototype, "threshold", {
|
Object.defineProperty(Tone.Gate.prototype, "threshold", {
|
||||||
get : function(){
|
get : function(){
|
||||||
return Tone.gainToDb(this._gt.value);
|
return Tone.gainToDb(this._gt.value);
|
||||||
},
|
},
|
||||||
set : function(thresh){
|
set : function(thresh){
|
||||||
this._gt.value = Tone.dbToGain(thresh);
|
this._gt.value = Tone.dbToGain(thresh);
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ define(["Tone/core/Tone", "Tone/component/Follower", "Tone/signal/GreaterThan"],
|
||||||
Object.defineProperty(Tone.Gate.prototype, "attack", {
|
Object.defineProperty(Tone.Gate.prototype, "attack", {
|
||||||
get : function(){
|
get : function(){
|
||||||
return this._follower.attack;
|
return this._follower.attack;
|
||||||
},
|
},
|
||||||
set : function(attackTime){
|
set : function(attackTime){
|
||||||
this._follower.attack = attackTime;
|
this._follower.attack = attackTime;
|
||||||
}
|
}
|
||||||
|
@ -95,18 +95,18 @@ define(["Tone/core/Tone", "Tone/component/Follower", "Tone/signal/GreaterThan"],
|
||||||
Object.defineProperty(Tone.Gate.prototype, "release", {
|
Object.defineProperty(Tone.Gate.prototype, "release", {
|
||||||
get : function(){
|
get : function(){
|
||||||
return this._follower.release;
|
return this._follower.release;
|
||||||
},
|
},
|
||||||
set : function(releaseTime){
|
set : function(releaseTime){
|
||||||
this._follower.release = releaseTime;
|
this._follower.release = releaseTime;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clean up.
|
* Clean up.
|
||||||
* @returns {Tone.Gate} this
|
* @returns {Tone.Gate} this
|
||||||
*/
|
*/
|
||||||
Tone.Gate.prototype.dispose = function(){
|
Tone.Gate.prototype.dispose = function(){
|
||||||
Tone.prototype.dispose.call(this);
|
Tone.AudioNode.prototype.dispose.call(this);
|
||||||
this._follower.dispose();
|
this._follower.dispose();
|
||||||
this._gt.dispose();
|
this._gt.dispose();
|
||||||
this._follower = null;
|
this._follower = null;
|
||||||
|
@ -115,4 +115,4 @@ define(["Tone/core/Tone", "Tone/component/Follower", "Tone/signal/GreaterThan"],
|
||||||
};
|
};
|
||||||
|
|
||||||
return Tone.Gate;
|
return Tone.Gate;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
define(["Tone/core/Tone", "Tone/source/Oscillator", "Tone/signal/Scale",
|
define(["Tone/core/Tone", "Tone/source/Oscillator", "Tone/signal/Scale", "Tone/core/AudioNode",
|
||||||
"Tone/signal/Signal", "Tone/signal/AudioToGain", "Tone/type/Type", "Tone/signal/Zero"],
|
"Tone/signal/Signal", "Tone/signal/AudioToGain", "Tone/type/Type", "Tone/signal/Zero"],
|
||||||
function(Tone){
|
function(Tone){
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class LFO stands for low frequency oscillator. Tone.LFO produces an output signal
|
* @class LFO stands for low frequency oscillator. Tone.LFO produces an output signal
|
||||||
* which can be attached to an AudioParam or Tone.Signal
|
* which can be attached to an AudioParam or Tone.Signal
|
||||||
* in order to modulate that parameter with an oscillator. The LFO can
|
* in order to modulate that parameter with an oscillator. The LFO can
|
||||||
* also be synced to the transport to start/stop and change when the tempo changes.
|
* also be synced to the transport to start/stop and change when the tempo changes.
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {Tone}
|
* @extends {Tone.AudioNode}
|
||||||
* @param {Frequency|Object} [frequency] The frequency of the oscillation. Typically, LFOs will be
|
* @param {Frequency|Object} [frequency] The frequency of the oscillation. Typically, LFOs will be
|
||||||
* in the frequency range of 0.1 to 10 hertz.
|
* in the frequency range of 0.1 to 10 hertz.
|
||||||
* @param {number=} min The minimum output value of the LFO.
|
* @param {number=} min The minimum output value of the LFO.
|
||||||
* @param {number=} max The maximum value of the LFO.
|
* @param {number=} max The maximum value of the LFO.
|
||||||
* @example
|
* @example
|
||||||
* var lfo = new Tone.LFO("4n", 400, 4000);
|
* var lfo = new Tone.LFO("4n", 400, 4000);
|
||||||
* lfo.connect(filter.frequency);
|
* lfo.connect(filter.frequency);
|
||||||
|
@ -23,16 +23,16 @@ function(Tone){
|
||||||
Tone.LFO = function(){
|
Tone.LFO = function(){
|
||||||
|
|
||||||
var options = Tone.defaults(arguments, ["frequency", "min", "max"], Tone.LFO);
|
var options = Tone.defaults(arguments, ["frequency", "min", "max"], Tone.LFO);
|
||||||
Tone.call(this);
|
Tone.AudioNode.call(this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The oscillator.
|
* The oscillator.
|
||||||
* @type {Tone.Oscillator}
|
* @type {Tone.Oscillator}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this._oscillator = new Tone.Oscillator({
|
this._oscillator = new Tone.Oscillator({
|
||||||
"frequency" : options.frequency,
|
"frequency" : options.frequency,
|
||||||
"type" : options.type,
|
"type" : options.type,
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -44,9 +44,9 @@ function(Tone){
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The amplitude of the LFO, which controls the output range between
|
* The amplitude of the LFO, which controls the output range between
|
||||||
* the min and max output. For example if the min is -10 and the max
|
* the min and max output. For example if the min is -10 and the max
|
||||||
* is 10, setting the amplitude to 0.5 would make the LFO modulate
|
* is 10, setting the amplitude to 0.5 would make the LFO modulate
|
||||||
* between -5 and 5.
|
* between -5 and 5.
|
||||||
* @type {Number}
|
* @type {Number}
|
||||||
* @signal
|
* @signal
|
||||||
*/
|
*/
|
||||||
|
@ -76,20 +76,20 @@ function(Tone){
|
||||||
this._stoppedValue = 0;
|
this._stoppedValue = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {Tone.AudioToGain}
|
* @type {Tone.AudioToGain}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this._a2g = new Tone.AudioToGain();
|
this._a2g = new Tone.AudioToGain();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {Tone.Scale}
|
* @type {Tone.Scale}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this._scaler = this.output = new Tone.Scale(options.min, options.max);
|
this._scaler = this.output = new Tone.Scale(options.min, options.max);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the units of the LFO (used for converting)
|
* the units of the LFO (used for converting)
|
||||||
* @type {Tone.Type}
|
* @type {Tone.Type}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this._units = Tone.Type.Default;
|
this._units = Tone.Type.Default;
|
||||||
|
@ -103,7 +103,7 @@ function(Tone){
|
||||||
this.phase = options.phase;
|
this.phase = options.phase;
|
||||||
};
|
};
|
||||||
|
|
||||||
Tone.extend(Tone.LFO);
|
Tone.extend(Tone.LFO, Tone.AudioNode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the default parameters
|
* the default parameters
|
||||||
|
@ -123,7 +123,7 @@ function(Tone){
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start the LFO.
|
* Start the LFO.
|
||||||
* @param {Time} [time=now] the time the LFO will start
|
* @param {Time} [time=now] the time the LFO will start
|
||||||
* @returns {Tone.LFO} this
|
* @returns {Tone.LFO} this
|
||||||
*/
|
*/
|
||||||
|
@ -135,7 +135,7 @@ function(Tone){
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stop the LFO.
|
* Stop the LFO.
|
||||||
* @param {Time} [time=now] the time the LFO will stop
|
* @param {Time} [time=now] the time the LFO will stop
|
||||||
* @returns {Tone.LFO} this
|
* @returns {Tone.LFO} this
|
||||||
*/
|
*/
|
||||||
|
@ -147,13 +147,13 @@ function(Tone){
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sync the start/stop/pause to the transport
|
* Sync the start/stop/pause to the transport
|
||||||
* and the frequency to the bpm of the transport
|
* and the frequency to the bpm of the transport
|
||||||
* @returns {Tone.LFO} this
|
* @returns {Tone.LFO} this
|
||||||
* @example
|
* @example
|
||||||
* lfo.frequency.value = "8n";
|
* lfo.frequency.value = "8n";
|
||||||
* lfo.sync().start(0)
|
* lfo.sync().start(0)
|
||||||
* //the rate of the LFO will always be an eighth note,
|
* //the rate of the LFO will always be an eighth note,
|
||||||
* //even as the tempo changes
|
* //even as the tempo changes
|
||||||
*/
|
*/
|
||||||
Tone.LFO.prototype.sync = function(){
|
Tone.LFO.prototype.sync = function(){
|
||||||
|
@ -205,7 +205,7 @@ function(Tone){
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The type of the oscillator: sine, square, sawtooth, triangle.
|
* The type of the oscillator: sine, square, sawtooth, triangle.
|
||||||
* @memberOf Tone.LFO#
|
* @memberOf Tone.LFO#
|
||||||
* @type {string}
|
* @type {string}
|
||||||
* @name type
|
* @name type
|
||||||
|
@ -259,7 +259,7 @@ function(Tone){
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mute the output.
|
* Mute the output.
|
||||||
* @memberOf Tone.LFO#
|
* @memberOf Tone.LFO#
|
||||||
* @type {Boolean}
|
* @type {Boolean}
|
||||||
* @name mute
|
* @name mute
|
||||||
|
@ -267,7 +267,7 @@ function(Tone){
|
||||||
Object.defineProperty(Tone.LFO.prototype, "mute", {
|
Object.defineProperty(Tone.LFO.prototype, "mute", {
|
||||||
get : function(){
|
get : function(){
|
||||||
return this._oscillator.mute;
|
return this._oscillator.mute;
|
||||||
},
|
},
|
||||||
set : function(mute){
|
set : function(mute){
|
||||||
this._oscillator.mute = mute;
|
this._oscillator.mute = mute;
|
||||||
}
|
}
|
||||||
|
@ -287,10 +287,10 @@ function(Tone){
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Connect the output of the LFO to an AudioParam, AudioNode, or Tone Node.
|
* Connect the output of the LFO to an AudioParam, AudioNode, or Tone Node.
|
||||||
* Tone.LFO will automatically convert to the destination units of the
|
* Tone.LFO will automatically convert to the destination units of the
|
||||||
* will get the units from the connected node.
|
* will get the units from the connected node.
|
||||||
* @param {Tone | AudioParam | AudioNode} node
|
* @param {Tone | AudioParam | AudioNode} node
|
||||||
* @param {number} [outputNum=0] optionally which output to connect from
|
* @param {number} [outputNum=0] optionally which output to connect from
|
||||||
* @param {number} [inputNum=0] optionally which input to connect to
|
* @param {number} [inputNum=0] optionally which input to connect to
|
||||||
* @returns {Tone.LFO} this
|
* @returns {Tone.LFO} this
|
||||||
|
@ -306,7 +306,7 @@ function(Tone){
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* private method borrowed from Param converts
|
* private method borrowed from Param converts
|
||||||
* units from their destination value
|
* units from their destination value
|
||||||
* @function
|
* @function
|
||||||
* @private
|
* @private
|
||||||
|
@ -314,7 +314,7 @@ function(Tone){
|
||||||
Tone.LFO.prototype._fromUnits = Tone.Param.prototype._fromUnits;
|
Tone.LFO.prototype._fromUnits = Tone.Param.prototype._fromUnits;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* private method borrowed from Param converts
|
* private method borrowed from Param converts
|
||||||
* units to their destination value
|
* units to their destination value
|
||||||
* @function
|
* @function
|
||||||
* @private
|
* @private
|
||||||
|
@ -326,7 +326,7 @@ function(Tone){
|
||||||
* @returns {Tone.LFO} this
|
* @returns {Tone.LFO} this
|
||||||
*/
|
*/
|
||||||
Tone.LFO.prototype.dispose = function(){
|
Tone.LFO.prototype.dispose = function(){
|
||||||
Tone.prototype.dispose.call(this);
|
Tone.AudioNode.prototype.dispose.call(this);
|
||||||
this._writable(["amplitude", "frequency"]);
|
this._writable(["amplitude", "frequency"]);
|
||||||
this._oscillator.dispose();
|
this._oscillator.dispose();
|
||||||
this._oscillator = null;
|
this._oscillator = null;
|
||||||
|
@ -344,4 +344,4 @@ function(Tone){
|
||||||
};
|
};
|
||||||
|
|
||||||
return Tone.LFO;
|
return Tone.LFO;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
define(["Tone/core/Tone", "Tone/component/Compressor"], function(Tone){
|
define(["Tone/core/Tone", "Tone/component/Compressor", "Tone/core/AudioNode"], function(Tone){
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Tone.Limiter will limit the loudness of an incoming signal.
|
* @class Tone.Limiter will limit the loudness of an incoming signal.
|
||||||
* It is composed of a Tone.Compressor with a fast attack
|
* It is composed of a Tone.Compressor with a fast attack
|
||||||
* and release. Limiters are commonly used to safeguard against
|
* and release. Limiters are commonly used to safeguard against
|
||||||
* signal clipping. Unlike a compressor, limiters do not provide
|
* signal clipping. Unlike a compressor, limiters do not provide
|
||||||
* smooth gain reduction and almost completely prevent
|
* smooth gain reduction and almost completely prevent
|
||||||
* additional gain above the threshold.
|
* additional gain above the threshold.
|
||||||
*
|
*
|
||||||
* @extends {Tone}
|
* @extends {Tone.AudioNode}
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param {number} threshold The theshold above which the limiting is applied.
|
* @param {number} threshold The theshold above which the limiting is applied.
|
||||||
* @example
|
* @example
|
||||||
* var limiter = new Tone.Limiter(-6);
|
* var limiter = new Tone.Limiter(-6);
|
||||||
*/
|
*/
|
||||||
Tone.Limiter = function(){
|
Tone.Limiter = function(){
|
||||||
|
|
||||||
var options = Tone.defaults(arguments, ["threshold"], Tone.Limiter);
|
var options = Tone.defaults(arguments, ["threshold"], Tone.Limiter);
|
||||||
Tone.call(this);
|
Tone.AudioNode.call(this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the compressor
|
* the compressor
|
||||||
|
@ -42,7 +42,7 @@ define(["Tone/core/Tone", "Tone/component/Compressor"], function(Tone){
|
||||||
this._readOnly("threshold");
|
this._readOnly("threshold");
|
||||||
};
|
};
|
||||||
|
|
||||||
Tone.extend(Tone.Limiter);
|
Tone.extend(Tone.Limiter, Tone.AudioNode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default value
|
* The default value
|
||||||
|
@ -59,7 +59,7 @@ define(["Tone/core/Tone", "Tone/component/Compressor"], function(Tone){
|
||||||
* @returns {Tone.Limiter} this
|
* @returns {Tone.Limiter} this
|
||||||
*/
|
*/
|
||||||
Tone.Limiter.prototype.dispose = function(){
|
Tone.Limiter.prototype.dispose = function(){
|
||||||
Tone.prototype.dispose.call(this);
|
Tone.AudioNode.prototype.dispose.call(this);
|
||||||
this._compressor.dispose();
|
this._compressor.dispose();
|
||||||
this._compressor = null;
|
this._compressor = null;
|
||||||
this._writable("threshold");
|
this._writable("threshold");
|
||||||
|
@ -68,4 +68,4 @@ define(["Tone/core/Tone", "Tone/component/Compressor"], function(Tone){
|
||||||
};
|
};
|
||||||
|
|
||||||
return Tone.Limiter;
|
return Tone.Limiter;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/component/Filter",
|
define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/component/Filter", "Tone/core/AudioNode",
|
||||||
"Tone/core/Param", "Tone/core/Gain", "Tone/core/Delay"], function(Tone){
|
"Tone/core/Param", "Tone/core/Gain", "Tone/core/Delay"], function(Tone){
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Tone.Lowpass is a lowpass feedback comb filter. It is similar to
|
* @class Tone.Lowpass is a lowpass feedback comb filter. It is similar to
|
||||||
* Tone.FeedbackCombFilter, but includes a lowpass filter.
|
* Tone.FeedbackCombFilter, but includes a lowpass filter.
|
||||||
*
|
*
|
||||||
* @extends {Tone}
|
* @extends {Tone.AudioNode}
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param {Time|Object} [delayTime] The delay time of the comb filter
|
* @param {Time|Object} [delayTime] The delay time of the comb filter
|
||||||
* @param {NormalRange=} resonance The resonance (feedback) of the comb filter
|
* @param {NormalRange=} resonance The resonance (feedback) of the comb filter
|
||||||
* @param {Frequency=} dampening The cutoff of the lowpass filter dampens the
|
* @param {Frequency=} dampening The cutoff of the lowpass filter dampens the
|
||||||
* signal as it is fedback.
|
* signal as it is fedback.
|
||||||
*/
|
*/
|
||||||
Tone.LowpassCombFilter = function(){
|
Tone.LowpassCombFilter = function(){
|
||||||
|
|
||||||
var options = Tone.defaults(arguments, ["delayTime", "resonance", "dampening"], Tone.LowpassCombFilter);
|
var options = Tone.defaults(arguments, ["delayTime", "resonance", "dampening"], Tone.LowpassCombFilter);
|
||||||
Tone.call(this);
|
Tone.AudioNode.call(this);
|
||||||
this.createInsOuts(1, 1);
|
this.createInsOuts(1, 1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,7 +28,7 @@ define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/component/Filter",
|
||||||
this._delay = this.input = new Tone.Delay(options.delayTime);
|
this._delay = this.input = new Tone.Delay(options.delayTime);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The delayTime of the comb filter.
|
* The delayTime of the comb filter.
|
||||||
* @type {Time}
|
* @type {Time}
|
||||||
* @signal
|
* @signal
|
||||||
*/
|
*/
|
||||||
|
@ -49,7 +49,7 @@ define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/component/Filter",
|
||||||
* @signal
|
* @signal
|
||||||
*/
|
*/
|
||||||
this.dampening = new Tone.Param({
|
this.dampening = new Tone.Param({
|
||||||
"param" : this._lowpass.frequency,
|
"param" : this._lowpass.frequency,
|
||||||
"units" : Tone.Type.Frequency,
|
"units" : Tone.Type.Frequency,
|
||||||
"value" : options.dampening
|
"value" : options.dampening
|
||||||
});
|
});
|
||||||
|
@ -62,7 +62,7 @@ define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/component/Filter",
|
||||||
this._feedback = new Tone.Gain(options.resonance, Tone.Type.NormalRange);
|
this._feedback = new Tone.Gain(options.resonance, Tone.Type.NormalRange);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The amount of feedback of the delayed signal.
|
* The amount of feedback of the delayed signal.
|
||||||
* @type {NormalRange}
|
* @type {NormalRange}
|
||||||
* @signal
|
* @signal
|
||||||
*/
|
*/
|
||||||
|
@ -73,7 +73,7 @@ define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/component/Filter",
|
||||||
this._readOnly(["dampening", "resonance", "delayTime"]);
|
this._readOnly(["dampening", "resonance", "delayTime"]);
|
||||||
};
|
};
|
||||||
|
|
||||||
Tone.extend(Tone.LowpassCombFilter);
|
Tone.extend(Tone.LowpassCombFilter, Tone.AudioNode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the default parameters
|
* the default parameters
|
||||||
|
@ -88,11 +88,11 @@ define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/component/Filter",
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clean up.
|
* Clean up.
|
||||||
* @returns {Tone.LowpassCombFilter} this
|
* @returns {Tone.LowpassCombFilter} this
|
||||||
*/
|
*/
|
||||||
Tone.LowpassCombFilter.prototype.dispose = function(){
|
Tone.LowpassCombFilter.prototype.dispose = function(){
|
||||||
Tone.prototype.dispose.call(this);
|
Tone.AudioNode.prototype.dispose.call(this);
|
||||||
this._writable(["dampening", "resonance", "delayTime"]);
|
this._writable(["dampening", "resonance", "delayTime"]);
|
||||||
this.dampening.dispose();
|
this.dampening.dispose();
|
||||||
this.dampening = null;
|
this.dampening = null;
|
||||||
|
@ -109,4 +109,4 @@ define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/component/Filter",
|
||||||
};
|
};
|
||||||
|
|
||||||
return Tone.LowpassCombFilter;
|
return Tone.LowpassCombFilter;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
define(["Tone/core/Tone"], function(Tone){
|
define(["Tone/core/Tone", "Tone/core/AudioNode"], function(Tone){
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Tone.Merge brings two signals into the left and right
|
* @class Tone.Merge brings two signals into the left and right
|
||||||
* channels of a single stereo channel.
|
* channels of a single stereo channel.
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {Tone}
|
* @extends {Tone.AudioNode}
|
||||||
* @example
|
* @example
|
||||||
* var merge = new Tone.Merge().toMaster();
|
* var merge = new Tone.Merge().toMaster();
|
||||||
* //routing a sine tone in the left channel
|
* //routing a sine tone in the left channel
|
||||||
|
@ -20,7 +20,7 @@ define(["Tone/core/Tone"], function(Tone){
|
||||||
*/
|
*/
|
||||||
Tone.Merge = function(){
|
Tone.Merge = function(){
|
||||||
|
|
||||||
Tone.call(this);
|
Tone.AudioNode.call(this);
|
||||||
this.createInsOuts(2, 0);
|
this.createInsOuts(2, 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -54,14 +54,14 @@ define(["Tone/core/Tone"], function(Tone){
|
||||||
this.right.channelCountMode = "explicit";
|
this.right.channelCountMode = "explicit";
|
||||||
};
|
};
|
||||||
|
|
||||||
Tone.extend(Tone.Merge);
|
Tone.extend(Tone.Merge, Tone.AudioNode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clean up.
|
* Clean up.
|
||||||
* @returns {Tone.Merge} this
|
* @returns {Tone.Merge} this
|
||||||
*/
|
*/
|
||||||
Tone.Merge.prototype.dispose = function(){
|
Tone.Merge.prototype.dispose = function(){
|
||||||
Tone.prototype.dispose.call(this);
|
Tone.AudioNode.prototype.dispose.call(this);
|
||||||
this.left.dispose();
|
this.left.dispose();
|
||||||
this.left = null;
|
this.left = null;
|
||||||
this.right.dispose();
|
this.right.dispose();
|
||||||
|
@ -69,7 +69,7 @@ define(["Tone/core/Tone"], function(Tone){
|
||||||
this._merger.disconnect();
|
this._merger.disconnect();
|
||||||
this._merger = null;
|
this._merger = null;
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
return Tone.Merge;
|
return Tone.Merge;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
define(["Tone/core/Tone", "Tone/component/Analyser"], function(Tone){
|
define(["Tone/core/Tone", "Tone/component/Analyser", "Tone/core/AudioNode"], function(Tone){
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Tone.Meter gets the [RMS](https://en.wikipedia.org/wiki/Root_mean_square)
|
* @class Tone.Meter gets the [RMS](https://en.wikipedia.org/wiki/Root_mean_square)
|
||||||
* of an input signal with some averaging applied. It can also get the raw
|
* of an input signal with some averaging applied. It can also get the raw
|
||||||
* value of the input signal.
|
* value of the input signal.
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {Tone}
|
* @extends {Tone.AudioNode}
|
||||||
* @param {String} type Either "level" or "signal".
|
* @param {String} type Either "level" or "signal".
|
||||||
* @param {Number} smoothing The amount of smoothing applied between frames.
|
* @param {Number} smoothing The amount of smoothing applied between frames.
|
||||||
* @example
|
* @example
|
||||||
* var meter = new Tone.Meter();
|
* var meter = new Tone.Meter();
|
||||||
|
@ -22,13 +22,13 @@ define(["Tone/core/Tone", "Tone/component/Analyser"], function(Tone){
|
||||||
Tone.Meter = function(){
|
Tone.Meter = function(){
|
||||||
|
|
||||||
var options = Tone.defaults(arguments, ["type", "smoothing"], Tone.Meter);
|
var options = Tone.defaults(arguments, ["type", "smoothing"], Tone.Meter);
|
||||||
Tone.call(this);
|
Tone.AudioNode.call(this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The type of the meter, either "level" or "signal".
|
* The type of the meter, either "level" or "signal".
|
||||||
* A "level" meter will return the volume level (rms) of the
|
* A "level" meter will return the volume level (rms) of the
|
||||||
* input signal and a "signal" meter will return
|
* input signal and a "signal" meter will return
|
||||||
* the signal value of the input.
|
* the signal value of the input.
|
||||||
* @type {String}
|
* @type {String}
|
||||||
*/
|
*/
|
||||||
this.type = options.type;
|
this.type = options.type;
|
||||||
|
@ -41,7 +41,7 @@ define(["Tone/core/Tone", "Tone/component/Analyser"], function(Tone){
|
||||||
this.input = this.output = this._analyser = new Tone.Analyser("waveform", 512);
|
this.input = this.output = this._analyser = new Tone.Analyser("waveform", 512);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The amount of carryover between the current and last frame.
|
* The amount of carryover between the current and last frame.
|
||||||
* Only applied meter for "level" type.
|
* Only applied meter for "level" type.
|
||||||
* @type {Number}
|
* @type {Number}
|
||||||
*/
|
*/
|
||||||
|
@ -55,7 +55,7 @@ define(["Tone/core/Tone", "Tone/component/Analyser"], function(Tone){
|
||||||
this._lastValue = 0;
|
this._lastValue = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
Tone.extend(Tone.Meter);
|
Tone.extend(Tone.Meter, Tone.AudioNode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
|
@ -114,11 +114,11 @@ define(["Tone/core/Tone", "Tone/component/Analyser"], function(Tone){
|
||||||
* @returns {Tone.Meter} this
|
* @returns {Tone.Meter} this
|
||||||
*/
|
*/
|
||||||
Tone.Meter.prototype.dispose = function(){
|
Tone.Meter.prototype.dispose = function(){
|
||||||
Tone.prototype.dispose.call(this);
|
Tone.AudioNode.prototype.dispose.call(this);
|
||||||
this._analyser.dispose();
|
this._analyser.dispose();
|
||||||
this._analyser = null;
|
this._analyser = null;
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
return Tone.Meter;
|
return Tone.Meter;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
define(["Tone/core/Tone", "Tone/component/MidSideSplit", "Tone/component/MidSideMerge",
|
define(["Tone/core/Tone", "Tone/component/MidSideSplit", "Tone/component/MidSideMerge",
|
||||||
"Tone/component/Compressor"], function(Tone){
|
"Tone/component/Compressor", "Tone/core/AudioNode"], function(Tone){
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Tone.MidSideCompressor applies two different compressors to the mid
|
* @class Tone.MidSideCompressor applies two different compressors to the mid
|
||||||
* and side signal components. See Tone.MidSideSplit.
|
* and side signal components. See Tone.MidSideSplit.
|
||||||
*
|
*
|
||||||
* @extends {Tone}
|
* @extends {Tone.AudioNode}
|
||||||
* @param {Object} options The options that are passed to the mid and side
|
* @param {Object} options The options that are passed to the mid and side
|
||||||
* compressors.
|
* compressors.
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
Tone.MidSideCompressor = function(options){
|
Tone.MidSideCompressor = function(options){
|
||||||
|
|
||||||
Tone.call(this);
|
Tone.AudioNode.call(this);
|
||||||
options = Tone.defaultArg(options, Tone.MidSideCompressor.defaults);
|
options = Tone.defaultArg(options, Tone.MidSideCompressor.defaults);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -48,7 +48,7 @@ define(["Tone/core/Tone", "Tone/component/MidSideSplit", "Tone/component/MidSide
|
||||||
this._readOnly(["mid", "side"]);
|
this._readOnly(["mid", "side"]);
|
||||||
};
|
};
|
||||||
|
|
||||||
Tone.extend(Tone.MidSideCompressor);
|
Tone.extend(Tone.MidSideCompressor, Tone.AudioNode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @const
|
* @const
|
||||||
|
@ -77,7 +77,7 @@ define(["Tone/core/Tone", "Tone/component/MidSideSplit", "Tone/component/MidSide
|
||||||
* @returns {Tone.MidSideCompressor} this
|
* @returns {Tone.MidSideCompressor} this
|
||||||
*/
|
*/
|
||||||
Tone.MidSideCompressor.prototype.dispose = function(){
|
Tone.MidSideCompressor.prototype.dispose = function(){
|
||||||
Tone.prototype.dispose.call(this);
|
Tone.AudioNode.prototype.dispose.call(this);
|
||||||
this._writable(["mid", "side"]);
|
this._writable(["mid", "side"]);
|
||||||
this.mid.dispose();
|
this.mid.dispose();
|
||||||
this.mid = null;
|
this.mid = null;
|
||||||
|
@ -91,4 +91,4 @@ define(["Tone/core/Tone", "Tone/component/MidSideSplit", "Tone/component/MidSide
|
||||||
};
|
};
|
||||||
|
|
||||||
return Tone.MidSideCompressor;
|
return Tone.MidSideCompressor;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/signal/Expr", "Tone/component/Merge", "Tone/core/Gain"],
|
define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/signal/Expr",
|
||||||
|
"Tone/component/Merge", "Tone/core/Gain", "Tone/core/AudioNode"],
|
||||||
function(Tone){
|
function(Tone){
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Mid/Side processing separates the the 'mid' signal
|
* @class Mid/Side processing separates the the 'mid' signal
|
||||||
* (which comes out of both the left and the right channel)
|
* (which comes out of both the left and the right channel)
|
||||||
* and the 'side' (which only comes out of the the side channels).
|
* and the 'side' (which only comes out of the the side channels).
|
||||||
* MidSideMerge merges the mid and side signal after they've been seperated
|
* MidSideMerge merges the mid and side signal after they've been seperated
|
||||||
* by Tone.MidSideSplit.<br><br>
|
* by Tone.MidSideSplit.<br><br>
|
||||||
* <code>
|
* <code>
|
||||||
|
@ -14,12 +15,12 @@ define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/signal/Expr", "Tone/compon
|
||||||
* Right = (Mid-Side)/sqrt(2); // obtain right signal from mid and side<br>
|
* Right = (Mid-Side)/sqrt(2); // obtain right signal from mid and side<br>
|
||||||
* </code>
|
* </code>
|
||||||
*
|
*
|
||||||
* @extends {Tone.StereoEffect}
|
* @extends {Tone.AudioNode}
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
Tone.MidSideMerge = function(){
|
Tone.MidSideMerge = function(){
|
||||||
|
|
||||||
Tone.call(this);
|
Tone.AudioNode.call(this);
|
||||||
this.createInsOuts(2, 0);
|
this.createInsOuts(2, 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -67,14 +68,14 @@ define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/signal/Expr", "Tone/compon
|
||||||
this.context.getConstant(Math.SQRT1_2).connect(this._right, 0, 2);
|
this.context.getConstant(Math.SQRT1_2).connect(this._right, 0, 2);
|
||||||
};
|
};
|
||||||
|
|
||||||
Tone.extend(Tone.MidSideMerge);
|
Tone.extend(Tone.MidSideMerge, Tone.AudioNode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clean up
|
* clean up
|
||||||
* @returns {Tone.MidSideMerge} this
|
* @returns {Tone.MidSideMerge} this
|
||||||
*/
|
*/
|
||||||
Tone.MidSideMerge.prototype.dispose = function(){
|
Tone.MidSideMerge.prototype.dispose = function(){
|
||||||
Tone.prototype.dispose.call(this);
|
Tone.AudioNode.prototype.dispose.call(this);
|
||||||
this.mid.dispose();
|
this.mid.dispose();
|
||||||
this.mid = null;
|
this.mid = null;
|
||||||
this.side.dispose();
|
this.side.dispose();
|
||||||
|
@ -89,4 +90,4 @@ define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/signal/Expr", "Tone/compon
|
||||||
};
|
};
|
||||||
|
|
||||||
return Tone.MidSideMerge;
|
return Tone.MidSideMerge;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
define(["Tone/core/Tone", "Tone/signal/Expr", "Tone/signal/Signal", "Tone/component/Split"],
|
define(["Tone/core/Tone", "Tone/signal/Expr", "Tone/signal/Signal", "Tone/component/Split", "Tone/core/AudioNode"],
|
||||||
function(Tone){
|
function(Tone){
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Mid/Side processing separates the the 'mid' signal
|
* @class Mid/Side processing separates the the 'mid' signal
|
||||||
* (which comes out of both the left and the right channel)
|
* (which comes out of both the left and the right channel)
|
||||||
* and the 'side' (which only comes out of the the side channels). <br><br>
|
* and the 'side' (which only comes out of the the side channels). <br><br>
|
||||||
* <code>
|
* <code>
|
||||||
* Mid = (Left+Right)/sqrt(2); // obtain mid-signal from left and right<br>
|
* Mid = (Left+Right)/sqrt(2); // obtain mid-signal from left and right<br>
|
||||||
* Side = (Left-Right)/sqrt(2); // obtain side-signal from left and righ<br>
|
* Side = (Left-Right)/sqrt(2); // obtain side-signal from left and righ<br>
|
||||||
* </code>
|
* </code>
|
||||||
*
|
*
|
||||||
* @extends {Tone}
|
* @extends {Tone.AudioNode}
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
Tone.MidSideSplit = function(){
|
Tone.MidSideSplit = function(){
|
||||||
|
|
||||||
Tone.call(this);
|
Tone.AudioNode.call(this);
|
||||||
this.createInsOuts(0, 2);
|
this.createInsOuts(0, 2);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -49,14 +49,14 @@ define(["Tone/core/Tone", "Tone/signal/Expr", "Tone/signal/Signal", "Tone/compon
|
||||||
this.context.getConstant(Math.SQRT1_2).connect(this.side, 0, 2);
|
this.context.getConstant(Math.SQRT1_2).connect(this.side, 0, 2);
|
||||||
};
|
};
|
||||||
|
|
||||||
Tone.extend(Tone.MidSideSplit);
|
Tone.extend(Tone.MidSideSplit, Tone.AudioNode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clean up
|
* clean up
|
||||||
* @returns {Tone.MidSideSplit} this
|
* @returns {Tone.MidSideSplit} this
|
||||||
*/
|
*/
|
||||||
Tone.MidSideSplit.prototype.dispose = function(){
|
Tone.MidSideSplit.prototype.dispose = function(){
|
||||||
Tone.prototype.dispose.call(this);
|
Tone.AudioNode.prototype.dispose.call(this);
|
||||||
this.mid.dispose();
|
this.mid.dispose();
|
||||||
this.mid = null;
|
this.mid = null;
|
||||||
this.side.dispose();
|
this.side.dispose();
|
||||||
|
@ -67,4 +67,4 @@ define(["Tone/core/Tone", "Tone/signal/Expr", "Tone/signal/Signal", "Tone/compon
|
||||||
};
|
};
|
||||||
|
|
||||||
return Tone.MidSideSplit;
|
return Tone.MidSideSplit;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
define(["Tone/core/Tone", "Tone/component/Merge"], function(Tone){
|
define(["Tone/core/Tone", "Tone/component/Merge", "Tone/core/AudioNode"], function(Tone){
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Tone.Mono coerces the incoming mono or stereo signal into a mono signal
|
* @class Tone.Mono coerces the incoming mono or stereo signal into a mono signal
|
||||||
* where both left and right channels have the same value. This can be useful
|
* where both left and right channels have the same value. This can be useful
|
||||||
* for [stereo imaging](https://en.wikipedia.org/wiki/Stereo_imaging).
|
* for [stereo imaging](https://en.wikipedia.org/wiki/Stereo_imaging).
|
||||||
*
|
*
|
||||||
* @extends {Tone}
|
* @extends {Tone.AudioNode}
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
Tone.Mono = function(){
|
Tone.Mono = function(){
|
||||||
|
|
||||||
Tone.call(this);
|
Tone.AudioNode.call(this);
|
||||||
this.createInsOuts(1, 0);
|
this.createInsOuts(1, 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,11 +34,11 @@ define(["Tone/core/Tone", "Tone/component/Merge"], function(Tone){
|
||||||
* @returns {Tone.Mono} this
|
* @returns {Tone.Mono} this
|
||||||
*/
|
*/
|
||||||
Tone.Mono.prototype.dispose = function(){
|
Tone.Mono.prototype.dispose = function(){
|
||||||
Tone.prototype.dispose.call(this);
|
Tone.AudioNode.prototype.dispose.call(this);
|
||||||
this._merge.dispose();
|
this._merge.dispose();
|
||||||
this._merge = null;
|
this._merge = null;
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
return Tone.Mono;
|
return Tone.Mono;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
define(["Tone/core/Tone", "Tone/component/MultibandSplit", "Tone/component/Compressor"], function(Tone){
|
define(["Tone/core/Tone", "Tone/component/MultibandSplit", "Tone/component/Compressor", "Tone/core/AudioNode"], function(Tone){
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class A compressor with seperate controls over low/mid/high dynamics
|
* @class A compressor with seperate controls over low/mid/high dynamics
|
||||||
*
|
*
|
||||||
* @extends {Tone}
|
* @extends {Tone.AudioNode}
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param {Object} options The low/mid/high compressor settings.
|
* @param {Object} options The low/mid/high compressor settings.
|
||||||
* @example
|
* @example
|
||||||
|
@ -19,7 +19,7 @@ define(["Tone/core/Tone", "Tone/component/MultibandSplit", "Tone/component/Compr
|
||||||
*/
|
*/
|
||||||
Tone.MultibandCompressor = function(options){
|
Tone.MultibandCompressor = function(options){
|
||||||
|
|
||||||
Tone.call(this);
|
Tone.AudioNode.call(this);
|
||||||
options = Tone.defaultArg(arguments, Tone.MultibandCompressor.defaults);
|
options = Tone.defaultArg(arguments, Tone.MultibandCompressor.defaults);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -79,7 +79,7 @@ define(["Tone/core/Tone", "Tone/component/MultibandSplit", "Tone/component/Compr
|
||||||
this._readOnly(["high", "mid", "low", "highFrequency", "lowFrequency"]);
|
this._readOnly(["high", "mid", "low", "highFrequency", "lowFrequency"]);
|
||||||
};
|
};
|
||||||
|
|
||||||
Tone.extend(Tone.MultibandCompressor);
|
Tone.extend(Tone.MultibandCompressor, Tone.AudioNode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @const
|
* @const
|
||||||
|
@ -99,7 +99,7 @@ define(["Tone/core/Tone", "Tone/component/MultibandSplit", "Tone/component/Compr
|
||||||
* @returns {Tone.MultibandCompressor} this
|
* @returns {Tone.MultibandCompressor} this
|
||||||
*/
|
*/
|
||||||
Tone.MultibandCompressor.prototype.dispose = function(){
|
Tone.MultibandCompressor.prototype.dispose = function(){
|
||||||
Tone.prototype.dispose.call(this);
|
Tone.AudioNode.prototype.dispose.call(this);
|
||||||
this._splitter.dispose();
|
this._splitter.dispose();
|
||||||
this._writable(["high", "mid", "low", "highFrequency", "lowFrequency"]);
|
this._writable(["high", "mid", "low", "highFrequency", "lowFrequency"]);
|
||||||
this.low.dispose();
|
this.low.dispose();
|
||||||
|
@ -115,4 +115,4 @@ define(["Tone/core/Tone", "Tone/component/MultibandSplit", "Tone/component/Compr
|
||||||
};
|
};
|
||||||
|
|
||||||
return Tone.MultibandCompressor;
|
return Tone.MultibandCompressor;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
define(["Tone/core/Tone", "Tone/component/Filter", "Tone/signal/Signal", "Tone/core/Gain"], function(Tone){
|
define(["Tone/core/Tone", "Tone/component/Filter", "Tone/signal/Signal", "Tone/core/Gain", "Tone/core/AudioNode"], function(Tone){
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Split the incoming signal into three bands (low, mid, high)
|
* @class Split the incoming signal into three bands (low, mid, high)
|
||||||
* with two crossover frequency controls.
|
* with two crossover frequency controls.
|
||||||
*
|
*
|
||||||
* @extends {Tone}
|
* @extends {Tone.AudioNode}
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param {Frequency|Object} [lowFrequency] the low/mid crossover frequency
|
* @param {Frequency|Object} [lowFrequency] the low/mid crossover frequency
|
||||||
* @param {Frequency} [highFrequency] the mid/high crossover frequency
|
* @param {Frequency} [highFrequency] the mid/high crossover frequency
|
||||||
|
@ -14,7 +14,7 @@ define(["Tone/core/Tone", "Tone/component/Filter", "Tone/signal/Signal", "Tone/c
|
||||||
Tone.MultibandSplit = function(){
|
Tone.MultibandSplit = function(){
|
||||||
|
|
||||||
var options = Tone.defaults(arguments, ["lowFrequency", "highFrequency"], Tone.MultibandSplit);
|
var options = Tone.defaults(arguments, ["lowFrequency", "highFrequency"], Tone.MultibandSplit);
|
||||||
Tone.call(this);
|
Tone.AudioNode.call(this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the input
|
* the input
|
||||||
|
@ -92,7 +92,7 @@ define(["Tone/core/Tone", "Tone/component/Filter", "Tone/signal/Signal", "Tone/c
|
||||||
this._readOnly(["high", "mid", "low", "highFrequency", "lowFrequency"]);
|
this._readOnly(["high", "mid", "low", "highFrequency", "lowFrequency"]);
|
||||||
};
|
};
|
||||||
|
|
||||||
Tone.extend(Tone.MultibandSplit);
|
Tone.extend(Tone.MultibandSplit, Tone.AudioNode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
|
@ -110,7 +110,7 @@ define(["Tone/core/Tone", "Tone/component/Filter", "Tone/signal/Signal", "Tone/c
|
||||||
* @returns {Tone.MultibandSplit} this
|
* @returns {Tone.MultibandSplit} this
|
||||||
*/
|
*/
|
||||||
Tone.MultibandSplit.prototype.dispose = function(){
|
Tone.MultibandSplit.prototype.dispose = function(){
|
||||||
Tone.prototype.dispose.call(this);
|
Tone.AudioNode.prototype.dispose.call(this);
|
||||||
this._writable(["high", "mid", "low", "highFrequency", "lowFrequency"]);
|
this._writable(["high", "mid", "low", "highFrequency", "lowFrequency"]);
|
||||||
this.low.dispose();
|
this.low.dispose();
|
||||||
this.low = null;
|
this.low = null;
|
||||||
|
@ -130,4 +130,4 @@ define(["Tone/core/Tone", "Tone/component/Filter", "Tone/signal/Signal", "Tone/c
|
||||||
};
|
};
|
||||||
|
|
||||||
return Tone.MultibandSplit;
|
return Tone.MultibandSplit;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
define(["Tone/core/Tone", "Tone/component/Panner", "Tone/component/Volume"], function(Tone){
|
define(["Tone/core/Tone", "Tone/component/Panner", "Tone/component/Volume", "Tone/core/AudioNode"], function(Tone){
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Tone.PanVol is a Tone.Panner and Tone.Volume in one.
|
* @class Tone.PanVol is a Tone.Panner and Tone.Volume in one.
|
||||||
*
|
*
|
||||||
* @extends {Tone}
|
* @extends {Tone.AudioNode}
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param {AudioRange} pan the initial pan
|
* @param {AudioRange} pan the initial pan
|
||||||
* @param {number} volume The output volume.
|
* @param {number} volume The output volume.
|
||||||
|
@ -16,7 +16,7 @@ define(["Tone/core/Tone", "Tone/component/Panner", "Tone/component/Volume"], fun
|
||||||
Tone.PanVol = function(){
|
Tone.PanVol = function(){
|
||||||
|
|
||||||
var options = Tone.defaults(arguments, ["pan", "volume"], Tone.PanVol);
|
var options = Tone.defaults(arguments, ["pan", "volume"], Tone.PanVol);
|
||||||
Tone.call(this);
|
Tone.AudioNode.call(this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The panning node
|
* The panning node
|
||||||
|
@ -53,7 +53,7 @@ define(["Tone/core/Tone", "Tone/component/Panner", "Tone/component/Volume"], fun
|
||||||
this._readOnly(["pan", "volume"]);
|
this._readOnly(["pan", "volume"]);
|
||||||
};
|
};
|
||||||
|
|
||||||
Tone.extend(Tone.PanVol);
|
Tone.extend(Tone.PanVol, Tone.AudioNode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The defaults
|
* The defaults
|
||||||
|
@ -87,7 +87,7 @@ define(["Tone/core/Tone", "Tone/component/Panner", "Tone/component/Volume"], fun
|
||||||
* @returns {Tone.PanVol} this
|
* @returns {Tone.PanVol} this
|
||||||
*/
|
*/
|
||||||
Tone.PanVol.prototype.dispose = function(){
|
Tone.PanVol.prototype.dispose = function(){
|
||||||
Tone.prototype.dispose.call(this);
|
Tone.AudioNode.prototype.dispose.call(this);
|
||||||
this._writable(["pan", "volume"]);
|
this._writable(["pan", "volume"]);
|
||||||
this._panner.dispose();
|
this._panner.dispose();
|
||||||
this._panner = null;
|
this._panner = null;
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
define(["Tone/core/Tone", "Tone/component/CrossFade", "Tone/component/Merge", "Tone/component/Split",
|
define(["Tone/core/Tone", "Tone/component/CrossFade", "Tone/component/Merge", "Tone/component/Split",
|
||||||
"Tone/signal/Signal", "Tone/signal/AudioToGain", "Tone/signal/Zero"],
|
"Tone/signal/Signal", "Tone/signal/AudioToGain", "Tone/signal/Zero", "Tone/core/AudioNode"],
|
||||||
function(Tone){
|
function(Tone){
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Tone.Panner is an equal power Left/Right Panner and does not
|
* @class Tone.Panner is an equal power Left/Right Panner and does not
|
||||||
* support 3D. Panner uses the StereoPannerNode when available.
|
* support 3D. Panner uses the StereoPannerNode when available.
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {Tone}
|
* @extends {Tone.AudioNode}
|
||||||
* @param {NormalRange} [initialPan=0] The initail panner value (center).
|
* @param {NormalRange} [initialPan=0] The initail panner value (center).
|
||||||
* @example
|
* @example
|
||||||
* //pan the input signal hard right.
|
* //pan the input signal hard right.
|
||||||
* var panner = new Tone.Panner(1);
|
* var panner = new Tone.Panner(1);
|
||||||
*/
|
*/
|
||||||
Tone.Panner = function(initialPan){
|
Tone.Panner = function(initialPan){
|
||||||
|
|
||||||
Tone.call(this);
|
Tone.AudioNode.call(this);
|
||||||
if (Tone.Panner.hasStereoPanner){
|
if (Tone.Panner.hasStereoPanner){
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,12 +28,12 @@ function(Tone){
|
||||||
this._panner = this.input = this.output = this.context.createStereoPanner();
|
this._panner = this.input = this.output = this.context.createStereoPanner();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The pan control. -1 = hard left, 1 = hard right.
|
* The pan control. -1 = hard left, 1 = hard right.
|
||||||
* @type {NormalRange}
|
* @type {NormalRange}
|
||||||
* @signal
|
* @signal
|
||||||
*/
|
*/
|
||||||
this.pan = this._panner.pan;
|
this.pan = this._panner.pan;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -42,24 +42,24 @@ function(Tone){
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this._crossFade = new Tone.CrossFade();
|
this._crossFade = new Tone.CrossFade();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {Tone.Merge}
|
* @type {Tone.Merge}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this._merger = this.output = new Tone.Merge();
|
this._merger = this.output = new Tone.Merge();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {Tone.Split}
|
* @type {Tone.Split}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this._splitter = this.input = new Tone.Split();
|
this._splitter = this.input = new Tone.Split();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The pan control. -1 = hard left, 1 = hard right.
|
* The pan control. -1 = hard left, 1 = hard right.
|
||||||
* @type {AudioRange}
|
* @type {AudioRange}
|
||||||
* @signal
|
* @signal
|
||||||
*/
|
*/
|
||||||
this.pan = new Tone.Signal(0, Tone.Type.AudioRange);
|
this.pan = new Tone.Signal(0, Tone.Type.AudioRange);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -91,7 +91,7 @@ function(Tone){
|
||||||
this._readOnly("pan");
|
this._readOnly("pan");
|
||||||
};
|
};
|
||||||
|
|
||||||
Tone.extend(Tone.Panner);
|
Tone.extend(Tone.Panner, Tone.AudioNode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates if the panner is using the new StereoPannerNode internally
|
* Indicates if the panner is using the new StereoPannerNode internally
|
||||||
|
@ -107,7 +107,7 @@ function(Tone){
|
||||||
* @returns {Tone.Panner} this
|
* @returns {Tone.Panner} this
|
||||||
*/
|
*/
|
||||||
Tone.Panner.prototype.dispose = function(){
|
Tone.Panner.prototype.dispose = function(){
|
||||||
Tone.prototype.dispose.call(this);
|
Tone.AudioNode.prototype.dispose.call(this);
|
||||||
this._writable("pan");
|
this._writable("pan");
|
||||||
if (Tone.Panner.hasStereoPanner){
|
if (Tone.Panner.hasStereoPanner){
|
||||||
this._panner.disconnect();
|
this._panner.disconnect();
|
||||||
|
@ -131,4 +131,4 @@ function(Tone){
|
||||||
};
|
};
|
||||||
|
|
||||||
return Tone.Panner;
|
return Tone.Panner;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
define(["Tone/core/Tone", "Tone/component/CrossFade", "Tone/component/Merge", "Tone/component/Split",
|
define(["Tone/core/Tone", "Tone/component/CrossFade", "Tone/component/Merge", "Tone/component/Split",
|
||||||
"Tone/signal/Signal", "Tone/signal/AudioToGain", "Tone/signal/Zero"],
|
"Tone/signal/Signal", "Tone/signal/AudioToGain", "Tone/signal/Zero", "Tone/core/AudioNode"],
|
||||||
function(Tone){
|
function(Tone){
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
@ -7,9 +7,9 @@ function(Tone){
|
||||||
/**
|
/**
|
||||||
* @class A spatialized panner node which supports equalpower or HRTF panning.
|
* @class A spatialized panner node which supports equalpower or HRTF panning.
|
||||||
* Tries to normalize the API across various browsers. See Tone.Listener
|
* Tries to normalize the API across various browsers. See Tone.Listener
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {Tone}
|
* @extends {Tone.AudioNode}
|
||||||
* @param {Number} positionX The initial x position.
|
* @param {Number} positionX The initial x position.
|
||||||
* @param {Number} positionY The initial y position.
|
* @param {Number} positionY The initial y position.
|
||||||
* @param {Number} positionZ The initial z position.
|
* @param {Number} positionZ The initial z position.
|
||||||
|
@ -17,7 +17,7 @@ function(Tone){
|
||||||
Tone.Panner3D = function(){
|
Tone.Panner3D = function(){
|
||||||
|
|
||||||
var options = Tone.defaults(arguments, ["positionX", "positionY", "positionZ"], Tone.Panner3D);
|
var options = Tone.defaults(arguments, ["positionX", "positionY", "positionZ"], Tone.Panner3D);
|
||||||
Tone.call(this);
|
Tone.AudioNode.call(this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The panner node
|
* The panner node
|
||||||
|
@ -58,7 +58,7 @@ function(Tone){
|
||||||
this.positionZ = options.positionZ;
|
this.positionZ = options.positionZ;
|
||||||
};
|
};
|
||||||
|
|
||||||
Tone.extend(Tone.Panner3D);
|
Tone.extend(Tone.Panner3D, Tone.AudioNode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defaults according to the specification
|
* Defaults according to the specification
|
||||||
|
@ -91,7 +91,7 @@ function(Tone){
|
||||||
Tone.Panner3D.prototype._rampTimeConstant = 0.01;
|
Tone.Panner3D.prototype._rampTimeConstant = 0.01;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the position of the source in 3d space.
|
* Sets the position of the source in 3d space.
|
||||||
* @param {Number} x
|
* @param {Number} x
|
||||||
* @param {Number} y
|
* @param {Number} y
|
||||||
* @param {Number} z
|
* @param {Number} z
|
||||||
|
@ -111,7 +111,7 @@ function(Tone){
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the orientation of the source in 3d space.
|
* Sets the orientation of the source in 3d space.
|
||||||
* @param {Number} x
|
* @param {Number} x
|
||||||
* @param {Number} y
|
* @param {Number} y
|
||||||
* @param {Number} z
|
* @param {Number} z
|
||||||
|
@ -283,7 +283,7 @@ function(Tone){
|
||||||
Tone.Panner3D._aliasProperty("coneInnerAngle");
|
Tone.Panner3D._aliasProperty("coneInnerAngle");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The angle, in degrees, outside of which the volume will be reduced
|
* The angle, in degrees, outside of which the volume will be reduced
|
||||||
* to a constant value of coneOuterGain
|
* to a constant value of coneOuterGain
|
||||||
* @type {Degrees}
|
* @type {Degrees}
|
||||||
* @memberOf Tone.Panner3D#
|
* @memberOf Tone.Panner3D#
|
||||||
|
@ -300,7 +300,7 @@ function(Tone){
|
||||||
Tone.Panner3D._aliasProperty("coneOuterGain");
|
Tone.Panner3D._aliasProperty("coneOuterGain");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The maximum distance between source and listener,
|
* The maximum distance between source and listener,
|
||||||
* after which the volume will not be reduced any further.
|
* after which the volume will not be reduced any further.
|
||||||
* @type {Positive}
|
* @type {Positive}
|
||||||
* @memberOf Tone.Panner3D#
|
* @memberOf Tone.Panner3D#
|
||||||
|
@ -313,6 +313,7 @@ function(Tone){
|
||||||
* @returns {Tone.Panner3D} this
|
* @returns {Tone.Panner3D} this
|
||||||
*/
|
*/
|
||||||
Tone.Panner3D.prototype.dispose = function(){
|
Tone.Panner3D.prototype.dispose = function(){
|
||||||
|
Tone.AudioNode.prototype.dispose.call(this);
|
||||||
this._panner.disconnect();
|
this._panner.disconnect();
|
||||||
this._panner = null;
|
this._panner = null;
|
||||||
this._orientation = null;
|
this._orientation = null;
|
||||||
|
@ -321,4 +322,4 @@ function(Tone){
|
||||||
};
|
};
|
||||||
|
|
||||||
return Tone.Panner3D;
|
return Tone.Panner3D;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
define(["Tone/core/Tone", "Tone/core/Gain"], function (Tone) {
|
define(["Tone/core/Tone", "Tone/core/Gain", "Tone/core/AudioNode"], function (Tone) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Tone.Solo lets you isolate a specific audio stream. When
|
* @class Tone.Solo lets you isolate a specific audio stream. When
|
||||||
* an instance is set to `solo=true`, it will mute all other instances.
|
* an instance is set to `solo=true`, it will mute all other instances.
|
||||||
* @extends {Tone}
|
* @extends {Tone.AudioNode}
|
||||||
* @example
|
* @example
|
||||||
* var soloA = new Tone.Solo()
|
* var soloA = new Tone.Solo()
|
||||||
* var soloB = new Tone.Solo()
|
* var soloB = new Tone.Solo()
|
||||||
|
@ -13,7 +13,7 @@ define(["Tone/core/Tone", "Tone/core/Gain"], function (Tone) {
|
||||||
Tone.Solo = function(){
|
Tone.Solo = function(){
|
||||||
|
|
||||||
var options = Tone.defaults(arguments, ["solo"], Tone.Solo);
|
var options = Tone.defaults(arguments, ["solo"], Tone.Solo);
|
||||||
Tone.call(this);
|
Tone.AudioNode.call(this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The input and output node
|
* The input and output node
|
||||||
|
@ -34,7 +34,7 @@ define(["Tone/core/Tone", "Tone/core/Gain"], function (Tone) {
|
||||||
this.solo = options.solo;
|
this.solo = options.solo;
|
||||||
};
|
};
|
||||||
|
|
||||||
Tone.extend(Tone.Solo);
|
Tone.extend(Tone.Solo, Tone.AudioNode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The defaults
|
* The defaults
|
||||||
|
@ -144,10 +144,10 @@ define(["Tone/core/Tone", "Tone/core/Gain"], function (Tone) {
|
||||||
* @return {Tone.Solo} this
|
* @return {Tone.Solo} this
|
||||||
*/
|
*/
|
||||||
Tone.Solo.prototype.dispose = function(){
|
Tone.Solo.prototype.dispose = function(){
|
||||||
Tone.prototype.dispose.call(this);
|
|
||||||
this.context.off("solo", this._soloBind);
|
this.context.off("solo", this._soloBind);
|
||||||
this._removeSolo();
|
this._removeSolo();
|
||||||
this._soloBind = null;
|
this._soloBind = null;
|
||||||
|
Tone.AudioNode.prototype.dispose.call(this);
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
define(["Tone/core/Tone", "Tone/core/Gain"], function(Tone){
|
define(["Tone/core/Tone", "Tone/core/Gain", "Tone/core/AudioNode"], function(Tone){
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Tone.Split splits an incoming signal into left and right channels.
|
* @class Tone.Split splits an incoming signal into left and right channels.
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {Tone}
|
* @extends {Tone.AudioNode}
|
||||||
* @example
|
* @example
|
||||||
* var split = new Tone.Split();
|
* var split = new Tone.Split();
|
||||||
* stereoSignal.connect(split);
|
* stereoSignal.connect(split);
|
||||||
*/
|
*/
|
||||||
Tone.Split = function(){
|
Tone.Split = function(){
|
||||||
|
|
||||||
Tone.call(this);
|
Tone.AudioNode.call(this);
|
||||||
this.createInsOuts(0, 2);
|
this.createInsOuts(0, 2);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {ChannelSplitterNode}
|
* @type {ChannelSplitterNode}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
|
@ -24,8 +24,8 @@ define(["Tone/core/Tone", "Tone/core/Gain"], function(Tone){
|
||||||
this._splitter.channelCount = 2;
|
this._splitter.channelCount = 2;
|
||||||
this._splitter.channelCountMode = "explicit";
|
this._splitter.channelCountMode = "explicit";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Left channel output.
|
* Left channel output.
|
||||||
* Alias for <code>output[0]</code>
|
* Alias for <code>output[0]</code>
|
||||||
* @type {Tone.Gain}
|
* @type {Tone.Gain}
|
||||||
*/
|
*/
|
||||||
|
@ -37,20 +37,20 @@ define(["Tone/core/Tone", "Tone/core/Gain"], function(Tone){
|
||||||
* @type {Tone.Gain}
|
* @type {Tone.Gain}
|
||||||
*/
|
*/
|
||||||
this.right = this.output[1] = new Tone.Gain();
|
this.right = this.output[1] = new Tone.Gain();
|
||||||
|
|
||||||
//connections
|
//connections
|
||||||
this._splitter.connect(this.left, 0, 0);
|
this._splitter.connect(this.left, 0, 0);
|
||||||
this._splitter.connect(this.right, 1, 0);
|
this._splitter.connect(this.right, 1, 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
Tone.extend(Tone.Split);
|
Tone.extend(Tone.Split, Tone.AudioNode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clean up.
|
* Clean up.
|
||||||
* @returns {Tone.Split} this
|
* @returns {Tone.Split} this
|
||||||
*/
|
*/
|
||||||
Tone.Split.prototype.dispose = function(){
|
Tone.Split.prototype.dispose = function(){
|
||||||
Tone.prototype.dispose.call(this);
|
Tone.AudioNode.prototype.dispose.call(this);
|
||||||
this._splitter.disconnect();
|
this._splitter.disconnect();
|
||||||
this.left.dispose();
|
this.left.dispose();
|
||||||
this.left = null;
|
this.left = null;
|
||||||
|
@ -58,7 +58,7 @@ define(["Tone/core/Tone", "Tone/core/Gain"], function(Tone){
|
||||||
this.right = null;
|
this.right = null;
|
||||||
this._splitter = null;
|
this._splitter = null;
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
return Tone.Split;
|
return Tone.Split;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/core/Gain"], function(Tone){
|
define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/core/Gain", "Tone/core/AudioNode"], function(Tone){
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Tone.Volume is a simple volume node, useful for creating a volume fader.
|
* @class Tone.Volume is a simple volume node, useful for creating a volume fader.
|
||||||
*
|
*
|
||||||
* @extends {Tone}
|
* @extends {Tone.AudioNode}
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param {Decibels} [volume=0] the initial volume
|
* @param {Decibels} [volume=0] the initial volume
|
||||||
* @example
|
* @example
|
||||||
|
@ -15,7 +15,7 @@ define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/core/Gain"], function(Tone
|
||||||
Tone.Volume = function(){
|
Tone.Volume = function(){
|
||||||
|
|
||||||
var options = Tone.defaults(arguments, ["volume"], Tone.Volume);
|
var options = Tone.defaults(arguments, ["volume"], Tone.Volume);
|
||||||
Tone.call(this);
|
Tone.AudioNode.call(this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the output node
|
* the output node
|
||||||
|
@ -32,7 +32,7 @@ define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/core/Gain"], function(Tone
|
||||||
this._unmutedVolume = options.volume;
|
this._unmutedVolume = options.volume;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The volume control in decibels.
|
* The volume control in decibels.
|
||||||
* @type {Decibels}
|
* @type {Decibels}
|
||||||
* @signal
|
* @signal
|
||||||
*/
|
*/
|
||||||
|
@ -44,7 +44,7 @@ define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/core/Gain"], function(Tone
|
||||||
this.mute = options.mute;
|
this.mute = options.mute;
|
||||||
};
|
};
|
||||||
|
|
||||||
Tone.extend(Tone.Volume);
|
Tone.extend(Tone.Volume, Tone.AudioNode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defaults
|
* Defaults
|
||||||
|
@ -58,7 +58,7 @@ define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/core/Gain"], function(Tone
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mute the output.
|
* Mute the output.
|
||||||
* @memberOf Tone.Volume#
|
* @memberOf Tone.Volume#
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
* @name mute
|
* @name mute
|
||||||
|
@ -69,7 +69,7 @@ define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/core/Gain"], function(Tone
|
||||||
Object.defineProperty(Tone.Volume.prototype, "mute", {
|
Object.defineProperty(Tone.Volume.prototype, "mute", {
|
||||||
get : function(){
|
get : function(){
|
||||||
return this.volume.value === -Infinity;
|
return this.volume.value === -Infinity;
|
||||||
},
|
},
|
||||||
set : function(mute){
|
set : function(mute){
|
||||||
if (!this.mute && mute){
|
if (!this.mute && mute){
|
||||||
this._unmutedVolume = this.volume.value;
|
this._unmutedVolume = this.volume.value;
|
||||||
|
@ -87,7 +87,7 @@ define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/core/Gain"], function(Tone
|
||||||
*/
|
*/
|
||||||
Tone.Volume.prototype.dispose = function(){
|
Tone.Volume.prototype.dispose = function(){
|
||||||
this.input.dispose();
|
this.input.dispose();
|
||||||
Tone.prototype.dispose.call(this);
|
Tone.AudioNode.prototype.dispose.call(this);
|
||||||
this._writable("volume");
|
this._writable("volume");
|
||||||
this.volume.dispose();
|
this.volume.dispose();
|
||||||
this.volume = null;
|
this.volume = null;
|
||||||
|
@ -95,4 +95,4 @@ define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/core/Gain"], function(Tone
|
||||||
};
|
};
|
||||||
|
|
||||||
return Tone.Volume;
|
return Tone.Volume;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
define(["Tone/core/Tone", "Tone/core/Param"], function (Tone) {
|
define(["Tone/core/Tone", "Tone/core/Param", "Tone/core/AudioNode"], function (Tone) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
@ -11,15 +11,15 @@ define(["Tone/core/Tone", "Tone/core/Param"], function (Tone) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Wrapper around Web Audio's native [DelayNode](http://webaudio.github.io/web-audio-api/#the-delaynode-interface).
|
* @class Wrapper around Web Audio's native [DelayNode](http://webaudio.github.io/web-audio-api/#the-delaynode-interface).
|
||||||
* @extends {Tone}
|
* @extends {Tone}
|
||||||
* @param {Time=} delayTime The delay applied to the incoming signal.
|
* @param {Time=} delayTime The delay applied to the incoming signal.
|
||||||
* @param {Time=} maxDelay The maximum delay time.
|
* @param {Time=} maxDelay The maximum delay time.
|
||||||
*/
|
*/
|
||||||
Tone.Delay = function(){
|
Tone.Delay = function(){
|
||||||
|
|
||||||
var options = Tone.defaults(arguments, ["delayTime", "maxDelay"], Tone.Delay);
|
var options = Tone.defaults(arguments, ["delayTime", "maxDelay"], Tone.Delay);
|
||||||
Tone.call(this);
|
Tone.AudioNode.call(this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The native delay node
|
* The native delay node
|
||||||
|
@ -30,7 +30,7 @@ define(["Tone/core/Tone", "Tone/core/Param"], function (Tone) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The amount of time the incoming signal is
|
* The amount of time the incoming signal is
|
||||||
* delayed.
|
* delayed.
|
||||||
* @type {Time}
|
* @type {Time}
|
||||||
* @signal
|
* @signal
|
||||||
*/
|
*/
|
||||||
|
@ -43,7 +43,7 @@ define(["Tone/core/Tone", "Tone/core/Param"], function (Tone) {
|
||||||
this._readOnly("delayTime");
|
this._readOnly("delayTime");
|
||||||
};
|
};
|
||||||
|
|
||||||
Tone.extend(Tone.Delay);
|
Tone.extend(Tone.Delay, Tone.AudioNode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The defaults
|
* The defaults
|
||||||
|
@ -54,19 +54,19 @@ define(["Tone/core/Tone", "Tone/core/Param"], function (Tone) {
|
||||||
"maxDelay" : 1,
|
"maxDelay" : 1,
|
||||||
"delayTime" : 0
|
"delayTime" : 0
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clean up.
|
* Clean up.
|
||||||
* @return {Tone.Delay} this
|
* @return {Tone.Delay} this
|
||||||
*/
|
*/
|
||||||
Tone.Delay.prototype.dispose = function(){
|
Tone.Delay.prototype.dispose = function(){
|
||||||
Tone.Param.prototype.dispose.call(this);
|
Tone.AudioNode.prototype.dispose.call(this);
|
||||||
this._delayNode.disconnect();
|
this._delayNode.disconnect();
|
||||||
this._delayNode = null;
|
this._delayNode = null;
|
||||||
this._writable("delayTime");
|
this._writable("delayTime");
|
||||||
this.delayTime = null;
|
this.delayTime = null;
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
return Tone.Delay;
|
return Tone.Delay;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
define(["Tone/core/Tone", "Tone/core/Param", "Tone/type/Type"], function (Tone) {
|
define(["Tone/core/Tone", "Tone/core/Param", "Tone/type/Type", "Tone/core/AudioNode"], function (Tone) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ define(["Tone/core/Tone", "Tone/core/Param", "Tone/type/Type"], function (Tone)
|
||||||
Tone.Gain = function(){
|
Tone.Gain = function(){
|
||||||
|
|
||||||
var options = Tone.defaults(arguments, ["gain", "units"], Tone.Gain);
|
var options = Tone.defaults(arguments, ["gain", "units"], Tone.Gain);
|
||||||
Tone.call(this);
|
Tone.AudioNode.call(this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The GainNode
|
* The GainNode
|
||||||
|
@ -44,7 +44,7 @@ define(["Tone/core/Tone", "Tone/core/Param", "Tone/type/Type"], function (Tone)
|
||||||
this._readOnly("gain");
|
this._readOnly("gain");
|
||||||
};
|
};
|
||||||
|
|
||||||
Tone.extend(Tone.Gain);
|
Tone.extend(Tone.Gain, Tone.AudioNode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The defaults
|
* The defaults
|
||||||
|
@ -61,7 +61,7 @@ define(["Tone/core/Tone", "Tone/core/Param", "Tone/type/Type"], function (Tone)
|
||||||
* @return {Tone.Gain} this
|
* @return {Tone.Gain} this
|
||||||
*/
|
*/
|
||||||
Tone.Gain.prototype.dispose = function(){
|
Tone.Gain.prototype.dispose = function(){
|
||||||
Tone.Param.prototype.dispose.call(this);
|
Tone.AudioNode.prototype.dispose.call(this);
|
||||||
this._gainNode.disconnect();
|
this._gainNode.disconnect();
|
||||||
this._gainNode = null;
|
this._gainNode = null;
|
||||||
this._writable("gain");
|
this._writable("gain");
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
define(["Tone/core/Tone", "Tone/component/Volume", "Tone/core/Context"], function(Tone){
|
define(["Tone/core/Tone", "Tone/component/Volume", "Tone/core/Context", "Tone/core/AudioNode"], function(Tone){
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class A single master output which is connected to the
|
* @class A single master output which is connected to the
|
||||||
* AudioDestinationNode (aka your speakers).
|
* AudioDestinationNode (aka your speakers).
|
||||||
* It provides useful conveniences such as the ability
|
* It provides useful conveniences such as the ability
|
||||||
* to set the volume and mute the entire application.
|
* to set the volume and mute the entire application.
|
||||||
* It also gives you the ability to apply master effects to your application.
|
* It also gives you the ability to apply master effects to your application.
|
||||||
* <br><br>
|
* <br><br>
|
||||||
* Like Tone.Transport, A single Tone.Master is created
|
* Like Tone.Transport, A single Tone.Master is created
|
||||||
* on initialization and you do not need to explicitly construct one.
|
* on initialization and you do not need to explicitly construct one.
|
||||||
|
@ -23,8 +23,8 @@ define(["Tone/core/Tone", "Tone/component/Volume", "Tone/core/Context"], functio
|
||||||
* //the above two examples are equivalent.
|
* //the above two examples are equivalent.
|
||||||
*/
|
*/
|
||||||
Tone.Master = function(){
|
Tone.Master = function(){
|
||||||
|
|
||||||
Tone.call(this);
|
Tone.AudioNode.call(this);
|
||||||
Tone.getContext(function(){
|
Tone.getContext(function(){
|
||||||
this.createInsOuts(1, 0);
|
this.createInsOuts(1, 0);
|
||||||
|
|
||||||
|
@ -41,14 +41,14 @@ define(["Tone/core/Tone", "Tone/component/Volume", "Tone/core/Context"], functio
|
||||||
* @signal
|
* @signal
|
||||||
*/
|
*/
|
||||||
this.volume = this._volume.volume;
|
this.volume = this._volume.volume;
|
||||||
|
|
||||||
this._readOnly("volume");
|
this._readOnly("volume");
|
||||||
//connections
|
//connections
|
||||||
this.input.chain(this.output, this.context.destination);
|
this.input.chain(this.output, this.context.destination);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
};
|
};
|
||||||
|
|
||||||
Tone.extend(Tone.Master);
|
Tone.extend(Tone.Master, Tone.AudioNode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {Object}
|
* @type {Object}
|
||||||
|
@ -60,7 +60,7 @@ define(["Tone/core/Tone", "Tone/component/Volume", "Tone/core/Context"], functio
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mute the output.
|
* Mute the output.
|
||||||
* @memberOf Tone.Master#
|
* @memberOf Tone.Master#
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
* @name mute
|
* @name mute
|
||||||
|
@ -71,15 +71,15 @@ define(["Tone/core/Tone", "Tone/component/Volume", "Tone/core/Context"], functio
|
||||||
Object.defineProperty(Tone.Master.prototype, "mute", {
|
Object.defineProperty(Tone.Master.prototype, "mute", {
|
||||||
get : function(){
|
get : function(){
|
||||||
return this._volume.mute;
|
return this._volume.mute;
|
||||||
},
|
},
|
||||||
set : function(mute){
|
set : function(mute){
|
||||||
this._volume.mute = mute;
|
this._volume.mute = mute;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a master effects chain. NOTE: this will disconnect any nodes which were previously
|
* Add a master effects chain. NOTE: this will disconnect any nodes which were previously
|
||||||
* chained in the master effects chain.
|
* chained in the master effects chain.
|
||||||
* @param {AudioNode|Tone} args... All arguments will be connected in a row
|
* @param {AudioNode|Tone} args... All arguments will be connected in a row
|
||||||
* and the Master will be routed through it.
|
* and the Master will be routed through it.
|
||||||
* @return {Tone.Master} this
|
* @return {Tone.Master} this
|
||||||
|
@ -93,7 +93,7 @@ define(["Tone/core/Tone", "Tone/component/Volume", "Tone/core/Context"], functio
|
||||||
* });
|
* });
|
||||||
* //give a little boost to the lows
|
* //give a little boost to the lows
|
||||||
* var lowBump = new Tone.Filter(200, "lowshelf");
|
* var lowBump = new Tone.Filter(200, "lowshelf");
|
||||||
* //route everything through the filter
|
* //route everything through the filter
|
||||||
* //and compressor before going to the speakers
|
* //and compressor before going to the speakers
|
||||||
* Tone.Master.chain(lowBump, masterCompressor);
|
* Tone.Master.chain(lowBump, masterCompressor);
|
||||||
*/
|
*/
|
||||||
|
@ -108,7 +108,7 @@ define(["Tone/core/Tone", "Tone/component/Volume", "Tone/core/Context"], functio
|
||||||
* @return {Tone.Master} this
|
* @return {Tone.Master} this
|
||||||
*/
|
*/
|
||||||
Tone.Master.prototype.dispose = function(){
|
Tone.Master.prototype.dispose = function(){
|
||||||
Tone.prototype.dispose.call(this);
|
Tone.AudioNode.prototype.dispose.call(this);
|
||||||
this._writable("volume");
|
this._writable("volume");
|
||||||
this._volume.dispose();
|
this._volume.dispose();
|
||||||
this._volume = null;
|
this._volume = null;
|
||||||
|
@ -121,12 +121,12 @@ define(["Tone/core/Tone", "Tone/component/Volume", "Tone/core/Context"], functio
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Connect 'this' to the master output. Shorthand for this.connect(Tone.Master)
|
* Connect 'this' to the master output. Shorthand for this.connect(Tone.Master)
|
||||||
* @returns {Tone} this
|
* @returns {Tone.AudioNode} this
|
||||||
* @example
|
* @example
|
||||||
* //connect an oscillator to the master output
|
* //connect an oscillator to the master output
|
||||||
* var osc = new Tone.Oscillator().toMaster();
|
* var osc = new Tone.Oscillator().toMaster();
|
||||||
*/
|
*/
|
||||||
Tone.prototype.toMaster = function(){
|
Tone.AudioNode.prototype.toMaster = function(){
|
||||||
this.connect(Tone.Master);
|
this.connect(Tone.Master);
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
@ -162,4 +162,4 @@ define(["Tone/core/Tone", "Tone/component/Volume", "Tone/core/Context"], functio
|
||||||
});
|
});
|
||||||
|
|
||||||
return Tone.Master;
|
return Tone.Master;
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,7 +6,7 @@ define(["Tone/core/Tone", "Tone/type/Type"], function(Tone){
|
||||||
* @class Tone.Param wraps the native Web Audio's AudioParam to provide
|
* @class Tone.Param wraps the native Web Audio's AudioParam to provide
|
||||||
* additional unit conversion functionality. It also
|
* additional unit conversion functionality. It also
|
||||||
* serves as a base-class for classes which have a single,
|
* serves as a base-class for classes which have a single,
|
||||||
* automatable parameter.
|
* automatable parameter.
|
||||||
* @extends {Tone}
|
* @extends {Tone}
|
||||||
* @param {AudioParam} param The parameter to wrap.
|
* @param {AudioParam} param The parameter to wrap.
|
||||||
* @param {Tone.Type} units The units of the audio param.
|
* @param {Tone.Type} units The units of the audio param.
|
||||||
|
@ -15,7 +15,7 @@ define(["Tone/core/Tone", "Tone/type/Type"], function(Tone){
|
||||||
Tone.Param = function(){
|
Tone.Param = function(){
|
||||||
|
|
||||||
var options = Tone.defaults(arguments, ["param", "units", "convert"], Tone.Param);
|
var options = Tone.defaults(arguments, ["param", "units", "convert"], Tone.Param);
|
||||||
Tone.call(this);
|
Tone.AudioNode.call(this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The native parameter to control
|
* The native parameter to control
|
||||||
|
@ -37,7 +37,7 @@ define(["Tone/core/Tone", "Tone/type/Type"], function(Tone){
|
||||||
this.convert = options.convert;
|
this.convert = options.convert;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* True if the signal value is being overridden by
|
* True if the signal value is being overridden by
|
||||||
* a connected signal.
|
* a connected signal.
|
||||||
* @readOnly
|
* @readOnly
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
|
@ -59,8 +59,8 @@ define(["Tone/core/Tone", "Tone/type/Type"], function(Tone){
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Tone.extend(Tone.Param);
|
Tone.extend(Tone.Param, Tone.AudioNode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defaults
|
* Defaults
|
||||||
* @type {Object}
|
* @type {Object}
|
||||||
|
@ -73,7 +73,7 @@ define(["Tone/core/Tone", "Tone/type/Type"], function(Tone){
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current value of the parameter.
|
* The current value of the parameter.
|
||||||
* @memberOf Tone.Param#
|
* @memberOf Tone.Param#
|
||||||
* @type {Number}
|
* @type {Number}
|
||||||
* @name value
|
* @name value
|
||||||
|
@ -112,17 +112,17 @@ define(["Tone/core/Tone", "Tone/type/Type"], function(Tone){
|
||||||
Tone.Param.prototype._fromUnits = function(val){
|
Tone.Param.prototype._fromUnits = function(val){
|
||||||
if (this.convert || Tone.isUndef(this.convert)){
|
if (this.convert || Tone.isUndef(this.convert)){
|
||||||
switch(this.units){
|
switch(this.units){
|
||||||
case Tone.Type.Time:
|
case Tone.Type.Time:
|
||||||
return this.toSeconds(val);
|
return this.toSeconds(val);
|
||||||
case Tone.Type.Frequency:
|
case Tone.Type.Frequency:
|
||||||
return this.toFrequency(val);
|
return this.toFrequency(val);
|
||||||
case Tone.Type.Decibels:
|
case Tone.Type.Decibels:
|
||||||
return Tone.dbToGain(val);
|
return Tone.dbToGain(val);
|
||||||
case Tone.Type.NormalRange:
|
case Tone.Type.NormalRange:
|
||||||
return Math.min(Math.max(val, 0), 1);
|
return Math.min(Math.max(val, 0), 1);
|
||||||
case Tone.Type.AudioRange:
|
case Tone.Type.AudioRange:
|
||||||
return Math.min(Math.max(val, -1), 1);
|
return Math.min(Math.max(val, -1), 1);
|
||||||
case Tone.Type.Positive:
|
case Tone.Type.Positive:
|
||||||
return Math.max(val, 0);
|
return Math.max(val, 0);
|
||||||
default:
|
default:
|
||||||
return val;
|
return val;
|
||||||
|
@ -141,7 +141,7 @@ define(["Tone/core/Tone", "Tone/type/Type"], function(Tone){
|
||||||
Tone.Param.prototype._toUnits = function(val){
|
Tone.Param.prototype._toUnits = function(val){
|
||||||
if (this.convert || Tone.isUndef(this.convert)){
|
if (this.convert || Tone.isUndef(this.convert)){
|
||||||
switch(this.units){
|
switch(this.units){
|
||||||
case Tone.Type.Decibels:
|
case Tone.Type.Decibels:
|
||||||
return Tone.gainToDb(val);
|
return Tone.gainToDb(val);
|
||||||
default:
|
default:
|
||||||
return val;
|
return val;
|
||||||
|
@ -164,7 +164,7 @@ define(["Tone/core/Tone", "Tone/type/Type"], function(Tone){
|
||||||
* @param {Time} time The time when the change should occur.
|
* @param {Time} time The time when the change should occur.
|
||||||
* @returns {Tone.Param} this
|
* @returns {Tone.Param} this
|
||||||
* @example
|
* @example
|
||||||
* //set the frequency to "G4" in exactly 1 second from now.
|
* //set the frequency to "G4" in exactly 1 second from now.
|
||||||
* freq.setValueAtTime("G4", "+1");
|
* freq.setValueAtTime("G4", "+1");
|
||||||
*/
|
*/
|
||||||
Tone.Param.prototype.setValueAtTime = function(value, time){
|
Tone.Param.prototype.setValueAtTime = function(value, time){
|
||||||
|
@ -174,10 +174,10 @@ define(["Tone/core/Tone", "Tone/type/Type"], function(Tone){
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a schedule point with the current value at the current time.
|
* Creates a schedule point with the current value at the current time.
|
||||||
* This is useful for creating an automation anchor point in order to
|
* This is useful for creating an automation anchor point in order to
|
||||||
* schedule changes from the current value.
|
* schedule changes from the current value.
|
||||||
*
|
*
|
||||||
* @param {number=} now (Optionally) pass the now value in.
|
* @param {number=} now (Optionally) pass the now value in.
|
||||||
* @returns {Tone.Param} this
|
* @returns {Tone.Param} this
|
||||||
*/
|
*/
|
||||||
Tone.Param.prototype.setRampPoint = function(now){
|
Tone.Param.prototype.setRampPoint = function(now){
|
||||||
|
@ -193,11 +193,11 @@ define(["Tone/core/Tone", "Tone/type/Type"], function(Tone){
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Schedules a linear continuous change in parameter value from the
|
* Schedules a linear continuous change in parameter value from the
|
||||||
* previous scheduled parameter value to the given value.
|
* previous scheduled parameter value to the given value.
|
||||||
*
|
*
|
||||||
* @param {number} value
|
* @param {number} value
|
||||||
* @param {Time} endTime
|
* @param {Time} endTime
|
||||||
* @returns {Tone.Param} this
|
* @returns {Tone.Param} this
|
||||||
*/
|
*/
|
||||||
Tone.Param.prototype.linearRampToValueAtTime = function(value, endTime){
|
Tone.Param.prototype.linearRampToValueAtTime = function(value, endTime){
|
||||||
|
@ -207,11 +207,11 @@ define(["Tone/core/Tone", "Tone/type/Type"], function(Tone){
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Schedules an exponential continuous change in parameter value from
|
* Schedules an exponential continuous change in parameter value from
|
||||||
* the previous scheduled parameter value to the given value.
|
* the previous scheduled parameter value to the given value.
|
||||||
*
|
*
|
||||||
* @param {number} value
|
* @param {number} value
|
||||||
* @param {Time} endTime
|
* @param {Time} endTime
|
||||||
* @returns {Tone.Param} this
|
* @returns {Tone.Param} this
|
||||||
*/
|
*/
|
||||||
Tone.Param.prototype.exponentialRampToValueAtTime = function(value, endTime){
|
Tone.Param.prototype.exponentialRampToValueAtTime = function(value, endTime){
|
||||||
|
@ -222,17 +222,17 @@ define(["Tone/core/Tone", "Tone/type/Type"], function(Tone){
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Schedules an exponential continuous change in parameter value from
|
* Schedules an exponential continuous change in parameter value from
|
||||||
* the current time and current value to the given value over the
|
* the current time and current value to the given value over the
|
||||||
* duration of the rampTime.
|
* duration of the rampTime.
|
||||||
*
|
*
|
||||||
* @param {number} value The value to ramp to.
|
* @param {number} value The value to ramp to.
|
||||||
* @param {Time} rampTime the time that it takes the
|
* @param {Time} rampTime the time that it takes the
|
||||||
* value to ramp from it's current value
|
* value to ramp from it's current value
|
||||||
* @param {Time} [startTime=now] When the ramp should start.
|
* @param {Time} [startTime=now] When the ramp should start.
|
||||||
* @returns {Tone.Param} this
|
* @returns {Tone.Param} this
|
||||||
* @example
|
* @example
|
||||||
* //exponentially ramp to the value 2 over 4 seconds.
|
* //exponentially ramp to the value 2 over 4 seconds.
|
||||||
* signal.exponentialRampToValue(2, 4);
|
* signal.exponentialRampToValue(2, 4);
|
||||||
*/
|
*/
|
||||||
Tone.Param.prototype.exponentialRampToValue = function(value, rampTime, startTime){
|
Tone.Param.prototype.exponentialRampToValue = function(value, rampTime, startTime){
|
||||||
|
@ -243,17 +243,17 @@ define(["Tone/core/Tone", "Tone/type/Type"], function(Tone){
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Schedules an linear continuous change in parameter value from
|
* Schedules an linear continuous change in parameter value from
|
||||||
* the current time and current value to the given value over the
|
* the current time and current value to the given value over the
|
||||||
* duration of the rampTime.
|
* duration of the rampTime.
|
||||||
*
|
*
|
||||||
* @param {number} value The value to ramp to.
|
* @param {number} value The value to ramp to.
|
||||||
* @param {Time} rampTime the time that it takes the
|
* @param {Time} rampTime the time that it takes the
|
||||||
* value to ramp from it's current value
|
* value to ramp from it's current value
|
||||||
* @param {Time} [startTime=now] When the ramp should start.
|
* @param {Time} [startTime=now] When the ramp should start.
|
||||||
* @returns {Tone.Param} this
|
* @returns {Tone.Param} this
|
||||||
* @example
|
* @example
|
||||||
* //linearly ramp to the value 4 over 3 seconds.
|
* //linearly ramp to the value 4 over 3 seconds.
|
||||||
* signal.linearRampToValue(4, 3);
|
* signal.linearRampToValue(4, 3);
|
||||||
*/
|
*/
|
||||||
Tone.Param.prototype.linearRampToValue = function(value, rampTime, startTime){
|
Tone.Param.prototype.linearRampToValue = function(value, rampTime, startTime){
|
||||||
|
@ -266,10 +266,10 @@ define(["Tone/core/Tone", "Tone/type/Type"], function(Tone){
|
||||||
/**
|
/**
|
||||||
* Start exponentially approaching the target value at the given time with
|
* Start exponentially approaching the target value at the given time with
|
||||||
* a rate having the given time constant.
|
* a rate having the given time constant.
|
||||||
* @param {number} value
|
* @param {number} value
|
||||||
* @param {Time} startTime
|
* @param {Time} startTime
|
||||||
* @param {number} timeConstant
|
* @param {number} timeConstant
|
||||||
* @returns {Tone.Param} this
|
* @returns {Tone.Param} this
|
||||||
*/
|
*/
|
||||||
Tone.Param.prototype.setTargetAtTime = function(value, startTime, timeConstant){
|
Tone.Param.prototype.setTargetAtTime = function(value, startTime, timeConstant){
|
||||||
value = this._fromUnits(value);
|
value = this._fromUnits(value);
|
||||||
|
@ -285,10 +285,10 @@ define(["Tone/core/Tone", "Tone/type/Type"], function(Tone){
|
||||||
/**
|
/**
|
||||||
* Sets an array of arbitrary parameter values starting at the given time
|
* Sets an array of arbitrary parameter values starting at the given time
|
||||||
* for the given duration.
|
* for the given duration.
|
||||||
*
|
*
|
||||||
* @param {Array} values
|
* @param {Array} values
|
||||||
* @param {Time} startTime
|
* @param {Time} startTime
|
||||||
* @param {Time} duration
|
* @param {Time} duration
|
||||||
* @returns {Tone.Param} this
|
* @returns {Tone.Param} this
|
||||||
*/
|
*/
|
||||||
Tone.Param.prototype.setValueCurveAtTime = function(values, startTime, duration){
|
Tone.Param.prototype.setValueCurveAtTime = function(values, startTime, duration){
|
||||||
|
@ -303,9 +303,9 @@ define(["Tone/core/Tone", "Tone/type/Type"], function(Tone){
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cancels all scheduled parameter changes with times greater than or
|
* Cancels all scheduled parameter changes with times greater than or
|
||||||
* equal to startTime.
|
* equal to startTime.
|
||||||
*
|
*
|
||||||
* @param {Time} startTime
|
* @param {Time} startTime
|
||||||
* @returns {Tone.Param} this
|
* @returns {Tone.Param} this
|
||||||
*/
|
*/
|
||||||
|
@ -315,17 +315,17 @@ define(["Tone/core/Tone", "Tone/type/Type"], function(Tone){
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ramps to the given value over the duration of the rampTime.
|
* Ramps to the given value over the duration of the rampTime.
|
||||||
* Automatically selects the best ramp type (exponential or linear)
|
* Automatically selects the best ramp type (exponential or linear)
|
||||||
* depending on the `units` of the signal
|
* depending on the `units` of the signal
|
||||||
*
|
*
|
||||||
* @param {number} value
|
* @param {number} value
|
||||||
* @param {Time} rampTime The time that it takes the
|
* @param {Time} rampTime The time that it takes the
|
||||||
* value to ramp from it's current value
|
* value to ramp from it's current value
|
||||||
* @param {Time} [startTime=now] When the ramp should start.
|
* @param {Time} [startTime=now] When the ramp should start.
|
||||||
* @returns {Tone.Param} this
|
* @returns {Tone.Param} this
|
||||||
* @example
|
* @example
|
||||||
* //ramp to the value either linearly or exponentially
|
* //ramp to the value either linearly or exponentially
|
||||||
* //depending on the "units" value of the signal
|
* //depending on the "units" value of the signal
|
||||||
* signal.rampTo(0, 10);
|
* signal.rampTo(0, 10);
|
||||||
* @example
|
* @example
|
||||||
|
@ -361,7 +361,7 @@ define(["Tone/core/Tone", "Tone/type/Type"], function(Tone){
|
||||||
* @returns {Tone.Param} this
|
* @returns {Tone.Param} this
|
||||||
*/
|
*/
|
||||||
Tone.Param.prototype.dispose = function(){
|
Tone.Param.prototype.dispose = function(){
|
||||||
Tone.prototype.dispose.call(this);
|
Tone.AudioNode.prototype.dispose.call(this);
|
||||||
this._param = null;
|
this._param = null;
|
||||||
if (this._lfo){
|
if (this._lfo){
|
||||||
this._lfo.dispose();
|
this._lfo.dispose();
|
||||||
|
@ -371,4 +371,4 @@ define(["Tone/core/Tone", "Tone/type/Type"], function(Tone){
|
||||||
};
|
};
|
||||||
|
|
||||||
return Tone.Param;
|
return Tone.Param;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
define(["Tone/core/Tone", "Tone/component/CrossFade"], function(Tone){
|
define(["Tone/core/Tone", "Tone/component/CrossFade", "Tone/core/AudioNode"], function(Tone){
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Tone.Effect is the base class for effects. Connect the effect between
|
* @class Tone.Effect is the base class for effects. Connect the effect between
|
||||||
* the effectSend and effectReturn GainNodes, then control the amount of
|
* the effectSend and effectReturn GainNodes, then control the amount of
|
||||||
* effect which goes to the output using the wet control.
|
* effect which goes to the output using the wet control.
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {Tone}
|
* @extends {Tone.AudioNode}
|
||||||
* @param {NormalRange|Object} [wet] The starting wet value.
|
* @param {NormalRange|Object} [wet] The starting wet value.
|
||||||
*/
|
*/
|
||||||
Tone.Effect = function(){
|
Tone.Effect = function(){
|
||||||
|
|
||||||
var options = Tone.defaults(arguments, ["wet"], Tone.Effect);
|
var options = Tone.defaults(arguments, ["wet"], Tone.Effect);
|
||||||
Tone.call(this);
|
Tone.AudioNode.call(this);
|
||||||
this.createInsOuts(1, 1);
|
this.createInsOuts(1, 1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -27,7 +27,7 @@ define(["Tone/core/Tone", "Tone/component/CrossFade"], function(Tone){
|
||||||
/**
|
/**
|
||||||
* The wet control is how much of the effected
|
* The wet control is how much of the effected
|
||||||
* will pass through to the output. 1 = 100% effected
|
* will pass through to the output. 1 = 100% effected
|
||||||
* signal, 0 = 100% dry signal.
|
* signal, 0 = 100% dry signal.
|
||||||
* @type {NormalRange}
|
* @type {NormalRange}
|
||||||
* @signal
|
* @signal
|
||||||
*/
|
*/
|
||||||
|
@ -55,7 +55,7 @@ define(["Tone/core/Tone", "Tone/component/CrossFade"], function(Tone){
|
||||||
this._readOnly(["wet"]);
|
this._readOnly(["wet"]);
|
||||||
};
|
};
|
||||||
|
|
||||||
Tone.extend(Tone.Effect);
|
Tone.extend(Tone.Effect, Tone.AudioNode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @static
|
* @static
|
||||||
|
@ -77,11 +77,11 @@ define(["Tone/core/Tone", "Tone/component/CrossFade"], function(Tone){
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clean up.
|
* Clean up.
|
||||||
* @returns {Tone.Effect} this
|
* @returns {Tone.Effect} this
|
||||||
*/
|
*/
|
||||||
Tone.Effect.prototype.dispose = function(){
|
Tone.Effect.prototype.dispose = function(){
|
||||||
Tone.prototype.dispose.call(this);
|
Tone.AudioNode.prototype.dispose.call(this);
|
||||||
this._dryWet.dispose();
|
this._dryWet.dispose();
|
||||||
this._dryWet = null;
|
this._dryWet = null;
|
||||||
this.effectSend.dispose();
|
this.effectSend.dispose();
|
||||||
|
@ -94,4 +94,4 @@ define(["Tone/core/Tone", "Tone/component/CrossFade"], function(Tone){
|
||||||
};
|
};
|
||||||
|
|
||||||
return Tone.Effect;
|
return Tone.Effect;
|
||||||
});
|
});
|
||||||
|
|
|
@ -13,6 +13,7 @@ function(Tone){
|
||||||
Tone.StereoEffect = function(){
|
Tone.StereoEffect = function(){
|
||||||
|
|
||||||
//get the defaults
|
//get the defaults
|
||||||
|
Tone.AudioNode.call(this);
|
||||||
var options = Tone.defaults(arguments, ["wet"], Tone.Effect);
|
var options = Tone.defaults(arguments, ["wet"], Tone.Effect);
|
||||||
this.createInsOuts(1, 1);
|
this.createInsOuts(1, 1);
|
||||||
|
|
||||||
|
@ -89,7 +90,7 @@ function(Tone){
|
||||||
* @returns {Tone.StereoEffect} this
|
* @returns {Tone.StereoEffect} this
|
||||||
*/
|
*/
|
||||||
Tone.StereoEffect.prototype.dispose = function(){
|
Tone.StereoEffect.prototype.dispose = function(){
|
||||||
Tone.prototype.dispose.call(this);
|
Tone.AudioNode.prototype.dispose.call(this);
|
||||||
this._dryWet.dispose();
|
this._dryWet.dispose();
|
||||||
this._dryWet = null;
|
this._dryWet = null;
|
||||||
this._split.dispose();
|
this._split.dispose();
|
||||||
|
|
|
@ -4,15 +4,15 @@ define(["Tone/core/Tone", "Tone/type/Type", "Tone/core/Master"], function(Tone){
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Base-class for all instruments
|
* @class Base-class for all instruments
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {Tone}
|
* @extends {Tone.AudioNode}
|
||||||
*/
|
*/
|
||||||
Tone.Instrument = function(options){
|
Tone.Instrument = function(options){
|
||||||
|
|
||||||
//get the defaults
|
//get the defaults
|
||||||
options = Tone.defaultArg(options, Tone.Instrument.defaults);
|
options = Tone.defaultArg(options, Tone.Instrument.defaults);
|
||||||
Tone.call(this);
|
Tone.AudioNode.call(this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The output and volume triming node
|
* The output and volume triming node
|
||||||
|
@ -32,7 +32,7 @@ define(["Tone/core/Tone", "Tone/type/Type", "Tone/core/Master"], function(Tone){
|
||||||
this._readOnly("volume");
|
this._readOnly("volume");
|
||||||
};
|
};
|
||||||
|
|
||||||
Tone.extend(Tone.Instrument);
|
Tone.extend(Tone.Instrument, Tone.AudioNode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the default attributes
|
* the default attributes
|
||||||
|
@ -58,10 +58,10 @@ define(["Tone/core/Tone", "Tone/type/Type", "Tone/core/Master"], function(Tone){
|
||||||
Tone.Instrument.prototype.triggerRelease = Tone.noOp;
|
Tone.Instrument.prototype.triggerRelease = Tone.noOp;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Trigger the attack and then the release after the duration.
|
* Trigger the attack and then the release after the duration.
|
||||||
* @param {Frequency} note The note to trigger.
|
* @param {Frequency} note The note to trigger.
|
||||||
* @param {Time} duration How long the note should be held for before
|
* @param {Time} duration How long the note should be held for before
|
||||||
* triggering the release. This value must be greater than 0.
|
* triggering the release. This value must be greater than 0.
|
||||||
* @param {Time} [time=now] When the note should be triggered.
|
* @param {Time} [time=now] When the note should be triggered.
|
||||||
* @param {NormalRange} [velocity=1] The velocity the note should be triggered at.
|
* @param {NormalRange} [velocity=1] The velocity the note should be triggered at.
|
||||||
* @returns {Tone.Instrument} this
|
* @returns {Tone.Instrument} this
|
||||||
|
@ -82,7 +82,7 @@ define(["Tone/core/Tone", "Tone/type/Type", "Tone/core/Master"], function(Tone){
|
||||||
* @returns {Tone.Instrument} this
|
* @returns {Tone.Instrument} this
|
||||||
*/
|
*/
|
||||||
Tone.Instrument.prototype.dispose = function(){
|
Tone.Instrument.prototype.dispose = function(){
|
||||||
Tone.prototype.dispose.call(this);
|
Tone.AudioNode.prototype.dispose.call(this);
|
||||||
this._volume.dispose();
|
this._volume.dispose();
|
||||||
this._volume = null;
|
this._volume = null;
|
||||||
this._writable(["volume"]);
|
this._writable(["volume"]);
|
||||||
|
@ -91,4 +91,4 @@ define(["Tone/core/Tone", "Tone/type/Type", "Tone/core/Master"], function(Tone){
|
||||||
};
|
};
|
||||||
|
|
||||||
return Tone.Instrument;
|
return Tone.Instrument;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,34 +1,34 @@
|
||||||
define(["Tone/core/Tone"], function(Tone){
|
define(["Tone/core/Tone", "Tone/core/AudioNode"], function(Tone){
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Base class for all Signals. Used Internally.
|
* @class Base class for all Signals. Used Internally.
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {Tone}
|
* @extends {Tone}
|
||||||
*/
|
*/
|
||||||
Tone.SignalBase = function(){
|
Tone.SignalBase = function(){
|
||||||
Tone.call(this);
|
Tone.AudioNode.call(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
Tone.extend(Tone.SignalBase);
|
Tone.extend(Tone.SignalBase, Tone.AudioNode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When signals connect to other signals or AudioParams,
|
* When signals connect to other signals or AudioParams,
|
||||||
* they take over the output value of that signal or AudioParam.
|
* they take over the output value of that signal or AudioParam.
|
||||||
* For all other nodes, the behavior is the same as a default <code>connect</code>.
|
* For all other nodes, the behavior is the same as a default <code>connect</code>.
|
||||||
*
|
*
|
||||||
* @override
|
* @override
|
||||||
* @param {AudioParam|AudioNode|Tone.Signal|Tone} node
|
* @param {AudioParam|AudioNode|Tone.Signal|Tone} node
|
||||||
* @param {number} [outputNumber=0] The output number to connect from.
|
* @param {number} [outputNumber=0] The output number to connect from.
|
||||||
* @param {number} [inputNumber=0] The input number to connect to.
|
* @param {number} [inputNumber=0] The input number to connect to.
|
||||||
* @returns {Tone.SignalBase} this
|
* @returns {Tone.SignalBase} this
|
||||||
*/
|
*/
|
||||||
Tone.SignalBase.prototype.connect = function(node, outputNumber, inputNumber){
|
Tone.SignalBase.prototype.connect = function(node, outputNumber, inputNumber){
|
||||||
//zero it out so that the signal can have full control
|
//zero it out so that the signal can have full control
|
||||||
if ((Tone.Signal && Tone.Signal === node.constructor) ||
|
if ((Tone.Signal && Tone.Signal === node.constructor) ||
|
||||||
(Tone.Param && Tone.Param === node.constructor) ||
|
(Tone.Param && Tone.Param === node.constructor) ||
|
||||||
(Tone.TimelineSignal && Tone.TimelineSignal === node.constructor)){
|
(Tone.TimelineSignal && Tone.TimelineSignal === node.constructor)){
|
||||||
//cancel changes
|
//cancel changes
|
||||||
node._param.cancelScheduledValues(0);
|
node._param.cancelScheduledValues(0);
|
||||||
|
@ -39,10 +39,10 @@ define(["Tone/core/Tone"], function(Tone){
|
||||||
} else if (node instanceof AudioParam){
|
} else if (node instanceof AudioParam){
|
||||||
node.cancelScheduledValues(0);
|
node.cancelScheduledValues(0);
|
||||||
node.value = 0;
|
node.value = 0;
|
||||||
}
|
}
|
||||||
Tone.prototype.connect.call(this, node, outputNumber, inputNumber);
|
Tone.AudioNode.prototype.connect.call(this, node, outputNumber, inputNumber);
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
return Tone.SignalBase;
|
return Tone.SignalBase;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
define(["Tone/core/Tone", "Tone/core/Gain"], function (Tone) {
|
define(["Tone/core/Tone", "Tone/core/Gain", "Tone/signal/SignalBase"], function (Tone) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Tone.Zero outputs 0's at audio-rate. The reason this has to be
|
* @class Tone.Zero outputs 0's at audio-rate. The reason this has to be
|
||||||
* it's own class is that many browsers optimize out Tone.Signal
|
* it's own class is that many browsers optimize out Tone.Signal
|
||||||
* with a value of 0 and will not process nodes further down the graph.
|
* with a value of 0 and will not process nodes further down the graph.
|
||||||
* @extends {Tone.SignalBase}
|
* @extends {Tone.SignalBase}
|
||||||
*/
|
*/
|
||||||
Tone.Zero = function(){
|
Tone.Zero = function(){
|
||||||
|
@ -34,4 +34,4 @@ define(["Tone/core/Tone", "Tone/core/Gain"], function (Tone) {
|
||||||
};
|
};
|
||||||
|
|
||||||
return Tone.Zero;
|
return Tone.Zero;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
define(["Tone/core/Tone", "Tone/core/Buffer", "Tone/source/Source", "Tone/core/Gain"], function (Tone) {
|
define(["Tone/core/Tone", "Tone/core/Buffer", "Tone/source/Source", "Tone/core/Gain", "Tone/core/AudioNode"], function (Tone) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BufferSource polyfill
|
* BufferSource polyfill
|
||||||
|
@ -10,19 +10,19 @@ define(["Tone/core/Tone", "Tone/core/Buffer", "Tone/source/Source", "Tone/core/G
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Wrapper around the native BufferSourceNode.
|
* @class Wrapper around the native BufferSourceNode.
|
||||||
* @extends {Tone}
|
* @extends {Tone.AudioNode}
|
||||||
* @param {AudioBuffer|Tone.Buffer} buffer The buffer to play
|
* @param {AudioBuffer|Tone.Buffer} buffer The buffer to play
|
||||||
* @param {Function} onload The callback to invoke when the
|
* @param {Function} onload The callback to invoke when the
|
||||||
* buffer is done playing.
|
* buffer is done playing.
|
||||||
*/
|
*/
|
||||||
Tone.BufferSource = function(){
|
Tone.BufferSource = function(){
|
||||||
|
|
||||||
var options = Tone.defaults(arguments, ["buffer", "onload"], Tone.BufferSource);
|
var options = Tone.defaults(arguments, ["buffer", "onload"], Tone.BufferSource);
|
||||||
Tone.call(this);
|
Tone.AudioNode.call(this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The callback to invoke after the
|
* The callback to invoke after the
|
||||||
* buffer source is done playing.
|
* buffer source is done playing.
|
||||||
* @type {Function}
|
* @type {Function}
|
||||||
*/
|
*/
|
||||||
this.onended = options.onended;
|
this.onended = options.onended;
|
||||||
|
@ -62,7 +62,7 @@ define(["Tone/core/Tone", "Tone/core/Buffer", "Tone/source/Source", "Tone/core/G
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this._buffer = new Tone.Buffer(options.buffer, options.onload);
|
this._buffer = new Tone.Buffer(options.buffer, options.onload);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The playbackRate of the buffer
|
* The playbackRate of the buffer
|
||||||
* @type {Positive}
|
* @type {Positive}
|
||||||
|
@ -102,7 +102,7 @@ define(["Tone/core/Tone", "Tone/core/Buffer", "Tone/source/Source", "Tone/core/G
|
||||||
this.playbackRate.value = options.playbackRate;
|
this.playbackRate.value = options.playbackRate;
|
||||||
};
|
};
|
||||||
|
|
||||||
Tone.extend(Tone.BufferSource);
|
Tone.extend(Tone.BufferSource, Tone.AudioNode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The defaults
|
* The defaults
|
||||||
|
@ -142,9 +142,9 @@ define(["Tone/core/Tone", "Tone/core/Buffer", "Tone/source/Source", "Tone/core/G
|
||||||
* Start the buffer
|
* Start the buffer
|
||||||
* @param {Time} [startTime=now] When the player should start.
|
* @param {Time} [startTime=now] When the player should start.
|
||||||
* @param {Time} [offset=0] The offset from the beginning of the sample
|
* @param {Time} [offset=0] The offset from the beginning of the sample
|
||||||
* to start at.
|
* to start at.
|
||||||
* @param {Time=} duration How long the sample should play. If no duration
|
* @param {Time=} duration How long the sample should play. If no duration
|
||||||
* is given, it will default to the full length
|
* is given, it will default to the full length
|
||||||
* of the sample (minus any offset)
|
* of the sample (minus any offset)
|
||||||
* @param {Gain} [gain=1] The gain to play the buffer back at.
|
* @param {Gain} [gain=1] The gain to play the buffer back at.
|
||||||
* @param {Time=} fadeInTime The optional fadeIn ramp time.
|
* @param {Time=} fadeInTime The optional fadeIn ramp time.
|
||||||
|
@ -221,8 +221,8 @@ define(["Tone/core/Tone", "Tone/core/Buffer", "Tone/source/Source", "Tone/core/G
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stop the buffer. Optionally add a ramp time to fade the
|
* Stop the buffer. Optionally add a ramp time to fade the
|
||||||
* buffer out.
|
* buffer out.
|
||||||
* @param {Time=} time The time the buffer should stop.
|
* @param {Time=} time The time the buffer should stop.
|
||||||
* @param {Time=} fadeOutTime How long the gain should fade out for
|
* @param {Time=} fadeOutTime How long the gain should fade out for
|
||||||
* @return {Tone.BufferSource} this
|
* @return {Tone.BufferSource} this
|
||||||
|
@ -231,17 +231,17 @@ define(["Tone/core/Tone", "Tone/core/Buffer", "Tone/source/Source", "Tone/core/G
|
||||||
if (this.buffer.loaded){
|
if (this.buffer.loaded){
|
||||||
|
|
||||||
time = this.toSeconds(time);
|
time = this.toSeconds(time);
|
||||||
|
|
||||||
//the fadeOut time
|
//the fadeOut time
|
||||||
if (Tone.isUndef(fadeOutTime)){
|
if (Tone.isUndef(fadeOutTime)){
|
||||||
fadeOutTime = this.toSeconds(this.fadeOut);
|
fadeOutTime = this.toSeconds(this.fadeOut);
|
||||||
} else {
|
} else {
|
||||||
fadeOutTime = this.toSeconds(fadeOutTime);
|
fadeOutTime = this.toSeconds(fadeOutTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
//only stop if the last stop was scheduled later
|
//only stop if the last stop was scheduled later
|
||||||
if (this._stopTime === -1 || this._stopTime > time){
|
if (this._stopTime === -1 || this._stopTime > time){
|
||||||
this._stopTime = time;
|
this._stopTime = time;
|
||||||
|
|
||||||
//cancel the end curve
|
//cancel the end curve
|
||||||
this._gainNode.gain.cancelScheduledValues(this._startTime + this.sampleTime);
|
this._gainNode.gain.cancelScheduledValues(this._startTime + this.sampleTime);
|
||||||
|
@ -267,7 +267,7 @@ define(["Tone/core/Tone", "Tone/core/Buffer", "Tone/source/Source", "Tone/core/G
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal callback when the buffer is ended.
|
* Internal callback when the buffer is ended.
|
||||||
* Invokes `onended` and disposes the node.
|
* Invokes `onended` and disposes the node.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
|
@ -276,7 +276,7 @@ define(["Tone/core/Tone", "Tone/core/Buffer", "Tone/source/Source", "Tone/core/G
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If loop is true, the loop will start at this position.
|
* If loop is true, the loop will start at this position.
|
||||||
* @memberOf Tone.BufferSource#
|
* @memberOf Tone.BufferSource#
|
||||||
* @type {Time}
|
* @type {Time}
|
||||||
* @name loopStart
|
* @name loopStart
|
||||||
|
@ -284,7 +284,7 @@ define(["Tone/core/Tone", "Tone/core/Buffer", "Tone/source/Source", "Tone/core/G
|
||||||
Object.defineProperty(Tone.BufferSource.prototype, "loopStart", {
|
Object.defineProperty(Tone.BufferSource.prototype, "loopStart", {
|
||||||
get : function(){
|
get : function(){
|
||||||
return this._source.loopStart;
|
return this._source.loopStart;
|
||||||
},
|
},
|
||||||
set : function(loopStart){
|
set : function(loopStart){
|
||||||
this._source.loopStart = this.toSeconds(loopStart);
|
this._source.loopStart = this.toSeconds(loopStart);
|
||||||
}
|
}
|
||||||
|
@ -299,14 +299,14 @@ define(["Tone/core/Tone", "Tone/core/Buffer", "Tone/source/Source", "Tone/core/G
|
||||||
Object.defineProperty(Tone.BufferSource.prototype, "loopEnd", {
|
Object.defineProperty(Tone.BufferSource.prototype, "loopEnd", {
|
||||||
get : function(){
|
get : function(){
|
||||||
return this._source.loopEnd;
|
return this._source.loopEnd;
|
||||||
},
|
},
|
||||||
set : function(loopEnd){
|
set : function(loopEnd){
|
||||||
this._source.loopEnd = this.toSeconds(loopEnd);
|
this._source.loopEnd = this.toSeconds(loopEnd);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The audio buffer belonging to the player.
|
* The audio buffer belonging to the player.
|
||||||
* @memberOf Tone.BufferSource#
|
* @memberOf Tone.BufferSource#
|
||||||
* @type {Tone.Buffer}
|
* @type {Tone.Buffer}
|
||||||
* @name buffer
|
* @name buffer
|
||||||
|
@ -314,14 +314,14 @@ define(["Tone/core/Tone", "Tone/core/Buffer", "Tone/source/Source", "Tone/core/G
|
||||||
Object.defineProperty(Tone.BufferSource.prototype, "buffer", {
|
Object.defineProperty(Tone.BufferSource.prototype, "buffer", {
|
||||||
get : function(){
|
get : function(){
|
||||||
return this._buffer;
|
return this._buffer;
|
||||||
},
|
},
|
||||||
set : function(buffer){
|
set : function(buffer){
|
||||||
this._buffer.set(buffer);
|
this._buffer.set(buffer);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the buffer should loop once it's over.
|
* If the buffer should loop once it's over.
|
||||||
* @memberOf Tone.BufferSource#
|
* @memberOf Tone.BufferSource#
|
||||||
* @type {Boolean}
|
* @type {Boolean}
|
||||||
* @name loop
|
* @name loop
|
||||||
|
@ -329,7 +329,7 @@ define(["Tone/core/Tone", "Tone/core/Buffer", "Tone/source/Source", "Tone/core/G
|
||||||
Object.defineProperty(Tone.BufferSource.prototype, "loop", {
|
Object.defineProperty(Tone.BufferSource.prototype, "loop", {
|
||||||
get : function(){
|
get : function(){
|
||||||
return this._source.loop;
|
return this._source.loop;
|
||||||
},
|
},
|
||||||
set : function(loop){
|
set : function(loop){
|
||||||
this._source.loop = loop;
|
this._source.loop = loop;
|
||||||
}
|
}
|
||||||
|
@ -340,7 +340,7 @@ define(["Tone/core/Tone", "Tone/core/Buffer", "Tone/source/Source", "Tone/core/G
|
||||||
* @return {Tone.BufferSource} this
|
* @return {Tone.BufferSource} this
|
||||||
*/
|
*/
|
||||||
Tone.BufferSource.prototype.dispose = function(){
|
Tone.BufferSource.prototype.dispose = function(){
|
||||||
Tone.prototype.dispose.call(this);
|
Tone.AudioNode.prototype.dispose.call(this);
|
||||||
this.onended = null;
|
this.onended = null;
|
||||||
this._source.disconnect();
|
this._source.disconnect();
|
||||||
this._source = null;
|
this._source = null;
|
||||||
|
@ -355,4 +355,4 @@ define(["Tone/core/Tone", "Tone/core/Buffer", "Tone/source/Source", "Tone/core/G
|
||||||
};
|
};
|
||||||
|
|
||||||
return Tone.BufferSource;
|
return Tone.BufferSource;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
define(["Tone/core/Tone", "Tone/source/Player", "Tone/component/Volume"], function(Tone){
|
define(["Tone/core/Tone", "Tone/source/Player", "Tone/component/Volume", "Tone/core/AudioNode"], function(Tone){
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Tone.Players combines multiple [Tone.Player](Player) objects.
|
* @class Tone.Players combines multiple [Tone.Player](Player) objects.
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {Tone}
|
* @extends {Tone.AudioNode}
|
||||||
* @param {Object} urls An object mapping a name to a url.
|
* @param {Object} urls An object mapping a name to a url.
|
||||||
* @param {function=} onload The function to invoke when the buffer is loaded.
|
* @param {function=} onload The function to invoke when the buffer is loaded.
|
||||||
*/
|
*/
|
||||||
Tone.Players = function(urls){
|
Tone.Players = function(urls){
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ define(["Tone/core/Tone", "Tone/source/Player", "Tone/component/Volume"], functi
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Tone.extend(Tone.Players);
|
Tone.extend(Tone.Players, Tone.AudioNode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default values
|
* The default values
|
||||||
|
@ -91,7 +91,7 @@ define(["Tone/core/Tone", "Tone/source/Player", "Tone/component/Volume"], functi
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A buffer was loaded. decrement the counter.
|
* A buffer was loaded. decrement the counter.
|
||||||
* @param {Function} callback
|
* @param {Function} callback
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
Tone.Players.prototype._bufferLoaded = function(callback){
|
Tone.Players.prototype._bufferLoaded = function(callback){
|
||||||
|
@ -102,7 +102,7 @@ define(["Tone/core/Tone", "Tone/source/Player", "Tone/component/Volume"], functi
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mute the output.
|
* Mute the output.
|
||||||
* @memberOf Tone.Source#
|
* @memberOf Tone.Source#
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
* @name mute
|
* @name mute
|
||||||
|
@ -113,7 +113,7 @@ define(["Tone/core/Tone", "Tone/source/Player", "Tone/component/Volume"], functi
|
||||||
Object.defineProperty(Tone.Players.prototype, "mute", {
|
Object.defineProperty(Tone.Players.prototype, "mute", {
|
||||||
get : function(){
|
get : function(){
|
||||||
return this._volume.mute;
|
return this._volume.mute;
|
||||||
},
|
},
|
||||||
set : function(mute){
|
set : function(mute){
|
||||||
this._volume.mute = mute;
|
this._volume.mute = mute;
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ define(["Tone/core/Tone", "Tone/source/Player", "Tone/component/Volume"], functi
|
||||||
Object.defineProperty(Tone.Players.prototype, "fadeIn", {
|
Object.defineProperty(Tone.Players.prototype, "fadeIn", {
|
||||||
get : function(){
|
get : function(){
|
||||||
return this._fadeIn;
|
return this._fadeIn;
|
||||||
},
|
},
|
||||||
set : function(fadeIn){
|
set : function(fadeIn){
|
||||||
this._fadeIn = fadeIn;
|
this._fadeIn = fadeIn;
|
||||||
this._forEach(function(player){
|
this._forEach(function(player){
|
||||||
|
@ -146,7 +146,7 @@ define(["Tone/core/Tone", "Tone/source/Player", "Tone/component/Volume"], functi
|
||||||
Object.defineProperty(Tone.Players.prototype, "fadeOut", {
|
Object.defineProperty(Tone.Players.prototype, "fadeOut", {
|
||||||
get : function(){
|
get : function(){
|
||||||
return this._fadeOut;
|
return this._fadeOut;
|
||||||
},
|
},
|
||||||
set : function(fadeOut){
|
set : function(fadeOut){
|
||||||
this._fadeOut = fadeOut;
|
this._fadeOut = fadeOut;
|
||||||
this._forEach(function(player){
|
this._forEach(function(player){
|
||||||
|
@ -174,7 +174,7 @@ define(["Tone/core/Tone", "Tone/source/Player", "Tone/component/Volume"], functi
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* True if the buffers object has a buffer by that name.
|
* True if the buffers object has a buffer by that name.
|
||||||
* @param {String|Number} name The key or index of the
|
* @param {String|Number} name The key or index of the
|
||||||
* buffer.
|
* buffer.
|
||||||
* @return {Boolean}
|
* @return {Boolean}
|
||||||
*/
|
*/
|
||||||
|
@ -183,9 +183,9 @@ define(["Tone/core/Tone", "Tone/source/Player", "Tone/component/Volume"], functi
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a player by name.
|
* Get a player by name.
|
||||||
* @param {String} name The players name as defined in
|
* @param {String} name The players name as defined in
|
||||||
* the constructor object or `add` method.
|
* the constructor object or `add` method.
|
||||||
* @return {Tone.Player}
|
* @return {Tone.Player}
|
||||||
*/
|
*/
|
||||||
Tone.Players.prototype.get = function(name){
|
Tone.Players.prototype.get = function(name){
|
||||||
|
@ -229,10 +229,10 @@ define(["Tone/core/Tone", "Tone/source/Player", "Tone/component/Volume"], functi
|
||||||
/**
|
/**
|
||||||
* Add a player by name and url to the Players
|
* Add a player by name and url to the Players
|
||||||
* @param {String} name A unique name to give the player
|
* @param {String} name A unique name to give the player
|
||||||
* @param {String|Tone.Buffer|Audiobuffer} url Either the url of the bufer,
|
* @param {String|Tone.Buffer|Audiobuffer} url Either the url of the bufer,
|
||||||
* or a buffer which will be added
|
* or a buffer which will be added
|
||||||
* with the given name.
|
* with the given name.
|
||||||
* @param {Function=} callback The callback to invoke
|
* @param {Function=} callback The callback to invoke
|
||||||
* when the url is loaded.
|
* when the url is loaded.
|
||||||
*/
|
*/
|
||||||
Tone.Players.prototype.add = function(name, url, callback){
|
Tone.Players.prototype.add = function(name, url, callback){
|
||||||
|
@ -258,7 +258,7 @@ define(["Tone/core/Tone", "Tone/source/Player", "Tone/component/Volume"], functi
|
||||||
* @return {Tone.Players} this
|
* @return {Tone.Players} this
|
||||||
*/
|
*/
|
||||||
Tone.Players.prototype.dispose = function(){
|
Tone.Players.prototype.dispose = function(){
|
||||||
Tone.prototype.dispose.call(this);
|
Tone.AudioNode.prototype.dispose.call(this);
|
||||||
this._volume.dispose();
|
this._volume.dispose();
|
||||||
this._volume = null;
|
this._volume = null;
|
||||||
this._writable("volume");
|
this._writable("volume");
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
define(["Tone/core/Tone", "Tone/core/Transport", "Tone/component/Volume", "Tone/core/Master",
|
define(["Tone/core/Tone", "Tone/core/Transport", "Tone/component/Volume", "Tone/core/Master",
|
||||||
"Tone/type/Type", "Tone/core/TimelineState", "Tone/signal/Signal"],
|
"Tone/type/Type", "Tone/core/TimelineState", "Tone/signal/Signal", "Tone/core/AudioNode"],
|
||||||
function(Tone){
|
function(Tone){
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Base class for sources. Sources have start/stop methods
|
* @class Base class for sources. Sources have start/stop methods
|
||||||
* and the ability to be synced to the
|
* and the ability to be synced to the
|
||||||
* start/stop of Tone.Transport.
|
* start/stop of Tone.Transport.
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {Tone}
|
* @extends {Tone.AudioNode}
|
||||||
* @example
|
* @example
|
||||||
* //Multiple state change events can be chained together,
|
* //Multiple state change events can be chained together,
|
||||||
* //but must be set in the correct order and with ascending times
|
* //but must be set in the correct order and with ascending times
|
||||||
*
|
*
|
||||||
* // OK
|
* // OK
|
||||||
* state.start().stop("+0.2");
|
* state.start().stop("+0.2");
|
||||||
* // AND
|
* // AND
|
||||||
|
@ -24,12 +24,12 @@ function(Tone){
|
||||||
* state.stop("+0.2").start();
|
* state.stop("+0.2").start();
|
||||||
* // OR
|
* // OR
|
||||||
* state.start("+0.3").stop("+0.2");
|
* state.start("+0.3").stop("+0.2");
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Tone.Source = function(options){
|
Tone.Source = function(options){
|
||||||
|
|
||||||
Tone.call(this);
|
|
||||||
options = Tone.defaultArg(options, Tone.Source.defaults);
|
options = Tone.defaultArg(options, Tone.Source.defaults);
|
||||||
|
Tone.AudioNode.call(this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The output volume node
|
* The output volume node
|
||||||
|
@ -77,7 +77,7 @@ function(Tone){
|
||||||
this.mute = options.mute;
|
this.mute = options.mute;
|
||||||
};
|
};
|
||||||
|
|
||||||
Tone.extend(Tone.Source);
|
Tone.extend(Tone.Source, Tone.AudioNode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default parameters
|
* The default parameters
|
||||||
|
@ -112,7 +112,7 @@ function(Tone){
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mute the output.
|
* Mute the output.
|
||||||
* @memberOf Tone.Source#
|
* @memberOf Tone.Source#
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
* @name mute
|
* @name mute
|
||||||
|
@ -123,7 +123,7 @@ function(Tone){
|
||||||
Object.defineProperty(Tone.Source.prototype, "mute", {
|
Object.defineProperty(Tone.Source.prototype, "mute", {
|
||||||
get : function(){
|
get : function(){
|
||||||
return this._volume.mute;
|
return this._volume.mute;
|
||||||
},
|
},
|
||||||
set : function(mute){
|
set : function(mute){
|
||||||
this._volume.mute = mute;
|
this._volume.mute = mute;
|
||||||
}
|
}
|
||||||
|
@ -134,7 +134,7 @@ function(Tone){
|
||||||
Tone.Source.prototype._stop = Tone.noOp;
|
Tone.Source.prototype._stop = Tone.noOp;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start the source at the specified time. If no time is given,
|
* Start the source at the specified time. If no time is given,
|
||||||
* start the source now.
|
* start the source now.
|
||||||
* @param {Time} [time=now] When the source should be started.
|
* @param {Time} [time=now] When the source should be started.
|
||||||
* @returns {Tone.Source} this
|
* @returns {Tone.Source} this
|
||||||
|
@ -146,7 +146,7 @@ function(Tone){
|
||||||
time = Tone.Transport.seconds;
|
time = Tone.Transport.seconds;
|
||||||
} else {
|
} else {
|
||||||
time = this.toSeconds(time);
|
time = this.toSeconds(time);
|
||||||
}
|
}
|
||||||
//if it's started, stop it and restart it
|
//if it's started, stop it and restart it
|
||||||
if (!this.retrigger && this._state.getValueAtTime(time) === Tone.State.Started){
|
if (!this.retrigger && this._state.getValueAtTime(time) === Tone.State.Started){
|
||||||
this.stop(time);
|
this.stop(time);
|
||||||
|
@ -168,9 +168,9 @@ function(Tone){
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stop the source at the specified time. If no time is given,
|
* Stop the source at the specified time. If no time is given,
|
||||||
* stop the source now.
|
* stop the source now.
|
||||||
* @param {Time} [time=now] When the source should be stopped.
|
* @param {Time} [time=now] When the source should be stopped.
|
||||||
* @returns {Tone.Source} this
|
* @returns {Tone.Source} this
|
||||||
* @example
|
* @example
|
||||||
* source.stop(); // stops the source immediately
|
* source.stop(); // stops the source immediately
|
||||||
|
@ -188,14 +188,14 @@ function(Tone){
|
||||||
} else {
|
} else {
|
||||||
var sched = Tone.Transport.schedule(this._stop.bind(this), time);
|
var sched = Tone.Transport.schedule(this._stop.bind(this), time);
|
||||||
this._scheduled.push(sched);
|
this._scheduled.push(sched);
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sync the source to the Transport so that all subsequent
|
* Sync the source to the Transport so that all subsequent
|
||||||
* calls to `start` and `stop` are synced to the TransportTime
|
* calls to `start` and `stop` are synced to the TransportTime
|
||||||
* instead of the AudioContext time.
|
* instead of the AudioContext time.
|
||||||
*
|
*
|
||||||
* @returns {Tone.Source} this
|
* @returns {Tone.Source} this
|
||||||
* @example
|
* @example
|
||||||
|
@ -223,7 +223,7 @@ function(Tone){
|
||||||
var startOffset = offset - this.toSeconds(stateEvent.time);
|
var startOffset = offset - this.toSeconds(stateEvent.time);
|
||||||
var duration;
|
var duration;
|
||||||
if (stateEvent.duration){
|
if (stateEvent.duration){
|
||||||
duration = this.toSeconds(stateEvent.duration) - startOffset;
|
duration = this.toSeconds(stateEvent.duration) - startOffset;
|
||||||
}
|
}
|
||||||
this._start(time, this.toSeconds(stateEvent.offset) + startOffset, duration);
|
this._start(time, this.toSeconds(stateEvent.offset) + startOffset, duration);
|
||||||
}
|
}
|
||||||
|
@ -264,7 +264,7 @@ function(Tone){
|
||||||
* @return {Tone.Source} this
|
* @return {Tone.Source} this
|
||||||
*/
|
*/
|
||||||
Tone.Source.prototype.dispose = function(){
|
Tone.Source.prototype.dispose = function(){
|
||||||
Tone.prototype.dispose.call(this);
|
Tone.AudioNode.prototype.dispose.call(this);
|
||||||
this.unsync();
|
this.unsync();
|
||||||
this._scheduled = null;
|
this._scheduled = null;
|
||||||
this._writable("volume");
|
this._writable("volume");
|
||||||
|
@ -276,4 +276,4 @@ function(Tone){
|
||||||
};
|
};
|
||||||
|
|
||||||
return Tone.Source;
|
return Tone.Source;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
define(["Tone/core/Tone", "Tone/component/Volume"], function(Tone){
|
define(["Tone/core/Tone", "Tone/component/Volume", "Tone/core/AudioNode"], function(Tone){
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Tone.UserMedia uses MediaDevices.getUserMedia to open up
|
* @class Tone.UserMedia uses MediaDevices.getUserMedia to open up
|
||||||
* and external microphone or audio input. Check
|
* and external microphone or audio input. Check
|
||||||
* [MediaDevices API Support](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia)
|
* [MediaDevices API Support](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia)
|
||||||
* to see which browsers are supported. Access to an external input
|
* to see which browsers are supported. Access to an external input
|
||||||
* is limited to secure (HTTPS) connections.
|
* is limited to secure (HTTPS) connections.
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {Tone}
|
* @extends {Tone.AudioNode}
|
||||||
* @param {Decibels=} volume The level of the input
|
* @param {Decibels=} volume The level of the input
|
||||||
* @example
|
* @example
|
||||||
* //list the inputs and open the third one
|
* //list the inputs and open the third one
|
||||||
* var motu = new Tone.UserMedia();
|
* var motu = new Tone.UserMedia();
|
||||||
*
|
*
|
||||||
* //opening the input asks the user to activate their mic
|
* //opening the input asks the user to activate their mic
|
||||||
* motu.open().then(function(){
|
* motu.open().then(function(){
|
||||||
* //opening is activates the microphone
|
* //opening is activates the microphone
|
||||||
|
@ -27,15 +27,15 @@ define(["Tone/core/Tone", "Tone/component/Volume"], function(Tone){
|
||||||
Tone.UserMedia = function(){
|
Tone.UserMedia = function(){
|
||||||
|
|
||||||
var options = Tone.defaults(arguments, ["volume"], Tone.UserMedia);
|
var options = Tone.defaults(arguments, ["volume"], Tone.UserMedia);
|
||||||
Tone.call(this);
|
Tone.AudioNode.call(this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The MediaStreamNode
|
* The MediaStreamNode
|
||||||
* @type {MediaStreamAudioSourceNode}
|
* @type {MediaStreamAudioSourceNode}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this._mediaStream = null;
|
this._mediaStream = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The media stream created by getUserMedia.
|
* The media stream created by getUserMedia.
|
||||||
* @type {LocalMediaStream}
|
* @type {LocalMediaStream}
|
||||||
|
@ -70,7 +70,7 @@ define(["Tone/core/Tone", "Tone/component/Volume"], function(Tone){
|
||||||
this.mute = options.mute;
|
this.mute = options.mute;
|
||||||
};
|
};
|
||||||
|
|
||||||
Tone.extend(Tone.UserMedia);
|
Tone.extend(Tone.UserMedia, Tone.AudioNode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the default parameters
|
* the default parameters
|
||||||
|
@ -85,7 +85,7 @@ define(["Tone/core/Tone", "Tone/component/Volume"], function(Tone){
|
||||||
* Open the media stream. If a string is passed in, it is assumed
|
* Open the media stream. If a string is passed in, it is assumed
|
||||||
* to be the label or id of the stream, if a number is passed in,
|
* to be the label or id of the stream, if a number is passed in,
|
||||||
* it is the input number of the stream.
|
* it is the input number of the stream.
|
||||||
* @param {String|Number} [labelOrId="default"] The label or id of the audio input media device.
|
* @param {String|Number} [labelOrId="default"] The label or id of the audio input media device.
|
||||||
* With no argument, the default stream is opened.
|
* With no argument, the default stream is opened.
|
||||||
* @return {Promise} The promise is resolved when the stream is open.
|
* @return {Promise} The promise is resolved when the stream is open.
|
||||||
*/
|
*/
|
||||||
|
@ -121,7 +121,7 @@ define(["Tone/core/Tone", "Tone/component/Volume"], function(Tone){
|
||||||
this._mediaStream = this.context.createMediaStreamSource(stream);
|
this._mediaStream = this.context.createMediaStreamSource(stream);
|
||||||
//Connect the MediaStreamSourceNode to a gate gain node
|
//Connect the MediaStreamSourceNode to a gate gain node
|
||||||
this._mediaStream.connect(this.output);
|
this._mediaStream.connect(this.output);
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
@ -177,11 +177,11 @@ define(["Tone/core/Tone", "Tone/component/Volume"], function(Tone){
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an identifier for the represented device that is
|
* Returns an identifier for the represented device that is
|
||||||
* persisted across sessions. It is un-guessable by other applications and
|
* persisted across sessions. It is un-guessable by other applications and
|
||||||
* unique to the origin of the calling application. It is reset when the
|
* unique to the origin of the calling application. It is reset when the
|
||||||
* user clears cookies (for Private Browsing, a different identifier is
|
* user clears cookies (for Private Browsing, a different identifier is
|
||||||
* used that is not persisted across sessions). Returns undefined when the
|
* used that is not persisted across sessions). Returns undefined when the
|
||||||
* device is not open.
|
* device is not open.
|
||||||
* @type {String}
|
* @type {String}
|
||||||
* @readOnly
|
* @readOnly
|
||||||
|
@ -197,7 +197,7 @@ define(["Tone/core/Tone", "Tone/component/Volume"], function(Tone){
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a group identifier. Two devices have the
|
* Returns a group identifier. Two devices have the
|
||||||
* same group identifier if they belong to the same physical device.
|
* same group identifier if they belong to the same physical device.
|
||||||
* Returns undefined when the device is not open.
|
* Returns undefined when the device is not open.
|
||||||
* @type {String}
|
* @type {String}
|
||||||
|
@ -214,7 +214,7 @@ define(["Tone/core/Tone", "Tone/component/Volume"], function(Tone){
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a label describing this device (for example "Built-in Microphone").
|
* Returns a label describing this device (for example "Built-in Microphone").
|
||||||
* Returns undefined when the device is not open or label is not available
|
* Returns undefined when the device is not open or label is not available
|
||||||
* because of permissions.
|
* because of permissions.
|
||||||
* @type {String}
|
* @type {String}
|
||||||
|
@ -231,7 +231,7 @@ define(["Tone/core/Tone", "Tone/component/Volume"], function(Tone){
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mute the output.
|
* Mute the output.
|
||||||
* @memberOf Tone.UserMedia#
|
* @memberOf Tone.UserMedia#
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
* @name mute
|
* @name mute
|
||||||
|
@ -242,7 +242,7 @@ define(["Tone/core/Tone", "Tone/component/Volume"], function(Tone){
|
||||||
Object.defineProperty(Tone.UserMedia.prototype, "mute", {
|
Object.defineProperty(Tone.UserMedia.prototype, "mute", {
|
||||||
get : function(){
|
get : function(){
|
||||||
return this._volume.mute;
|
return this._volume.mute;
|
||||||
},
|
},
|
||||||
set : function(mute){
|
set : function(mute){
|
||||||
this._volume.mute = mute;
|
this._volume.mute = mute;
|
||||||
}
|
}
|
||||||
|
@ -253,7 +253,7 @@ define(["Tone/core/Tone", "Tone/component/Volume"], function(Tone){
|
||||||
* @return {Tone.UserMedia} this
|
* @return {Tone.UserMedia} this
|
||||||
*/
|
*/
|
||||||
Tone.UserMedia.prototype.dispose = function(){
|
Tone.UserMedia.prototype.dispose = function(){
|
||||||
Tone.prototype.dispose.call(this);
|
Tone.AudioNode.prototype.dispose.call(this);
|
||||||
this.close();
|
this.close();
|
||||||
this._writable("volume");
|
this._writable("volume");
|
||||||
this._volume.dispose();
|
this._volume.dispose();
|
||||||
|
@ -277,4 +277,4 @@ define(["Tone/core/Tone", "Tone/component/Volume"], function(Tone){
|
||||||
});
|
});
|
||||||
|
|
||||||
return Tone.UserMedia;
|
return Tone.UserMedia;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
define(["Tone/component/Panner", "helper/Basic", "helper/Offline", "Test", "Tone/signal/Signal",
|
define(["Tone/component/Panner", "helper/Basic", "helper/Offline", "Test", "Tone/signal/Signal",
|
||||||
"helper/PassAudio", "helper/PassAudioStereo", "Tone/component/Merge", "Tone/core/Tone", "helper/Supports"],
|
"helper/PassAudio", "helper/PassAudioStereo", "Tone/component/Merge", "Tone/core/Tone", "helper/Supports", "Tone/core/AudioNode"],
|
||||||
function (Panner, Basic, Offline, Test, Signal, PassAudio, PassAudioStereo, Merge, Tone, Supports) {
|
function (Panner, Basic, Offline, Test, Signal, PassAudio, PassAudioStereo, Merge, Tone, Supports, AudioNode) {
|
||||||
|
|
||||||
//a stereo signal for testing
|
//a stereo signal for testing
|
||||||
var StereoSignal = function(val){
|
var StereoSignal = function(val){
|
||||||
|
@ -15,7 +15,7 @@ function (Panner, Basic, Offline, Test, Signal, PassAudio, PassAudioStereo, Merg
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Tone.extend(StereoSignal);
|
Tone.extend(StereoSignal, AudioNode);
|
||||||
|
|
||||||
StereoSignal.prototype.dispose = function(){
|
StereoSignal.prototype.dispose = function(){
|
||||||
if (Panner.hasStereoPanner){
|
if (Panner.hasStereoPanner){
|
||||||
|
@ -190,4 +190,4 @@ function (Panner, Basic, Offline, Test, Signal, PassAudio, PassAudioStereo, Merg
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
define(["Test", "Tone/core/Bus", "Tone/core/Tone", "helper/Offline",
|
define(["Test", "Tone/core/Bus", "Tone/core/Tone", "helper/Offline",
|
||||||
"helper/PassAudio", "Tone/signal/Signal", "Tone/core/Gain", "Tone/component/Merge"],
|
"helper/PassAudio", "Tone/signal/Signal", "Tone/core/Gain", "Tone/component/Merge"],
|
||||||
function (Test, Bus, Tone, Offline, PassAudio, Signal, Gain, Merge) {
|
function (Test, Bus, Tone, Offline, PassAudio, Signal, Gain, Merge) {
|
||||||
|
|
||||||
describe("Bus", function(){
|
describe("Bus", function(){
|
||||||
|
@ -17,7 +17,7 @@ define(["Test", "Tone/core/Bus", "Tone/core/Tone", "helper/Offline",
|
||||||
send.send("test");
|
send.send("test");
|
||||||
recv.receive("test");
|
recv.receive("test");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it ("can create the recieve before the send", function(){
|
it ("can create the recieve before the send", function(){
|
||||||
return PassAudio(function(input){
|
return PassAudio(function(input){
|
||||||
|
@ -28,7 +28,7 @@ define(["Test", "Tone/core/Bus", "Tone/core/Tone", "helper/Offline",
|
||||||
recv.receive("test");
|
recv.receive("test");
|
||||||
send.send("test");
|
send.send("test");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it ("passes audio from a send to a receive at the given level", function(){
|
it ("passes audio from a send to a receive at the given level", function(){
|
||||||
return Offline(function(){
|
return Offline(function(){
|
||||||
|
@ -41,7 +41,7 @@ define(["Test", "Tone/core/Bus", "Tone/core/Tone", "helper/Offline",
|
||||||
expect(sample).to.be.closeTo(0.25, 0.1);
|
expect(sample).to.be.closeTo(0.25, 0.1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it ("can receive from a specific channel", function(){
|
it ("can receive from a specific channel", function(){
|
||||||
return Offline(function(){
|
return Offline(function(){
|
||||||
|
@ -55,6 +55,6 @@ define(["Test", "Tone/core/Bus", "Tone/core/Tone", "helper/Offline",
|
||||||
expect(r).to.be.closeTo(2, 0.01);
|
expect(r).to.be.closeTo(2, 0.01);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
define(["Test", "Tone/core/Master", "Tone/core/Tone", "helper/Offline", "helper/PassAudio", "Tone/source/Oscillator"],
|
define(["Test", "Tone/core/Master", "Tone/core/Tone", "helper/Offline", "helper/PassAudio", "Tone/source/Oscillator", "Tone/core/AudioNode"],
|
||||||
function (Test, Master, Tone, Offline, PassAudio, Oscillator) {
|
function (Test, Master, Tone, Offline, PassAudio, Oscillator, AudioNode) {
|
||||||
|
|
||||||
describe("Master", function(){
|
describe("Master", function(){
|
||||||
it ("exists", function(){
|
it ("exists", function(){
|
||||||
|
@ -7,7 +7,7 @@ define(["Test", "Tone/core/Master", "Tone/core/Tone", "helper/Offline", "helper/
|
||||||
});
|
});
|
||||||
|
|
||||||
it ("provides a toMaster method", function(){
|
it ("provides a toMaster method", function(){
|
||||||
expect(Tone.prototype.toMaster).is.a("function");
|
expect(AudioNode.prototype.toMaster).is.a("function");
|
||||||
var gain = Tone.context.createGain();
|
var gain = Tone.context.createGain();
|
||||||
expect(gain.toMaster).is.a("function");
|
expect(gain.toMaster).is.a("function");
|
||||||
gain.toMaster();
|
gain.toMaster();
|
||||||
|
@ -50,4 +50,4 @@ define(["Test", "Tone/core/Master", "Tone/core/Tone", "helper/Offline", "helper/
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue