Skip to content

Commit 5ffbd51

Browse files
Shortened declicker fade, and made it a linear ramp to value at all places instead of setting
1 parent 86dbde6 commit 5ffbd51

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/utils/Declicker.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ export default class Declicker extends EventDispatcher {
2121
// The node we will use for fading to prevent clicks. Use provided node if exists, otherwise create one.
2222
this.gainNode = this.inputNode = this.outputNode = gainNode || Sound.context.createGain();
2323

24-
this.fadeMaskDuration = 0.02; // Duration of the fade, in seconds.
24+
this.fadeMaskDuration = 0.01; // Duration of the fade, in seconds.
2525
this.fadeMaskTimeout = null; // Reference to the timeout for calling an event, to allow cancelling
26+
this.fadePromise = null;
2627
this._fadingIn = null;
2728
}
2829

@@ -64,7 +65,7 @@ export default class Declicker extends EventDispatcher {
6465
}
6566

6667
this.gainNode.gain.cancelScheduledValues(Sound.context.currentTime);
67-
this.gainNode.gain.value = 1;
68+
this.gainNode.gain.linearRampToValueAtTime(1, Sound.context.currentTime + 0.01);
6869
window.clearTimeout(this.fadeMaskTimeout);
6970
this.fadeMaskTimeout = null;
7071
this._fadingIn = null;

0 commit comments

Comments
 (0)