X Tutup
Skip to content

Commit d4e5439

Browse files
committed
Merge branch 'web-reference-documentation'
2 parents 144c0d6 + bc80e6e commit d4e5439

File tree

8 files changed

+76
-22
lines changed

8 files changed

+76
-22
lines changed

src/processing/sound/Analyzer.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
import processing.core.PApplet;
66

7+
/**
8+
* Common superclass of all audio analysis classes
9+
* @webref Analysis
10+
*/
711
abstract class Analyzer {
812

913
protected SoundObject input;
@@ -16,6 +20,7 @@ protected Analyzer(PApplet parent) {
1620
* Define the audio input for the analyzer.
1721
*
1822
* @param input The input sound source
23+
* @webref Analysis:Analyzer
1924
**/
2025
public void input(SoundObject input) {
2126
if (this.input == input) {

src/processing/sound/AudioIn.java

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,6 @@ public void play(float amp, float add) {
8888
* @param amp
8989
* the volume to grab the input at as a value from 0.0 (complete
9090
* silence) to 1.0 (full volume)
91-
* @param add
92-
* offset the audio input by the given value
9391
* @param pos
9492
* pan the audio input in a stereo panorama. Allowed values are
9593
* between -1.0 (left) and 1.0 (right)
@@ -136,22 +134,34 @@ public void start(float amp, float add, float pos) {
136134
}
137135

138136
/**
139-
* Sets amplitude, add and pan position with one method.
137+
* Set amplitude and pan position with one method.
140138
*
141139
* @webref I/O:AudioIn
142-
* @webBrief Sets amplitude, add and pan position with one method.
143140
* @param amp
144141
* the volume to grab the input at as a value from 0.0 (complete
145142
* silence) to 1.0 (full volume)
146-
* @param add
147-
* offset the audio input by the given value
148143
* @param pos
149144
* pan the audio input in a stereo panorama. Allowed values are
150145
* between -1.0 (left) and 1.0 (right)
151146
**/
147+
public void set(float amp, float pos) {
148+
this.amp(amp);
149+
this.pan(pos);
150+
}
151+
152152
public void set(float amp, float add, float pos) {
153153
this.amp(amp);
154154
this.add(add);
155155
this.pan(pos);
156156
}
157+
158+
/**
159+
* Stop capturing sound from this audio input.
160+
*
161+
* @webref I/O:AudioIn
162+
**/
163+
public void stop() {
164+
super.stop();
165+
}
166+
157167
}

src/processing/sound/Effect.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
/**
1313
* For advanced users: common superclass of all effect types
14+
* @webref Effects
1415
*/
1516
// helper class for applying the same effect (with the same parameters) on two channels.
1617
// a basic design question is what to do if the same effect is applied to several different
@@ -53,7 +54,7 @@ public boolean isProcessing() {
5354
/**
5455
* Start the effect.
5556
* @param input Input sound source
56-
* @webref Effects
57+
* @webref Effects:Effect
5758
*/
5859
public void process(SoundObject input) {
5960
if (this.inputs.add(input)) {
@@ -66,7 +67,7 @@ public void process(SoundObject input) {
6667

6768
/**
6869
* Stop the effect.
69-
* @webref Effects
70+
* @webref Effects:Effect
7071
*/
7172
public void stop() {
7273
if (this.inputs.isEmpty()) {

src/processing/sound/Env.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public Env(PApplet parent) {
2020

2121
/**
2222
* Triggers the envelope.
23-
* @webref Envelopes:Env
23+
* @webref Envelopes
2424
* @webBrief Triggers the envelope.
2525
* @param input Input sound source
2626
* @param attackTime Attack time value as a float.

src/processing/sound/FFT.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,20 +54,13 @@ protected void setInput(UnitOutputPort input) {
5454
this.fft.start();
5555
}
5656

57-
/**
58-
* Calculates the current frequency spectrum from the input source, writes it
59-
* into this FFT's `spectrum` array, and returns it.
60-
*
61-
* @return the current frequency spectrum of the input source. The array has as
62-
* many elements as this FFT analyzer's number of frequency bands
63-
* @webref Analysis:FFT
64-
*/
6557
public float[] analyze() {
6658
return this.analyze(this.spectrum);
6759
}
6860

6961
/**
70-
* Calculates the current frequency spectrum and returns it as an array with as many elements as frequency bands.
62+
* Calculates the current frequency spectrum from the input source and returns
63+
* it as an array with as many elements as frequency bands.
7164
*
7265
* @param value
7366
* an array with as many elements as this FFT analyzer's number of

src/processing/sound/Noise.java

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
import processing.core.PApplet;
77

88
/**
9-
* For advanced users: common superclass of all noise generators
9+
* Common superclass of all noise generators
10+
* @webref Noise
1011
*/
1112
public abstract class Noise<JSynNoise extends UnitGenerator> extends SoundObject {
1213

@@ -23,6 +24,12 @@ public void play(float amp) {
2324
this.play();
2425
}
2526

27+
/**
28+
* Starts the noise
29+
* @webref Noise:Noise
30+
* @param amp The amplitude of the noise as a value between 0.0 and 1.0.
31+
* @param pos The panoramic position of the noise as a float from -1.0 to 1.0.
32+
**/
2633
public void play(float amp, float pos) {
2734
this.pan(pos);
2835
this.play(amp);
@@ -33,9 +40,32 @@ public void play(float amp, float add, float pos) {
3340
this.play();
3441
}
3542

43+
/**
44+
* Set the amplitude and panoramic position with one method.
45+
* @webref Noise:Noise
46+
* @param amp The amplitude of the noise as a value between 0.0 and 1.0.
47+
* @param pos The panoramic position of the noise as a float from -1.0 to 1.0.
48+
**/
49+
public void set(float amp, float pos) {
50+
this.amp(amp);
51+
this.pan(pos);
52+
}
53+
54+
/**
55+
* @deprecated
56+
*/
3657
public void set(float amp, float add, float pos) {
3758
this.amp(amp);
3859
this.add(add);
3960
this.pan(pos);
4061
}
62+
63+
/**
64+
* Stop the noise from playing back
65+
* @webref Noise:Noise
66+
*/
67+
public void stop() {
68+
super.stop();
69+
}
70+
4171
}

src/processing/sound/Oscillator.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,21 @@ public void set(float freq, float amp, float pos) {
6969
this.pan(pos);
7070
}
7171

72+
/**
73+
* @deprecated
74+
*/
7275
public void set(float freq, float amp, float add, float pos) {
7376
this.freq(freq);
7477
this.amp(amp);
7578
this.add(add);
7679
this.pan(pos);
7780
}
81+
82+
/**
83+
* Stop the oscillator from playing back
84+
* @webref Oscillators:Oscillator
85+
*/
86+
public void stop() {
87+
super.stop();
88+
}
7889
}

src/processing/sound/SoundObject.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
/**
99
* For advanced users: common superclass of all sound sources (oscillators,
1010
* noise, audio samples and even AudioIn).
11+
* @webref SoundObject
1112
*/
1213
// Subclasses need to assign the 'amplitude' port, and also initiate a
1314
// JSynCircuit (which effects can be plugged into) with an appropriate
@@ -53,6 +54,7 @@ public void add(float add) {
5354
* @param amp
5455
* A float value between 0.0 (complete silence) and 1.0 (full volume)
5556
* controlling the amplitude/volume of this sound.
57+
* @webref SoundObject:SoundObject
5658
**/
5759
public void amp(float amp) {
5860
if (Engine.checkAmp(amp)) {
@@ -79,6 +81,7 @@ public boolean isPlaying() {
7981
* @param pos
8082
* The panoramic position of this sound unit as a float from -1.0
8183
* (left) to 1.0 (right).
84+
* @webref SoundObject:SoundObject
8285
**/
8386
public void pan(float pos) {
8487
if (this.circuit.processor == null) {
@@ -89,8 +92,7 @@ public void pan(float pos) {
8992
}
9093

9194
/**
92-
* Start the generator
93-
*
95+
* Starts the generator
9496
**/
9597
public void play() {
9698
// TODO print info message if it's already playing?
@@ -104,7 +106,9 @@ public void play() {
104106
}
105107

106108
/**
107-
* Stop the generator
109+
* Stops this sound from playing back.
110+
*
111+
* @webref SoundObject:SoundObject
108112
**/
109113
public void stop() {
110114
this.isPlaying = false;

0 commit comments

Comments
 (0)
X Tutup