mirror of
https://github.com/Tonejs/Tone.js
synced 2024-11-16 16:48:00 +00:00
JSDoc'ing sources
This commit is contained in:
parent
33a759021b
commit
4e77c61638
7 changed files with 147 additions and 76 deletions
|
@ -9,6 +9,8 @@ define(["Tone/core/Tone", "Tone/source/Source"], function(Tone){
|
|||
* @constructor
|
||||
* @extends {Tone.Source}
|
||||
* @param {string} type the noise type (white|pink|brown)
|
||||
* @example
|
||||
* var noise = new Tone.Noise("pink");
|
||||
*/
|
||||
Tone.Noise = function(){
|
||||
|
||||
|
@ -49,6 +51,8 @@ define(["Tone/core/Tone", "Tone/source/Source"], function(Tone){
|
|||
* @memberOf Tone.Noise#
|
||||
* @type {string}
|
||||
* @name type
|
||||
* @example
|
||||
* noise.type = "white";
|
||||
*/
|
||||
Object.defineProperty(Tone.Noise.prototype, "type", {
|
||||
get : function(){
|
||||
|
|
|
@ -13,6 +13,8 @@ function(Tone){
|
|||
* @constructor
|
||||
* @param {frequency} frequency frequency of the oscillator (meaningless for noise types)
|
||||
* @param {string} type the type of the oscillator
|
||||
* @example
|
||||
* var omniOsc = new Tone.OmniOscillator("C#4", "pwm");
|
||||
*/
|
||||
Tone.OmniOscillator = function(){
|
||||
var options = this.optionsObject(arguments, ["frequency", "type"], Tone.OmniOscillator.defaults);
|
||||
|
@ -64,6 +66,16 @@ function(Tone){
|
|||
"modulationFrequency" : 0.4, //only applies if the oscillator is set to "pwm",
|
||||
};
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @private
|
||||
*/
|
||||
var OmniOscType = {
|
||||
PulseOscillator : "PulseOscillator",
|
||||
PWMOscillator : "PWMOscillator",
|
||||
Oscillator : "Oscillator"
|
||||
};
|
||||
|
||||
/**
|
||||
* start the oscillator
|
||||
* @param {Tone.Time} [time=now] the time to start the oscillator
|
||||
|
@ -141,7 +153,7 @@ function(Tone){
|
|||
};
|
||||
|
||||
/**
|
||||
* the phase of the oscillator in degrees
|
||||
* The phase of the oscillator in degrees
|
||||
* @memberOf Tone.OmniOscillator#
|
||||
* @type {number}
|
||||
* @name phase
|
||||
|
@ -156,10 +168,14 @@ function(Tone){
|
|||
});
|
||||
|
||||
/**
|
||||
* The width Signal of the oscillator (only if the oscillator is set to pulse)
|
||||
* @memberOf Tone.PulseOscillator#
|
||||
* The width of the oscillator (only if the oscillator is set to pulse)
|
||||
* @memberOf Tone.OmniOscillator#
|
||||
* @type {Tone.Signal}
|
||||
* @name width
|
||||
* @example
|
||||
* var omniOsc = new Tone.OmniOscillator(440, "pulse");
|
||||
* //can access the width attribute only if type === "pulse"
|
||||
* omniOsc.width.value = 0.2;
|
||||
*/
|
||||
Object.defineProperty(Tone.OmniOscillator.prototype, "width", {
|
||||
get : function(){
|
||||
|
@ -171,10 +187,14 @@ function(Tone){
|
|||
|
||||
/**
|
||||
* The modulationFrequency Signal of the oscillator
|
||||
* (only if the oscillator type is set to pwm)
|
||||
* @memberOf Tone.PulseOscillator#
|
||||
* (only if the oscillator type is set to pwm).
|
||||
* @memberOf Tone.OmniOscillator#
|
||||
* @type {Tone.Signal}
|
||||
* @name width
|
||||
* @name modulationFrequency
|
||||
* @example
|
||||
* var omniOsc = new Tone.OmniOscillator(440, "pwm");
|
||||
* //can access the modulationFrequency attribute only if type === "pwm"
|
||||
* omniOsc.modulationFrequency.value = 0.2;
|
||||
*/
|
||||
Object.defineProperty(Tone.OmniOscillator.prototype, "modulationFrequency", {
|
||||
get : function(){
|
||||
|
@ -186,7 +206,6 @@ function(Tone){
|
|||
|
||||
/**
|
||||
* clean up
|
||||
* @private
|
||||
* @return {Tone.OmniOscillator} `this`
|
||||
*/
|
||||
Tone.OmniOscillator.prototype.dispose = function(){
|
||||
|
@ -201,14 +220,5 @@ function(Tone){
|
|||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
var OmniOscType = {
|
||||
PulseOscillator : "PulseOscillator",
|
||||
PWMOscillator : "PWMOscillator",
|
||||
Oscillator : "Oscillator"
|
||||
};
|
||||
|
||||
return Tone.OmniOscillator;
|
||||
});
|
|
@ -10,6 +10,8 @@ function(Tone){
|
|||
* @extends {Tone.Source}
|
||||
* @param {number|string} [frequency=440] starting frequency
|
||||
* @param {string} [type="sine"] type of oscillator (sine|square|triangle|sawtooth)
|
||||
* @example
|
||||
* var osc = new Tone.Oscillator(440, "sine");
|
||||
*/
|
||||
Tone.Oscillator = function(){
|
||||
|
||||
|
@ -24,13 +26,13 @@ function(Tone){
|
|||
this._oscillator = null;
|
||||
|
||||
/**
|
||||
* the frequency control signal
|
||||
* The frequency control signal in hertz.
|
||||
* @type {Tone.Signal}
|
||||
*/
|
||||
this.frequency = new Tone.Signal(options.frequency, Tone.Signal.Units.Frequency);
|
||||
|
||||
/**
|
||||
* the detune control signal
|
||||
* The detune control signal in cents.
|
||||
* @type {Tone.Signal}
|
||||
*/
|
||||
this.detune = new Tone.Signal(options.detune);
|
||||
|
@ -95,6 +97,7 @@ function(Tone){
|
|||
|
||||
/**
|
||||
* stop the oscillator
|
||||
* @private
|
||||
* @param {Tone.Time} [time=now] (optional) timing parameter
|
||||
* @returns {Tone.Oscillator} `this`
|
||||
*/
|
||||
|
@ -107,8 +110,15 @@ function(Tone){
|
|||
};
|
||||
|
||||
/**
|
||||
* sync the signal to the Transport's bpm
|
||||
* Sync the signal to the Transport's bpm. Any changes to the transports bpm,
|
||||
* will also affect the oscillators frequency.
|
||||
* @returns {Tone.Oscillator} `this`
|
||||
* @example
|
||||
* Tone.Transport.bpm.value = 120;
|
||||
* osc.frequency.value = 440;
|
||||
* osc.syncFrequency();
|
||||
* Tone.Transport.bpm.value = 240;
|
||||
* // the frequency of the oscillator is doubled to 880
|
||||
*/
|
||||
Tone.Oscillator.prototype.syncFrequency = function(){
|
||||
Tone.Transport.syncSignal(this.frequency);
|
||||
|
@ -116,7 +126,8 @@ function(Tone){
|
|||
};
|
||||
|
||||
/**
|
||||
* unsync the oscillator's frequency from teh transprot
|
||||
* Unsync the oscillator's frequency from the Transport.
|
||||
* See {@link Tone.Oscillator#syncFrequency}.
|
||||
* @returns {Tone.Oscillator} `this`
|
||||
*/
|
||||
Tone.Oscillator.prototype.unsyncFrequency = function(){
|
||||
|
@ -125,16 +136,19 @@ function(Tone){
|
|||
};
|
||||
|
||||
/**
|
||||
* The type of the oscillator. sine, square, triangle, sawtooth
|
||||
* The type of the oscillator: either sine, square, triangle, or sawtooth.
|
||||
*
|
||||
* uses PeriodicWave even for native types so that it can set the phase
|
||||
* Uses PeriodicWave internally even for native types so that it can set the phase.
|
||||
*
|
||||
* the the PeriodicWave equations are from the Web Audio Source code
|
||||
* here: https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/modules/webaudio/PeriodicWave.cpp&sq=package:chromium
|
||||
* PeriodicWave equations are from the Web Audio Source code:
|
||||
* https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/modules/webaudio/PeriodicWave.cpp&sq=package:chromium
|
||||
*
|
||||
* @memberOf Tone.Oscillator#
|
||||
* @type {string}
|
||||
* @name type
|
||||
* @example
|
||||
* osc.type = "square";
|
||||
* osc.type; //returns "square"
|
||||
*/
|
||||
Object.defineProperty(Tone.Oscillator.prototype, "type", {
|
||||
get : function(){
|
||||
|
@ -193,10 +207,12 @@ function(Tone){
|
|||
});
|
||||
|
||||
/**
|
||||
* the phase of the oscillator in degrees
|
||||
* The phase of the oscillator in degrees.
|
||||
* @memberOf Tone.Oscillator#
|
||||
* @type {number}
|
||||
* @name phase
|
||||
* @example
|
||||
* osc.phase = 180; //flips the phase of the oscillator
|
||||
*/
|
||||
Object.defineProperty(Tone.Oscillator.prototype, "phase", {
|
||||
get : function(){
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
define(["Tone/core/Tone", "Tone/source/Source", "Tone/source/PulseOscillator", "Tone/source/Oscillator"],
|
||||
define(["Tone/core/Tone", "Tone/source/Source", "Tone/source/PulseOscillator", "Tone/source/Oscillator", "Tone/signal/Multiply"],
|
||||
function(Tone){
|
||||
|
||||
"use strict";
|
||||
|
@ -10,7 +10,9 @@ function(Tone){
|
|||
* @extends {Tone.Oscillator}
|
||||
* @constructor
|
||||
* @param {frequency} frequency frequency of the oscillator (meaningless for noise types)
|
||||
* @param {string} type the type of the oscillator
|
||||
* @param {number} modulationFrequency the modulation frequency of the oscillator
|
||||
* @example
|
||||
* var pwm = new Tone.PWMOscillator("Ab3", 0.3);
|
||||
*/
|
||||
Tone.PWMOscillator = function(){
|
||||
var options = this.optionsObject(arguments, ["frequency", "modulationFrequency"], Tone.PWMOscillator.defaults);
|
||||
|
@ -25,12 +27,22 @@ function(Tone){
|
|||
|
||||
/**
|
||||
* the modulator
|
||||
* @type {Tone.Oscillator}
|
||||
* @private
|
||||
*/
|
||||
this._modulator = new Tone.Oscillator({
|
||||
"frequency" : options.frequency,
|
||||
"detune" : options.detune
|
||||
});
|
||||
|
||||
/**
|
||||
* Scale the oscillator so it doesn't go silent
|
||||
* at the extreme values.
|
||||
* @type {Tone.Multiply}
|
||||
* @private
|
||||
*/
|
||||
this._scale = new Tone.Multiply(1.01);
|
||||
|
||||
/**
|
||||
* the frequency control
|
||||
* @type {Tone.Signal}
|
||||
|
@ -50,7 +62,7 @@ function(Tone){
|
|||
this.modulationFrequency = this._pulse.frequency;
|
||||
|
||||
//connections
|
||||
this._modulator.connect(this._pulse.width);
|
||||
this._modulator.chain(this._scale, this._pulse.width);
|
||||
this._pulse.connect(this.output);
|
||||
};
|
||||
|
||||
|
@ -91,8 +103,8 @@ function(Tone){
|
|||
};
|
||||
|
||||
/**
|
||||
* The type of the oscillator.
|
||||
*
|
||||
* The type of the oscillator. Always returns "pwm".
|
||||
* @readOnly
|
||||
* @memberOf Tone.PWMOscillator#
|
||||
* @type {string}
|
||||
* @name type
|
||||
|
@ -104,7 +116,7 @@ function(Tone){
|
|||
});
|
||||
|
||||
/**
|
||||
* the phase of the oscillator in degrees
|
||||
* The phase of the oscillator in degrees.
|
||||
* @memberOf Tone.PWMOscillator#
|
||||
* @type {number}
|
||||
* @name phase
|
||||
|
@ -126,6 +138,8 @@ function(Tone){
|
|||
Tone.Source.prototype.dispose.call(this);
|
||||
this._pulse.dispose();
|
||||
this._pulse = null;
|
||||
this._scale.dispose();
|
||||
this._scale = null;
|
||||
this._modulator.dispose();
|
||||
this._modulator = null;
|
||||
this.frequency = null;
|
||||
|
|
|
@ -7,8 +7,12 @@ define(["Tone/core/Tone", "Tone/core/Buffer", "Tone/source/Source"], function(To
|
|||
*
|
||||
* @constructor
|
||||
* @extends {Tone.Source}
|
||||
* @param {string|AudioBuffer} url either the AudioBuffer or the url from
|
||||
* @param {string|AudioBuffer} url Either the AudioBuffer or the url from
|
||||
* which to load the AudioBuffer
|
||||
* @param {function=} onload The function to invoke when the buffer is loaded.
|
||||
* Recommended to use {@link Tone.Buffer#onload} instead.
|
||||
* @example
|
||||
* var player = new Tone.Player("./path/to/sample.mp3");
|
||||
*/
|
||||
Tone.Player = function(){
|
||||
|
||||
|
@ -38,12 +42,14 @@ define(["Tone/core/Tone", "Tone/core/Buffer", "Tone/source/Source"], function(To
|
|||
/**
|
||||
* if 'loop' is true, the loop will start at this position
|
||||
* @type {Tone.Time}
|
||||
* @private
|
||||
*/
|
||||
this._loopStart = options.loopStart;
|
||||
|
||||
/**
|
||||
* if 'loop' is true, the loop will end at this position
|
||||
* @type {Tone.Time}
|
||||
* @private
|
||||
*/
|
||||
this._loopEnd = options.loopEnd;
|
||||
|
||||
|
@ -55,9 +61,8 @@ define(["Tone/core/Tone", "Tone/core/Buffer", "Tone/source/Source"], function(To
|
|||
this._playbackRate = options.playbackRate;
|
||||
|
||||
/**
|
||||
* enabling retrigger will allow a player to be restarted
|
||||
* before the the previous 'start' is done playing
|
||||
*
|
||||
* Enabling retrigger will allow a player to be restarted
|
||||
* before the the previous 'start' is done playing.
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.retrigger = options.retrigger;
|
||||
|
@ -77,14 +82,17 @@ define(["Tone/core/Tone", "Tone/core/Buffer", "Tone/source/Source"], function(To
|
|||
"loop" : false,
|
||||
"loopStart" : 0,
|
||||
"loopEnd" : 0,
|
||||
"retrigger" : false
|
||||
"retrigger" : false,
|
||||
};
|
||||
|
||||
/**
|
||||
* Load the audio file as an audio buffer.
|
||||
* Decodes the audio asynchronously and invokes
|
||||
* the callback once the audio buffer loads.
|
||||
* @param {string} url the url of the buffer to load.
|
||||
* Note: this does not need to be called, if a url
|
||||
* was passed in to the constructor. Only use this
|
||||
* if you want to manually load a new url.
|
||||
* @param {string} url The url of the buffer to load.
|
||||
* filetype support depends on the
|
||||
* browser.
|
||||
* @param {function(Tone.Player)=} callback
|
||||
|
@ -159,10 +167,14 @@ define(["Tone/core/Tone", "Tone/core/Buffer", "Tone/source/Source"], function(To
|
|||
};
|
||||
|
||||
/**
|
||||
* set the loop start and end
|
||||
* @param {Tone.Time} loopStart the loop end time
|
||||
* @param {Tone.Time} loopEnd the loop end time
|
||||
* Set the loop start and end. Will only loop if `loop` is
|
||||
* set to `true`.
|
||||
* @param {Tone.Time} loopStart The loop end time
|
||||
* @param {Tone.Time} loopEnd The loop end time
|
||||
* @returns {Tone.Player} `this`
|
||||
* @example
|
||||
* player.setLoopPoints(0.2, 0.3);
|
||||
* player.loop = true;
|
||||
*/
|
||||
Tone.Player.prototype.setLoopPoints = function(loopStart, loopEnd){
|
||||
this.loopStart = loopStart;
|
||||
|
@ -171,7 +183,7 @@ define(["Tone/core/Tone", "Tone/core/Buffer", "Tone/source/Source"], function(To
|
|||
};
|
||||
|
||||
/**
|
||||
* if 'loop' is true, the loop will start at this position
|
||||
* If `loop` is true, the loop will start at this position.
|
||||
* @memberOf Tone.Player#
|
||||
* @type {Tone.Time}
|
||||
* @name loopStart
|
||||
|
@ -189,7 +201,7 @@ define(["Tone/core/Tone", "Tone/core/Buffer", "Tone/source/Source"], function(To
|
|||
});
|
||||
|
||||
/**
|
||||
* if 'loop' is true, the loop will end at this position
|
||||
* If `loop` is true, the loop will end at this position.
|
||||
* @memberOf Tone.Player#
|
||||
* @type {Tone.Time}
|
||||
* @name loopEnd
|
||||
|
@ -222,7 +234,7 @@ define(["Tone/core/Tone", "Tone/core/Buffer", "Tone/source/Source"], function(To
|
|||
});
|
||||
|
||||
/**
|
||||
* if the buffer should loop once it's over
|
||||
* If the buffer should loop once it's over.
|
||||
* @memberOf Tone.Player#
|
||||
* @type {boolean}
|
||||
* @name loop
|
||||
|
|
|
@ -9,7 +9,9 @@ function(Tone){
|
|||
* @constructor
|
||||
* @extends {Tone.Oscillator}
|
||||
* @param {number} [frequency=440] the frequency of the oscillator
|
||||
* @param {number} [width = 0.5] the width of the pulse
|
||||
* @param {number} [width = 0.2] the width of the pulse
|
||||
* @example
|
||||
* var pulse = new Tone.PulseOscillator("E5", 0.4);
|
||||
*/
|
||||
Tone.PulseOscillator = function(){
|
||||
|
||||
|
@ -25,6 +27,7 @@ function(Tone){
|
|||
/**
|
||||
* gate the width amount
|
||||
* @type {GainNode}
|
||||
* @private
|
||||
*/
|
||||
this._widthGate = this.context.createGain();
|
||||
|
||||
|
@ -41,20 +44,19 @@ function(Tone){
|
|||
});
|
||||
|
||||
/**
|
||||
* the oscillators frequency
|
||||
* The frequency in hertz
|
||||
* @type {Tone.Signal}
|
||||
*/
|
||||
this.frequency = this._sawtooth.frequency;
|
||||
|
||||
/**
|
||||
* the oscillators detune
|
||||
* The detune in cents.
|
||||
* @type {Tone.Signal}
|
||||
*/
|
||||
this.detune = this._sawtooth.detune;
|
||||
|
||||
/**
|
||||
* threshold the signal to turn it into a square
|
||||
*
|
||||
* Threshold the signal to turn it into a square
|
||||
* @type {Tone.WaveShaper}
|
||||
* @private
|
||||
*/
|
||||
|
@ -74,8 +76,7 @@ function(Tone){
|
|||
Tone.extend(Tone.PulseOscillator, Tone.Oscillator);
|
||||
|
||||
/**
|
||||
* the default parameters
|
||||
*
|
||||
* The default parameters.
|
||||
* @static
|
||||
* @const
|
||||
* @type {Object}
|
||||
|
@ -101,7 +102,7 @@ function(Tone){
|
|||
/**
|
||||
* stop the oscillator
|
||||
* @param {Tone.Time} time
|
||||
* @returns {Tone.PulseOscillator} `this`
|
||||
* @private
|
||||
*/
|
||||
Tone.PulseOscillator.prototype._stop = function(time){
|
||||
time = this.toSeconds(time);
|
||||
|
@ -112,7 +113,7 @@ function(Tone){
|
|||
};
|
||||
|
||||
/**
|
||||
* the phase of the oscillator in degrees
|
||||
* The phase of the oscillator in degrees.
|
||||
* @memberOf Tone.PulseOscillator#
|
||||
* @type {number}
|
||||
* @name phase
|
||||
|
@ -127,7 +128,8 @@ function(Tone){
|
|||
});
|
||||
|
||||
/**
|
||||
* The type of the oscillator.
|
||||
* The type of the oscillator. Always returns "pulse".
|
||||
* @readOnly
|
||||
* @memberOf Tone.PulseOscillator#
|
||||
* @type {string}
|
||||
* @name type
|
||||
|
@ -139,7 +141,7 @@ function(Tone){
|
|||
});
|
||||
|
||||
/**
|
||||
* clean up method
|
||||
* Clean up method
|
||||
* @return {Tone.PulseOscillator} `this`
|
||||
*/
|
||||
Tone.PulseOscillator.prototype.dispose = function(){
|
||||
|
|
|
@ -17,8 +17,12 @@ define(["Tone/core/Tone", "Tone/core/Transport", "Tone/core/Master"], function(T
|
|||
options = this.defaultArg(options, Tone.Source.defaults);
|
||||
|
||||
/**
|
||||
* the onended callback when the source is done playing
|
||||
* The onended callback when the source is done playing.
|
||||
* @type {function}
|
||||
* @example
|
||||
* source.onended = function(){
|
||||
* console.log("the source is done playing");
|
||||
* }
|
||||
*/
|
||||
this.onended = options.onended;
|
||||
|
||||
|
@ -37,8 +41,10 @@ define(["Tone/core/Tone", "Tone/core/Transport", "Tone/core/Master"], function(T
|
|||
this._nextStop = Infinity;
|
||||
|
||||
/**
|
||||
* the volume of the output in decibels
|
||||
* The volume of the output in decibels.
|
||||
* @type {Tone.Signal}
|
||||
* @example
|
||||
* source.volume.value = -6;
|
||||
*/
|
||||
this.volume = new Tone.Signal(this.output.gain, Tone.Signal.Units.Decibels);
|
||||
|
||||
|
@ -54,8 +60,7 @@ define(["Tone/core/Tone", "Tone/core/Transport", "Tone/core/Master"], function(T
|
|||
Tone.extend(Tone.Source);
|
||||
|
||||
/**
|
||||
* the default parameters
|
||||
*
|
||||
* The default parameters
|
||||
* @static
|
||||
* @const
|
||||
* @type {Object}
|
||||
|
@ -66,7 +71,16 @@ define(["Tone/core/Tone", "Tone/core/Transport", "Tone/core/Master"], function(T
|
|||
};
|
||||
|
||||
/**
|
||||
* The state of the source.
|
||||
* @enum {string}
|
||||
*/
|
||||
Tone.Source.State = {
|
||||
STARTED : "started",
|
||||
PAUSED : "paused",
|
||||
STOPPED : "stopped",
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the playback state of the source, either "started" or "stopped".
|
||||
* @type {Tone.Source.State}
|
||||
* @readOnly
|
||||
* @memberOf Tone.Source#
|
||||
|
@ -99,6 +113,8 @@ define(["Tone/core/Tone", "Tone/core/Transport", "Tone/core/Master"], function(T
|
|||
* Start the source at the time.
|
||||
* @param {Tone.Time} [time=now]
|
||||
* @returns {Tone.Source} `this`
|
||||
* @example
|
||||
* source.start("+0.5"); //starts the source 0.5 seconds from now
|
||||
*/
|
||||
Tone.Source.prototype.start = function(time){
|
||||
time = this.toSeconds(time);
|
||||
|
@ -114,6 +130,8 @@ define(["Tone/core/Tone", "Tone/core/Transport", "Tone/core/Master"], function(T
|
|||
* stop the source
|
||||
* @param {Tone.Time} [time=now]
|
||||
* @returns {Tone.Source} `this`
|
||||
* @example
|
||||
* source.stop(); // stops the source immediately
|
||||
*/
|
||||
Tone.Source.prototype.stop = function(time){
|
||||
var now = this.now();
|
||||
|
@ -134,6 +152,8 @@ define(["Tone/core/Tone", "Tone/core/Transport", "Tone/core/Master"], function(T
|
|||
};
|
||||
|
||||
/**
|
||||
* Not ready yet.
|
||||
* @private
|
||||
* @abstract
|
||||
* @param {Tone.Time} time
|
||||
* @returns {Tone.Source} `this`
|
||||
|
@ -145,9 +165,12 @@ define(["Tone/core/Tone", "Tone/core/Transport", "Tone/core/Master"], function(T
|
|||
};
|
||||
|
||||
/**
|
||||
* sync the source to the Transport
|
||||
* Sync the source to the Transport so that when the transport
|
||||
* is started, this source is started and when the transport is stopped
|
||||
* or paused, so is the source.
|
||||
*
|
||||
* @param {Tone.Time} [delay=0] delay time before starting the source
|
||||
* @param {Tone.Time} [delay=0] Delay time before starting the source after the
|
||||
* Transport has started.
|
||||
* @returns {Tone.Source} `this`
|
||||
*/
|
||||
Tone.Source.prototype.sync = function(delay){
|
||||
|
@ -156,7 +179,7 @@ define(["Tone/core/Tone", "Tone/core/Transport", "Tone/core/Master"], function(T
|
|||
};
|
||||
|
||||
/**
|
||||
* unsync the source to the Transport
|
||||
* Unsync the source to the Transport. See {@link Tone.Source#sync}
|
||||
* @returns {Tone.Source} `this`
|
||||
*/
|
||||
Tone.Source.prototype.unsync = function(){
|
||||
|
@ -177,15 +200,5 @@ define(["Tone/core/Tone", "Tone/core/Transport", "Tone/core/Master"], function(T
|
|||
this.volume = null;
|
||||
};
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
Tone.Source.State = {
|
||||
STARTED : "started",
|
||||
PAUSED : "paused",
|
||||
STOPPED : "stopped",
|
||||
WAITING : "waiting"
|
||||
};
|
||||
|
||||
return Tone.Source;
|
||||
});
|
Loading…
Reference in a new issue