Skip to content

Commit

Permalink
doc comments fixes (#222)
Browse files Browse the repository at this point in the history
* docs: remove @returns from @constructors, add @extends

* docs: fix property types

* various doc comments fixes

* more doc comments fixes, add missing member names, fix some types

* fix up property doc comments
  • Loading branch information
Spongman authored and therewasaguy committed Oct 25, 2017
1 parent da1d778 commit b1ab598
Show file tree
Hide file tree
Showing 16 changed files with 85 additions and 48 deletions.
2 changes: 1 addition & 1 deletion src/audioVoice.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ define(function() {
* should follow the API and implement the methods below in order to
* remain compatible with p5.PolySynth();
*
* @class AudioVoice
* @class p5.AudioVoice
* @constructor
*/
p5.AudioVoice = function () {
Expand Down
4 changes: 3 additions & 1 deletion src/compressor.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ define(function (require) {
* The p5.Compressor is built with a <a href="https://www.w3.org/TR/webaudio/#the-dynamicscompressornode-interface"
* target="_blank" title="W3 spec for Dynamics Compressor Node">Web Audio Dynamics Compressor Node
* </a>
* @property {WebAudioNode} compressor
* @property {AudioNode} compressor
*/


Expand Down Expand Up @@ -205,6 +205,8 @@ define(function (require) {

/**
* Return the current reduction value
*
* @method reduction
* @return {Number} Value of the amount of gain reduction that is applied to the signal
*/
p5.Compressor.prototype.reduction =function() {
Expand Down
8 changes: 4 additions & 4 deletions src/effect.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ define(function (require) {
*
* @class p5.Effect
* @constructor
*
*
* @param {Object} [ac] Reference to the audio context of the p5 object
* @param {WebAudioNode} [input] Gain Node effect wrapper
* @param {WebAudioNode} [output] Gain Node effect wrapper
* @param {AudioNode} [input] Gain Node effect wrapper
* @param {AudioNode} [output] Gain Node effect wrapper
* @param {Object} [_drywet] Tone.JS CrossFade node (defaults to value: 1)
* @param {WebAudioNode} [wet] Effects that extend this class should connect
* @param {AudioNode} [wet] Effects that extend this class should connect
* to the wet signal to this gain node, so that dry and wet
* signals are mixed properly.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/eq.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ define(function (require) {
* @method _newBand
* @param {Number} freq
* @param {Number} res
* @return {Obect} Abstracted Filter
* @return {Object} Abstracted Filter
*/
p5.EQ.prototype._newBand = function(freq, res) {
return new EQFilter(freq, res);
Expand Down
13 changes: 8 additions & 5 deletions src/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ define(function (require) {
* This is distinctly different from .amp() which is inherited from p5.Effect
* .amp() controls the volume via the output gain node
* p5.Filter.gain() controls the gain parameter of a Biquad Filter node.
*
*
* @method gain
* @param {Number} gain
* @return {Number} Returns the current or updated gain value
*/
Expand All @@ -218,6 +219,8 @@ define(function (require) {

/**
* Toggle function. Switches between the specified type and allpass
*
* @method toggle
* @return {boolean} [Toggle value]
*/
p5.Filter.prototype.toggle = function() {
Expand Down Expand Up @@ -261,7 +264,7 @@ define(function (require) {
*
* @class p5.LowPass
* @constructor
* @extends {p5.Filter}
* @extends p5.Filter
*/
p5.LowPass = function() {
p5.Filter.call(this, 'lowpass');
Expand All @@ -276,7 +279,7 @@ define(function (require) {
*
* @class p5.HighPass
* @constructor
* @extends {p5.Filter}
* @extends p5.Filter
*/
p5.HighPass = function() {
p5.Filter.call(this, 'highpass');
Expand All @@ -289,9 +292,9 @@ define(function (require) {
* its method <code>setType('bandpass')</code>.
* See p5.Filter for methods.
*
* @class BandPass
* @class p5.BandPass
* @constructor
* @extends {p5.Filter}
* @extends p5.Filter
*/
p5.BandPass = function() {
p5.Filter.call(this, 'bandpass');
Expand Down
1 change: 1 addition & 0 deletions src/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ define(function (require) {
* Returns the closest MIDI note value for
* a given frequency.
*
* @method freqToMidi
* @param {Number} frequency A freqeuncy, for example, the "A"
* above Middle C is 440Hz
* @return {Number} MIDI note value
Expand Down
30 changes: 16 additions & 14 deletions src/listener3d.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,20 +95,22 @@ define(function (require) {
return this.listener.positionZ.value;
};

/**
* Overrides the listener orient() method because Listener has slightly
* different params. In human terms, Forward vectors are the direction the
* nose is pointing. Up vectors are the direction of the top of the head.
*
* @param {Number} xValF Forward vector X direction
* @param {Number} yValF Forward vector Y direction
* @param {Number} zValF Forward vector Z direction
* @param {Number} xValU Up vector X direction
* @param {Number} yValU Up vector Y direction
* @param {Number} zValU Up vector Z direction
* @param {Number} time
* @return {Array} All orienation params
*/
// cannot define method when class definition is commented
// /**
// * Overrides the listener orient() method because Listener has slightly
// * different params. In human terms, Forward vectors are the direction the
// * nose is pointing. Up vectors are the direction of the top of the head.
// *
// * @method orient
// * @param {Number} xValF Forward vector X direction
// * @param {Number} yValF Forward vector Y direction
// * @param {Number} zValF Forward vector Z direction
// * @param {Number} xValU Up vector X direction
// * @param {Number} yValU Up vector Y direction
// * @param {Number} zValU Up vector Z direction
// * @param {Number} time
// * @return {Array} All orienation params
// */
p5.Listener3D.prototype.orient = function(xValF, yValF, zValF,
xValU, yValU, zValU, time) {

Expand Down
2 changes: 2 additions & 0 deletions src/looper.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ define(function (require) {
* Set the global tempo, in beats per minute, for all
* p5.Parts. This method will impact all active p5.Parts.
*
* @method setBPM
* @param {Number} BPM Beats Per Minute
* @param {Number} rampTime Seconds from now
*/
Expand Down Expand Up @@ -494,6 +495,7 @@ define(function (require) {
/**
* Set the tempo for all parts in the score
*
* @method setBPM
* @param {Number} BPM Beats Per Minute
* @param {Number} rampTime Seconds from now
*/
Expand Down
7 changes: 6 additions & 1 deletion src/monosynth.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ define(function (require) {
* value in Note/Octave format ("C4", "Eb3"...etc")
* See <a href = "https://github.com/Tonejs/Tone.js/wiki/Instruments">
* Tone</a>. Defaults to 440 hz
* @param {Number} secondsFromNow time from now (in seconds)
* @param {Number} [velocity] velocity of the note to play (ranging from 0 to 1)
* @param {Number} [secondsFromNow] time from now (in seconds) at which to play
* @method triggerAttack
Expand Down Expand Up @@ -159,8 +158,14 @@ define(function (require) {
/**
* Getters and Setters
* @property {Number} attack
*/
/**
* @property {Number} decay
*/
/**
* @property {Number} sustain
*/
/**
* @property {Number} release
*/
Object.defineProperties(p5.MonoSynth.prototype, {
Expand Down
1 change: 1 addition & 0 deletions src/noise.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ define(function (require) {
* Set the amplitude of the noise between 0 and 1.0. Or,
* modulate amplitude with an audio signal such as an oscillator.
*
* @method amp
* @param {Number|Object} volume amplitude between 0 and 1.0
* or modulating signal/oscillator
* @param {Number} [rampTime] create a fade that lasts rampTime
Expand Down
8 changes: 4 additions & 4 deletions src/oscillator.js
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ define(function (require) {
*
* @class p5.SinOsc
* @constructor
* @extends {p5.Oscillator}
* @extends p5.Oscillator
* @param {Number} [freq] Set the frequency
*/
p5.SinOsc = function(freq) {
Expand All @@ -516,7 +516,7 @@ define(function (require) {
*
* @class p5.TriOsc
* @constructor
* @extends {p5.Oscillator}
* @extends p5.Oscillator
* @param {Number} [freq] Set the frequency
*/
p5.TriOsc = function(freq) {
Expand All @@ -535,7 +535,7 @@ define(function (require) {
*
* @class p5.SawOsc
* @constructor
* @extends {p5.Oscillator}
* @extends p5.Oscillator
* @param {Number} [freq] Set the frequency
*/
p5.SawOsc = function(freq) {
Expand All @@ -554,7 +554,7 @@ define(function (require) {
*
* @class p5.SqrOsc
* @constructor
* @extends {p5.Oscillator}
* @extends p5.Oscillator
* @param {Number} [freq] Set the frequency
*/
p5.SqrOsc = function(freq) {
Expand Down
3 changes: 2 additions & 1 deletion src/panner3d.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ define(function (require) {
* href="https://www.w3.org/TR/webaudio/#idl-def-DistanceModelType"
* >distanceModel</a>: "linear", "inverse", or "exponential"
*
* @property {Web Audio Node} panner
* @property {AudioNode} panner
*
*/
this.panner = this.ac.createPanner();
Expand All @@ -60,6 +60,7 @@ define(function (require) {
}
/**
* Set the X,Y,Z position of the Panner
* @method set
* @param {Number} xVal
* @param {Number} yVal
* @param {Number} zVal
Expand Down
4 changes: 3 additions & 1 deletion src/polysynth.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ define(function (require) {
/**
* This value must only change as a note is attacked or released. Due to delay
* and sustain times, Tone.TimelineSignal is required to schedule the change in value.
* @private
* @property {Tone.TimelineSignal} _voicesInUse
*/
this._voicesInUse = new TimelineSignal(0);
Expand Down Expand Up @@ -242,7 +243,8 @@ define(function (require) {
* Any time a new value is scheduled, it is necessary to increment all subsequent
* scheduledValues after attack, and decrement all subsequent
* scheduledValues after release
*
*
* @private
* @param {[type]} time [description]
* @param {[type]} value [description]
* @return {[type]} [description]
Expand Down
10 changes: 7 additions & 3 deletions src/signal.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ define(function (require) {
* Connect a p5.sound object or Web Audio node to this
* p5.Signal so that its amplitude values can be scaled.
*
* @method setInput
* @param {Object} input
*/
Signal.prototype.setInput = function(_input) {
Expand All @@ -96,7 +97,7 @@ define(function (require) {
*
* @method add
* @param {Number} number
* @return {p5.SignalAdd} object
* @return {p5.Signal} object
*/
Signal.prototype.add = function(num) {
var add = new Add(num);
Expand All @@ -116,7 +117,7 @@ define(function (require) {
*
* @method mult
* @param {Number} number to multiply
* @return {Tone.Multiply} object
* @return {p5.Signal} object
*/
Signal.prototype.mult = function(num) {
var mult = new Mult(num);
Expand All @@ -140,7 +141,7 @@ define(function (require) {
* @param {Number} inMax input range maximum
* @param {Number} outMin input range minumum
* @param {Number} outMax input range maximum
* @return {p5.SignalScale} object
* @return {p5.Signal} object
*/
Signal.prototype.scale = function(inMin, inMax, outMin, outMax) {
var mapOutMin, mapOutMax;
Expand All @@ -159,4 +160,7 @@ define(function (require) {
Mult.prototype.scale = Signal.prototype.scale;
Add.prototype.scale = Signal.prototype.scale;
Scale.prototype.scale = Signal.prototype.scale;

});


Loading

0 comments on commit b1ab598

Please sign in to comment.