From bd4cf5d7f714c9da8b3876369f1c5da316b5110e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?gr=C3=A9goire=20parant?= Date: Mon, 10 May 2021 19:55:43 +0200 Subject: [PATCH] Fix error context sound meter (#1009) --- front/src/Phaser/Components/SoundMeter.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/front/src/Phaser/Components/SoundMeter.ts b/front/src/Phaser/Components/SoundMeter.ts index af75940e..1d6f7eba 100644 --- a/front/src/Phaser/Components/SoundMeter.ts +++ b/front/src/Phaser/Components/SoundMeter.ts @@ -17,14 +17,12 @@ export class SoundMeter { } private init(context: AudioContext) { - if (this.context === undefined) { - this.context = context; - this.analyser = this.context.createAnalyser(); + this.context = context; + this.analyser = this.context.createAnalyser(); - this.analyser.fftSize = 2048; - const bufferLength = this.analyser.fftSize; - this.dataArray = new Uint8Array(bufferLength); - } + this.analyser.fftSize = 2048; + const bufferLength = this.analyser.fftSize; + this.dataArray = new Uint8Array(bufferLength); } public connectToSource(stream: MediaStream, context: AudioContext): void