From 820298fa61835c53694c4ec58d6c5328947ad4ca Mon Sep 17 00:00:00 2001 From: Mitya Selivanov Date: Sat, 23 Nov 2024 04:16:19 +0100 Subject: Fix web audio f32 arrays --- index.htm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'index.htm') diff --git a/index.htm b/index.htm index d4729bf..ded4780 100644 --- a/index.htm +++ b/index.htm @@ -194,7 +194,7 @@ let sound_max_num_frames; let sound_shared_ring; - let sound_position = 0; + let sound_position; canvas = attrs.canvas; context = canvas.getContext("2d"); @@ -219,6 +219,7 @@ sound_buffer_address = program.instance.exports.js_sound_buffer(); sound_shared_ring = new SharedArrayBuffer(sound_max_num_frames * 4); + sound_position = 0; sound_node = new AudioWorkletNode( sound_context, @@ -290,7 +291,7 @@ } let dst = new Float32Array(sound_shared_ring); - let src = new Float32Array(memory.subarray(sound_buffer_address, sound_buffer_address + sound_max_num_frames * 4)); + let src = new Float32Array(memory.buffer, sound_buffer_address, sound_max_num_frames); if (num_frames <= sound_max_num_frames - sound_position) for (let i = 0; i < num_frames; ++i) { -- cgit v1.2.3