Skip to content

addLoopRegions

addLoopRegions(canvas, loops, duration): void

Defined in: packages/pleco-xa/src/scripts/WaveformRenderer.js:230

Adds loop region overlays to existing waveform

HTMLCanvasElement

Canvas with existing waveform

LoopRegion[]

Array of loop regions to render

number

Total audio duration in seconds

void

import { addLoopRegions } from './WaveformRenderer.js';
addLoopRegions(canvas, [
{ start: 1.5, end: 3.2, color: 'rgba(255,255,0,0.3)' },
{ start: 4.0, end: 6.5, color: 'rgba(0,255,0,0.3)' }
], audioBuffer.duration);