summaryrefslogtreecommitdiff
path: root/index.htm
diff options
context:
space:
mode:
authorMitya Selivanov <automainint@guattari.tech>2024-11-23 04:16:19 +0100
committerMitya Selivanov <automainint@guattari.tech>2024-11-23 04:16:19 +0100
commit820298fa61835c53694c4ec58d6c5328947ad4ca (patch)
tree8d6d933c8b8c5ea7d2220045c2ff23a973397ce1 /index.htm
parent533aa1816b2c90b3935504b489e03e6ef87038a6 (diff)
downloadreduced_system_layer-820298fa61835c53694c4ec58d6c5328947ad4ca.zip
Fix web audio f32 arrays
Diffstat (limited to 'index.htm')
-rw-r--r--index.htm5
1 files changed, 3 insertions, 2 deletions
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) {