From 7f56ec7bd263a67139e91583b102fc8a1c1bba99 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Mon, 3 May 2021 15:16:50 -0600 Subject: [PATCH] docs --- src/voice/Playback.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/voice/Playback.ts b/src/voice/Playback.ts index a927ad3104..954aa662c3 100644 --- a/src/voice/Playback.ts +++ b/src/voice/Playback.ts @@ -93,6 +93,8 @@ export class Playback extends EventEmitter implements IDestroyable { public async prepare() { this.audioBuf = await this.context.decodeAudioData(this.buf); + // Update the waveform to the real waveform once we have channel data to use. We don't + // exactly trust the user-provided waveform to be accurate... const waveform = Array.from(this.audioBuf.getChannelData(0)).map(v => clamp(v, 0, 1)); this.resampledWaveform = arrayFastResample(waveform, PLAYBACK_WAVEFORM_SAMPLES); this.waveformObservable.update(this.resampledWaveform);