Skip to content

Commit

Permalink
Update the wasm audio code
Browse files Browse the repository at this point in the history
  • Loading branch information
RobDangerous committed Feb 3, 2024
1 parent 7991015 commit cba4b0c
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions Backends/System/Wasm/Sources/kinc/backend/audio.c.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <kinc/audio2/audio.h>
#include <stdlib.h>

static void (*a2_callback)(kinc_a2_buffer_t *buffer, int samples, void *userdata) = NULL;
static void (*a2_callback)(kinc_a2_buffer_t *buffer, uint32_t samples, void *userdata) = NULL;
static void *a2_userdata = NULL;
static kinc_a2_buffer_t a2_buffer;

Expand All @@ -11,7 +11,20 @@ void kinc_a2_update() {}

void kinc_a2_shutdown() {}

void kinc_a2_set_callback(void (*kinc_a2_audio_callback)(kinc_a2_buffer_t *buffer, int samples, void *userdata), void *userdata) {
void kinc_a2_set_callback(void (*kinc_a2_audio_callback)(kinc_a2_buffer_t *buffer, uint32_t samples, void *userdata), void *userdata) {
a2_callback = kinc_a2_audio_callback;
a2_userdata = userdata;
}

static uint32_t samples_per_second = 44100;
static void (*sample_rate_callback)(void *userdata) = NULL;
static void *sample_rate_callback_userdata = NULL;

uint32_t kinc_a2_samples_per_second(void) {
return samples_per_second;
}

void kinc_a2_set_sample_rate_callback(void (*kinc_a2_sample_rate_callback)(void *userdata), void *userdata) {
sample_rate_callback_userdata = userdata;
sample_rate_callback = kinc_a2_sample_rate_callback;
}

0 comments on commit cba4b0c

Please sign in to comment.