aboutsummaryrefslogtreecommitdiff
path: root/platform.c
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2023-05-07 17:09:58 +1000
committerquou <quou@disroot.org>2023-05-07 17:09:58 +1000
commit955f6ae56cdd3b20eabb44e7c9b931bdb17c2b3e (patch)
tree62f5dc92a675a5fdc48a0474d11d229cb5f2780d /platform.c
parent1867e71ac2870f904e0856fd3b093abed6e8a58b (diff)
Basic music and sound.
Diffstat (limited to 'platform.c')
-rw-r--r--platform.c13
1 files changed, 7 insertions, 6 deletions
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 <emscripten.h>
@@ -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;