Skip to content

Commit

Permalink
gswaFxReverb: use constanteSource (for Chrome)
Browse files Browse the repository at this point in the history
  • Loading branch information
mr21 committed Dec 7, 2024
1 parent e9f51cb commit 6a83fb7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions gswaFxReverb/gswaFxReverb.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class gswaFxReverb {
#wetGain = null;
#wetDelay = null;
#convolver = null;
#wetConstant = null; // needed for Chrome (the delayNode seems to stop sending when it stop receiving).
#enable = false;
#data = DAWCoreJSON_effects_reverb();

Expand All @@ -31,7 +32,10 @@ class gswaFxReverb {
if ( this.#ctx ) {
this.#input.disconnect();
this.#output.disconnect();
this.#wetGain.disconnect();
this.#wetDelay.disconnect();
this.#convolver.disconnect();
this.#wetConstant.disconnect();
}
this.#ctx = ctx;
this.#input = ctx.createGain();
Expand All @@ -40,6 +44,7 @@ class gswaFxReverb {
this.#wetGain = ctx.createGain();
this.#wetDelay = ctx.createDelay( 30 );
this.#convolver = ctx.createConvolver();
this.#wetConstant = ctx.createConstantSource();
this.$toggle( this.#enable );
this.$change( this.#data );

Expand All @@ -59,6 +64,8 @@ class gswaFxReverb {
this.#input
.connect( this.#dryGain )
.connect( this.#output );
this.#wetConstant
.connect( this.#wetGain );
this.#input
.connect( this.#wetGain )
.connect( this.#convolver )
Expand All @@ -69,6 +76,7 @@ class gswaFxReverb {
this.#wetGain.disconnect();
this.#wetDelay.disconnect();
this.#convolver.disconnect();
this.#wetConstant.disconnect();
this.#input.connect( this.#output );
}
}
Expand Down

0 comments on commit 6a83fb7

Please sign in to comment.