Skip to content

Commit b5f3110

Browse files
committed
added documentation for getType,getPan, getFreq,getAmp in oscillator.js
1 parent 374d306 commit b5f3110

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

src/oscillator.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,14 @@ define(function (require) {
213213
// these are now the same thing
214214
p5.Oscillator.prototype.fade = p5.Oscillator.prototype.amp;
215215

216+
/**
217+
* Returns the value of output gain
218+
*
219+
* @method getAmp
220+
* @for p5.Oscillator
221+
*
222+
* @returns {number} Amplitude value between 0.0 and 1.0
223+
*/
216224
p5.Oscillator.prototype.getAmp = function() {
217225
return this.output.gain.value;
218226
};
@@ -294,6 +302,13 @@ define(function (require) {
294302
return this.oscillator.frequency;
295303
}
296304
};
305+
/**
306+
* Returns the value of frequency of oscillator
307+
*
308+
* @method getFreq
309+
* @for p5.Oscillator
310+
* @returns {number} Frequency of oscillator in Hertz
311+
*/
297312

298313
p5.Oscillator.prototype.getFreq = function() {
299314
return this.oscillator.frequency.value;
@@ -309,6 +324,13 @@ define(function (require) {
309324
p5.Oscillator.prototype.setType = function(type) {
310325
this.oscillator.type = type;
311326
};
327+
/**
328+
* Returns current type of oscillator eg. 'sine', 'triangle', 'sawtooth' or 'square'.
329+
*
330+
* @method getType
331+
* @for p5.Oscillator
332+
* @returns {String} type of oscillator eg . 'sine', 'triangle', 'sawtooth' or 'square'.
333+
*/
312334

313335
p5.Oscillator.prototype.getType = function() {
314336
return this.oscillator.type;
@@ -368,6 +390,15 @@ define(function (require) {
368390
this.panner.pan(pval, tFromNow);
369391
};
370392

393+
/**
394+
* Returns the current value of panPosition , between Left (-1) and Right (1)
395+
*
396+
* @method getPan
397+
* @for p5.Oscillator
398+
*
399+
* @returns {number} panPosition of oscillator , between Left (-1) and Right (1)
400+
*/
401+
371402
p5.Oscillator.prototype.getPan = function() {
372403
return this.panPosition;
373404
};

0 commit comments

Comments
 (0)