Skip to content

Commit 7b2fc72

Browse files
committed
add documentation for noise methods
1 parent 86e246f commit 7b2fc72

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

src/noise.js

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ class Noise extends Oscillator {
157157
* White is the default.
158158
*
159159
* @method setType
160-
* @param {String} [type] 'white', 'pink' or 'brown'
160+
* @param {String} type 'white', 'pink' or 'brown'
161161
*/
162162
setType(type) {
163163
switch (type) {
@@ -180,9 +180,23 @@ class Noise extends Oscillator {
180180
}
181181
}
182182

183+
/**
184+
* Returns current type of noise eg. 'white', 'pink' or 'brown'.
185+
*
186+
* @method getType
187+
* @for p5.Noise
188+
* @returns {String} type of noise eg. 'white', 'pink' or 'brown'.
189+
*/
183190
getType() {
184191
return this.buffer.type;
185192
}
193+
194+
/**
195+
* Starts playing the noise.
196+
*
197+
* @method start
198+
* @for p5.Noise
199+
*/
186200
start() {
187201
if (this.started) {
188202
this.stop();
@@ -196,6 +210,12 @@ class Noise extends Oscillator {
196210
this.started = true;
197211
}
198212

213+
/**
214+
* Stops playing the noise.
215+
*
216+
* @method stop
217+
* @for p5.Noise
218+
*/
199219
stop() {
200220
var now = p5sound.audiocontext.currentTime;
201221
if (this.noise) {
@@ -204,6 +224,12 @@ class Noise extends Oscillator {
204224
}
205225
}
206226

227+
/**
228+
* Get rid of the Noise object and free up its resources / memory.
229+
*
230+
* @method dispose
231+
* @for p5.Noise
232+
*/
207233
dispose() {
208234
var now = p5sound.audiocontext.currentTime;
209235

0 commit comments

Comments
 (0)