From 0269c40d9b94f49576b1c7ece0f768eb551686e5 Mon Sep 17 00:00:00 2001 From: Mitya Selivanov Date: Mon, 18 Nov 2024 02:33:59 +0100 Subject: Update web audio impl --- index.htm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'index.htm') diff --git a/index.htm b/index.htm index 830ebed..e2e9d55 100644 --- a/index.htm +++ b/index.htm @@ -18,6 +18,14 @@ } process(input, output, parameters) { // TODO + + let sample_rate = sampleRate; + let num_channels = output[0].length; + let num_samples = output[0][0].length; + let max_num_frames = this.state.max_num_frames; + + let position = this.state.program.instance.exports.js_sound_playback(num_samples); + return true; } } @@ -159,7 +167,9 @@ let sound_node; let sound_state = { + program : null, memory : null, + max_num_frames : 0, buffer_address : 0, }; @@ -181,6 +191,11 @@ await sound_context.audioWorklet.addModule(URL.createObjectURL(blob)); + sound_state.program = program; + sound_state.memory = memory; + sound_state.max_num_frames = program.instance.exports.js_max_num_audio_frames(); + sound_state.buffer_address = program.instance.exports.js_sound_buffer(); + sound_node = new AudioWorkletNode( sound_context, "Sound_Ring", -- cgit v1.2.3