You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
implemented reverb. All effects now have getters and setters for drygain and wetgain, and the actual nodes have been renamed dryGainNode and wetGainNode
Copy file name to clipboardExpand all lines: src/effects/Effect.js
+25-8Lines changed: 25 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,23 @@
1
1
importSoundfrom"../Sound"
2
2
3
3
exportdefaultclassEffect{
4
+
5
+
setdryGain(val){
6
+
this.dryGainNode.gain.value=val;
7
+
}
8
+
9
+
getdryGain(){
10
+
returnthis.dryGainNode.gain.value;
11
+
}
12
+
13
+
setwetGain(val){
14
+
this.wetGainNode.gain.value=val;
15
+
}
16
+
17
+
getwetGain(){
18
+
returnthis.wetGainNode.gain.value;
19
+
}
20
+
4
21
constructor(){
5
22
6
23
// Set up the filter's internal audio graph here. At minimum, all filters need an input node and an output node
@@ -9,16 +26,16 @@ export default class Effect {
9
26
this.inputNode=Sound.context.createGain();// The node external sources will connect to
10
27
this.effectBus=Sound.context.createGain();// The node that connects up to the effects chain.
11
28
this.outputNode=Sound.context.createGain();// The node that will connect to external destinations
12
-
this.dryGain=Sound.context.createGain();// The amount of dry signal included in the output
13
-
this.wetGain=Sound.context.createGain();// The amount of wet signal included in the output
29
+
this.dryGainNode=Sound.context.createGain();// The amount of dry signal included in the output
30
+
this.wetGainNode=Sound.context.createGain();// The amount of wet signal included in the output
14
31
15
32
this.inputNode.connect(this.effectBus);
16
-
this.inputNode.connect(this.dryGain);
33
+
this.inputNode.connect(this.dryGainNode);
17
34
18
-
this.wetGain.connect(this.outputNode);
19
-
this.dryGain.connect(this.outputNode);
35
+
this.wetGainNode.connect(this.outputNode);
36
+
this.dryGainNode.connect(this.outputNode);
20
37
21
-
this.dryGain.gain.value=0;
38
+
this.dryGainNode.gain.value=0;
22
39
23
40
this._enabled=true;
24
41
this.owner=null;// The Sample, Playback or Group that owns this effect - used for checking when adding an effect to prevent being added to multiple locations
0 commit comments