summaryrefslogtreecommitdiff
path: root/reduced_system_layer.c
diff options
context:
space:
mode:
Diffstat (limited to 'reduced_system_layer.c')
-rwxr-xr-xreduced_system_layer.c38
1 files changed, 36 insertions, 2 deletions
diff --git a/reduced_system_layer.c b/reduced_system_layer.c
index 692d555..dfc8b4f 100755
--- a/reduced_system_layer.c
+++ b/reduced_system_layer.c
@@ -1550,7 +1550,7 @@ void p_clipboard_write(i64 size, c8 *data) {
// ================================================================
//
-// WebAssembly
+// Web canvas
//
// ================================================================
@@ -1592,7 +1592,7 @@ void p_render_frame(void) {
p_render_frame_impl();
}
-__attribute__((export_name("js_memset"))) void js_memset(void *dst, i32 val, u32 num) {
+ __attribute__((export_name("js_memset"))) void js_memset(void *dst, i32 val, u32 num) {
if (dst == NULL) return;
for (u32 i = 0; i < num; ++i)
((u8 *) dst)[i] = (u8) val;
@@ -1678,6 +1678,40 @@ __attribute__((export_name("js_keyup"))) void js_keyup(u32 key, u32 mod) {
#endif // __wasm__
// ================================================================
+//
+// Web audio
+//
+// ================================================================
+
+#ifdef __wasm__
+
+void p_handle_audio(i64 samples_elapsed) {
+ // TODO
+}
+
+void p_queue_sound(i64 delay_in_samples, i64 num_samples, f32 *frames) {
+ // TODO
+}
+
+__attribute__((export_name("js_sample_rate"))) f64 js_sample_rate(void) {
+ return (f64) AUDIO_SAMPLE_RATE;
+}
+
+__attribute__((export_name("js_num_channels"))) i32 js_num_channels(void) {
+ return AUDIO_NUM_CHANNELS;
+}
+
+__attribute__((export_name("js_sound_buffer"))) void *js_sound_buffer(void) {
+ return NULL;
+}
+
+__attribute__((export_name("js_sound_playback"))) void js_sound_playback(i64 num_samples) {
+ // TODO
+}
+
+#endif // __wasm__
+
+// ================================================================
#endif // REDUCED_SYSTEM_LAYER_IMPL_GUARD_
#endif // REDUCED_SYSTEM_LAYER_HEADER