From 743d0b4d558a5c6094ed93d31a3b81140231ec91 Mon Sep 17 00:00:00 2001 From: Matt Godbolt Date: Wed, 1 Jan 2025 21:20:56 +0000 Subject: [PATCH] Take @8bitkick's advice --- src/web/audio-handler.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/web/audio-handler.js b/src/web/audio-handler.js index 729e127..7250089 100644 --- a/src/web/audio-handler.js +++ b/src/web/audio-handler.js @@ -80,12 +80,12 @@ export class AudioHandler { async _setup(audioFilterFreq, audioFilterQ) { await this.audioContext.audioWorklet.addModule(rendererUrl); if (audioFilterFreq !== 0) { - this.soundChip.filterNode = this.audioContext.createBiquadFilter(); - this.soundChip.filterNode.type = "lowpass"; - this.soundChip.filterNode.frequency.value = audioFilterFreq; - this.soundChip.filterNode.Q.value = audioFilterQ; - this._audioDestination = this.soundChip.filterNode; - this.soundChip.filterNode.connect(this.audioContext.destination); + const filterNode = this.audioContext.createBiquadFilter(); + filterNode.type = "lowpass"; + filterNode.frequency.value = audioFilterFreq; + filterNode.Q.value = audioFilterQ; + this._audioDestination = filterNode; + filterNode.connect(this.audioContext.destination); } else { this._audioDestination = this.audioContext.destination; } @@ -111,8 +111,7 @@ export class AudioHandler { if (this._jsAudioNode) this._jsAudioNode.port.postMessage({ time: Date.now(), buffer }, [buffer.buffer]); } - // Recent browsers, particularly Safari and Chrome, require a user - // interaction in order to enable sound playback. + // Recent browsers, particularly Safari and Chrome, require a user interaction in order to enable sound playback. async tryResume() { if (this.audioContext) await this.audioContext.resume(); if (this.audioContextM5000) await this.audioContextM5000.resume();