From 955f6ae56cdd3b20eabb44e7c9b931bdb17c2b3e Mon Sep 17 00:00:00 2001 From: quou Date: Sun, 7 May 2023 17:09:58 +1000 Subject: Basic music and sound. --- platform.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'platform.c') diff --git a/platform.c b/platform.c index 9bd5300..f3b45cb 100644 --- a/platform.c +++ b/platform.c @@ -1,6 +1,7 @@ #include "config.h" -#include "render.h" #include "input.h" +#include "render.h" +#include "sound.h" #if defined(plat_emscripten) #include @@ -145,17 +146,17 @@ int audio_len, audio_pos; int ticker; void fill_audio(void *udata, Uint8 *stream, int len) { - /*if (audio_len == 0) { + if (audio_len == 0) { audio_len = 1024; audio_pos = 0; } len = (len > audio_len ? audio_len : len); - sound_sys.mix(((unsigned short*)stream), len); + sound_mix(((unsigned char*)stream), len); audio_pos += len; - audio_len -= len;*/ + audio_len -= len; } void reset_input() { @@ -363,8 +364,8 @@ int main(int argc, char** argv) { SDL_SetWindowTitle(window, game_name); #if !no_sound - aud_spec.freq = 22050; - aud_spec.format = AUDIO_U16; + aud_spec.freq = 8000; + aud_spec.format = AUDIO_U8; aud_spec.channels = 1; aud_spec.samples = 1024; aud_spec.callback = fill_audio; -- cgit v1.2.3-54-g00ecf