Fix incorrect API usage in docs

This commit is contained in:
Vanilagy
2025-06-27 19:06:17 +02:00
parent 846fa0b183
commit 0ff0729fec
10 changed files with 18 additions and 18 deletions
+2 -2
View File
@@ -437,9 +437,9 @@ let sumOfSquares = 0;
let totalSampleCount = 0;
for await (const sample of sink.samples()) {
const bytesNeeded = sample.allocationSize({ format: 'f32' });
const bytesNeeded = sample.allocationSize({ format: 'f32', planeIndex: 0 });
const floats = new Float32Array(bytesNeeded / 4);
sample.copyTo(floats, { format: 'f32' });
sample.copyTo(floats, { format: 'f32', planeIndex: 0 });
for (let i = 0; i < floats.length; i++) {
sumOfSquares += floats[i] ** 2;