From b5f3110e0fc4b82797d2fc0bb0f1e93f22120ba4 Mon Sep 17 00:00:00 2001 From: Divyanshu Raj Date: Sat, 2 May 2020 23:01:03 +0530 Subject: [PATCH] added documentation for getType,getPan, getFreq,getAmp in oscillator.js --- src/oscillator.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/oscillator.js b/src/oscillator.js index 798432d9..94e6819e 100644 --- a/src/oscillator.js +++ b/src/oscillator.js @@ -213,6 +213,14 @@ define(function (require) { // these are now the same thing p5.Oscillator.prototype.fade = p5.Oscillator.prototype.amp; + /** + * Returns the value of output gain + * + * @method getAmp + * @for p5.Oscillator + * + * @returns {number} Amplitude value between 0.0 and 1.0 + */ p5.Oscillator.prototype.getAmp = function() { return this.output.gain.value; }; @@ -294,6 +302,13 @@ define(function (require) { return this.oscillator.frequency; } }; + /** + * Returns the value of frequency of oscillator + * + * @method getFreq + * @for p5.Oscillator + * @returns {number} Frequency of oscillator in Hertz + */ p5.Oscillator.prototype.getFreq = function() { return this.oscillator.frequency.value; @@ -309,6 +324,13 @@ define(function (require) { p5.Oscillator.prototype.setType = function(type) { this.oscillator.type = type; }; + /** + * Returns current type of oscillator eg. 'sine', 'triangle', 'sawtooth' or 'square'. + * + * @method getType + * @for p5.Oscillator + * @returns {String} type of oscillator eg . 'sine', 'triangle', 'sawtooth' or 'square'. + */ p5.Oscillator.prototype.getType = function() { return this.oscillator.type; @@ -368,6 +390,15 @@ define(function (require) { this.panner.pan(pval, tFromNow); }; + /** + * Returns the current value of panPosition , between Left (-1) and Right (1) + * + * @method getPan + * @for p5.Oscillator + * + * @returns {number} panPosition of oscillator , between Left (-1) and Right (1) + */ + p5.Oscillator.prototype.getPan = function() { return this.panPosition; };