pull/21833/head
Travis Ralston 2021-05-03 15:16:50 -06:00
parent 0806af0f4d
commit 7f56ec7bd2
1 changed files with 2 additions and 0 deletions

View File

@ -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);