Skip to content

Commit 4150c88

Browse files
authored
Merge pull request #420 from endurance21/oscillator
added documentations for getAmp, getType,getFreq,getPan
2 parents 0c78b9e + a145616 commit 4150c88

File tree

1 file changed

+36
-2
lines changed

1 file changed

+36
-2
lines changed

src/oscillator.js

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,17 @@ define(function (require) {
212212
// these are now the same thing
213213
p5.Oscillator.prototype.fade = p5.Oscillator.prototype.amp;
214214

215-
p5.Oscillator.prototype.getAmp = function () {
215+
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+
*/
224+
p5.Oscillator.prototype.getAmp = function() {
225+
216226
return this.output.gain.value;
217227
};
218228

@@ -293,6 +303,13 @@ define(function (require) {
293303
return this.oscillator.frequency;
294304
}
295305
};
306+
/**
307+
* Returns the value of frequency of oscillator
308+
*
309+
* @method getFreq
310+
* @for p5.Oscillator
311+
* @returns {number} Frequency of oscillator in Hertz
312+
*/
296313

297314
p5.Oscillator.prototype.getFreq = function () {
298315
return this.oscillator.frequency.value;
@@ -308,6 +325,13 @@ define(function (require) {
308325
p5.Oscillator.prototype.setType = function (type) {
309326
this.oscillator.type = type;
310327
};
328+
/**
329+
* Returns current type of oscillator eg. 'sine', 'triangle', 'sawtooth' or 'square'.
330+
*
331+
* @method getType
332+
* @for p5.Oscillator
333+
* @returns {String} type of oscillator eg . 'sine', 'triangle', 'sawtooth' or 'square'.
334+
*/
311335

312336
p5.Oscillator.prototype.getType = function () {
313337
return this.oscillator.type;
@@ -365,7 +389,17 @@ define(function (require) {
365389
this.panner.pan(pval, tFromNow);
366390
};
367391

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

0 commit comments

Comments
 (0)