Skip to content

Commit c2142f0

Browse files
committed
(Docs): added more info about certain fields
Signed-off-by: Abhijay Jain <[email protected]>
1 parent 9a3ded2 commit c2142f0

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

src/audioin.js

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,30 +50,45 @@ p5sound.inputSources = [];
5050
*/
5151
class AudioIn {
5252
constructor(errorCallback) {
53-
// set up audio input
5453
/**
54+
* set up audio input
55+
*
5556
* @property {GainNode} input
5657
*/
5758
this.input = p5sound.audiocontext.createGain();
5859

5960
/**
60-
* Get audio from an input, i.e. your computer's microphone.
61-
*
61+
* send audio as an output, i.e. your computer's speaker.
62+
*
6263
* @property {GainNode} output
6364
*/
6465
this.output = p5sound.audiocontext.createGain();
6566

6667
/**
68+
* used to store the MediaStream object that is returned from the getUserMedia() API,
69+
* which allows access to the user's microphone. The stream is used to create a MediaStreamAudioSourceNode,
70+
* which is used as the audio source for the input and output gain nodes.
71+
* The stream is also used to check if the browser supports the MediaStreamTrack and mediaDevices API,
72+
* and if not, an errorCallback function is called or an alert is displayed.
73+
*
6774
* @property {MediaStream|null} stream
6875
*/
6976
this.stream = null;
7077

7178
/**
79+
* used to access the "audio input" from the user's microphone.
80+
* It creates a MediaStream object that can be used to start and stop the mic and measure its volume using the getLevel() method or by connecting it to an FFT object.
81+
* MediaStream object can also be use to check if the browser supports MediaStreamTrack and mediaDevices and to add the AudioIn object to the soundArray for disposal on close.
82+
*
7283
* @property {MediaStreamAudioSourceNode|null} mediaStream
7384
*/
7485
this.mediaStream = null;
75-
86+
7687
/**
88+
* use to store the "current source of audio input", such as the user's microphone.
89+
* initially set to "null" and can be updated as the user selects different audio sources.
90+
* also used in conjunction with the "input" and "mediaStream" properties to control audio input.
91+
*
7792
* @property {Number|null} currentSource
7893
*/
7994
this.currentSource = null;

0 commit comments

Comments
 (0)