Skip to content

Commit

Permalink
added documentation for getType,getPan, getFreq,getAmp in oscillator.js
Browse files Browse the repository at this point in the history
  • Loading branch information
endurance21 committed May 2, 2020
1 parent 374d306 commit b5f3110
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/oscillator.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
};
Expand Down

0 comments on commit b5f3110

Please sign in to comment.