-
-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathNoise.java
More file actions
71 lines (59 loc) · 1.49 KB
/
Copy pathNoise.java
File metadata and controls
71 lines (59 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package processing.sound;
import com.jsyn.unitgen.UnitGenerator;
import com.jsyn.unitgen.UnitSource;
import processing.core.PApplet;
/**
* Common superclass of all noise generators
* @webref Noise
*/
public abstract class Noise<JSynNoise extends UnitGenerator> extends SoundObject {
protected JSynNoise noise;
protected Noise(PApplet theParent, JSynNoise noise) {
super(theParent);
this.noise = noise;
this.circuit = new JSynCircuit(((UnitSource) this.noise).getOutput());
}
public void play(float amp) {
this.amp(amp);
this.play();
}
/**
* Starts the noise
* @webref Noise:Noise
* @param amp The amplitude of the noise as a value between 0.0 and 1.0.
* @param pos The panoramic position of the noise as a float from -1.0 to 1.0.
**/
public void play(float amp, float pos) {
this.pan(pos);
this.play(amp);
}
public void play(float amp, float add, float pos) {
this.set(amp, add, pos);
this.play();
}
/**
* Set the amplitude and panoramic position with one method.
* @webref Noise:Noise
* @param amp The amplitude of the noise as a value between 0.0 and 1.0.
* @param pos The panoramic position of the noise as a float from -1.0 to 1.0.
**/
public void set(float amp, float pos) {
this.amp(amp);
this.pan(pos);
}
/**
* @deprecated
*/
public void set(float amp, float add, float pos) {
this.amp(amp);
this.add(add);
this.pan(pos);
}
/**
* Stop the noise from playing back
* @webref Noise:Noise
*/
public void stop() {
super.stop();
}
}