From 982e31c099adda853ac5dabaeaa4b5535c7100e2 Mon Sep 17 00:00:00 2001 From: Yotam Mann Date: Tue, 22 Aug 2017 11:44:12 -0400 Subject: [PATCH] adding Gain typedef --- Tone/core/Gain.js | 10 ++--- Tone/type/Type.js | 103 +++++++++++++++++++++++++--------------------- 2 files changed, 60 insertions(+), 53 deletions(-) diff --git a/Tone/core/Gain.js b/Tone/core/Gain.js index c757326c..b546c9a1 100644 --- a/Tone/core/Gain.js +++ b/Tone/core/Gain.js @@ -13,10 +13,10 @@ define(["Tone/core/Tone", "Tone/core/Param", "Tone/type/Type"], function (Tone) /** * @class A thin wrapper around the Native Web Audio GainNode. * The GainNode is a basic building block of the Web Audio - * API and is useful for routing audio and adjusting gains. + * API and is useful for routing audio and adjusting gains. * @extends {Tone} * @param {Number=} gain The initial gain of the GainNode - * @param {Tone.Type=} units The units of the gain parameter. + * @param {Tone.Type=} units The units of the gain parameter. */ Tone.Gain = function(){ @@ -31,11 +31,11 @@ define(["Tone/core/Tone", "Tone/core/Param", "Tone/type/Type"], function (Tone) /** * The gain parameter of the gain node. - * @type {Tone.Param} + * @type {Gain} * @signal */ this.gain = new Tone.Param({ - "param" : this._gainNode.gain, + "param" : this._gainNode.gain, "units" : options.units, "value" : options.gain, "convert" : options.convert @@ -95,4 +95,4 @@ define(["Tone/core/Tone", "Tone/core/Param", "Tone/type/Type"], function (Tone) /////////////////////////////////////////////////////////////////////////// return Tone.Gain; -}); \ No newline at end of file +}); diff --git a/Tone/type/Type.js b/Tone/type/Type.js index e8c3d42d..8b9bb3cc 100644 --- a/Tone/type/Type.js +++ b/Tone/type/Type.js @@ -1,5 +1,5 @@ define(["Tone/core/Tone", "Tone/type/Time", "Tone/type/Frequency", "Tone/type/TransportTime", "Tone/core/Context"], -function (Tone) { +function (Tone) { /////////////////////////////////////////////////////////////////////////// // TYPES @@ -10,7 +10,7 @@ function (Tone) { * @enum {String} */ Tone.Type = { - /** + /** * Default units * @typedef {Default} */ @@ -21,129 +21,136 @@ function (Tone) { * - * + * * @typedef {Time} */ Time : "time", /** * Frequency can be described similar to time, except ultimately the * values are converted to frequency instead of seconds. A number - * is taken literally as the value in hertz. Additionally any of the + * is taken literally as the value in hertz. Additionally any of the * Time encodings can be used. Note names in the form * of NOTE OCTAVE (i.e. C4) are also accepted and converted to their - * frequency value. + * frequency value. * @typedef {Frequency} */ Frequency : "frequency", /** * TransportTime describes a position along the Transport's timeline. It is * similar to Time in that it uses all the same encodings, but TransportTime specifically - * pertains to the Transport's timeline, which is startable, stoppable, loopable, and seekable. + * pertains to the Transport's timeline, which is startable, stoppable, loopable, and seekable. * [Read more](https://github.com/Tonejs/Tone.js/wiki/TransportTime) * @typedef {TransportTime} */ TransportTime : "transportTime", - /** + /** * Ticks are the basic subunit of the Transport. They are * the smallest unit of time that the Transport supports. * @typedef {Ticks} */ Ticks : "ticks", - /** + /** * Normal values are within the range [0, 1]. * @typedef {NormalRange} */ NormalRange : "normalRange", - /** + /** * AudioRange values are between [-1, 1]. * @typedef {AudioRange} */ AudioRange : "audioRange", - /** + /** * Decibels are a logarithmic unit of measurement which is useful for volume - * because of the logarithmic way that we perceive loudness. 0 decibels - * means no change in volume. -10db is approximately half as loud and 10db - * is twice is loud. + * because of the logarithmic way that we perceive loudness. 0 decibels + * means no change in volume. -10db is approximately half as loud and 10db + * is twice is loud. * @typedef {Decibels} */ Decibels : "db", - /** + /** * Half-step note increments, i.e. 12 is an octave above the root. and 1 is a half-step up. * @typedef {Interval} */ Interval : "interval", - /** - * Beats per minute. + /** + * Beats per minute. * @typedef {BPM} */ BPM : "bpm", - /** + /** * The value must be greater than or equal to 0. * @typedef {Positive} */ Positive : "positive", - /** - * A cent is a hundredth of a semitone. + /** + * Gain is the ratio between input and output of a signal. + * A gain of 0 is the same as silencing the signal. A gain of + * 1, causes no change to the incoming signal. + * @typedef {Gain} + */ + Gain : "gain", + /** + * A cent is a hundredth of a semitone. * @typedef {Cents} */ Cents : "cents", - /** - * Angle between 0 and 360. + /** + * Angle between 0 and 360. * @typedef {Degrees} */ Degrees : "degrees", - /** + /** * A number representing a midi note. * @typedef {MIDI} */ MIDI : "midi", - /** + /** * A colon-separated representation of time in the form of - * Bars:Beats:Sixteenths. + * Bars:Beats:Sixteenths. * @typedef {BarsBeatsSixteenths} */ BarsBeatsSixteenths : "barsBeatsSixteenths", - /** + /** * Sampling is the reduction of a continuous signal to a discrete signal. - * Audio is typically sampled 44100 times per second. + * Audio is typically sampled 44100 times per second. * @typedef {Samples} */ Samples : "samples", - /** + /** * Hertz are a frequency representation defined as one cycle per second. * @typedef {Hertz} */ Hertz : "hertz", - /** - * A frequency represented by a letter name, + /** + * A frequency represented by a letter name, * accidental and octave. This system is known as * [Scientific Pitch Notation](https://en.wikipedia.org/wiki/Scientific_pitch_notation). * @typedef {Note} */ Note : "note", - /** - * One millisecond is a thousandth of a second. + /** + * One millisecond is a thousandth of a second. * @typedef {Milliseconds} */ Milliseconds : "milliseconds", - /** - * Seconds are the time unit of the AudioContext. In the end, - * all values need to be evaluated to seconds. + /** + * Seconds are the time unit of the AudioContext. In the end, + * all values need to be evaluated to seconds. * @typedef {Seconds} */ Seconds : "seconds", - /** - * A string representing a duration relative to a measure. + /** + * A string representing a duration relative to a measure. *