From ad22993557296b02bc0c947cb3bb6247fac8f47f Mon Sep 17 00:00:00 2001 From: banana Date: Fri, 22 Mar 2024 13:46:36 -0700 Subject: Initial commit --- sound.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 sound.c (limited to 'sound.c') diff --git a/sound.c b/sound.c new file mode 100644 index 0000000..b58a39b --- /dev/null +++ b/sound.c @@ -0,0 +1,20 @@ +#include + +static void load_sounds(void); + +static Mix_Chunk* sounds[2]; + +void init_sounds(void) { + memset(sounds, 0, sizeof(Mix_Chunk *) * 2); + + load_sounds(); +} + +void play_sound(int id, int channel) { + Mix_PlayChannel(channel, sounds[id], 0); +} + +static void load_sounds(void) { + sounds[0] = Mix_LoadWAV("sound/beep_lo.wav"); + sounds[1] = Mix_LoadWAV("sound/beep_hi.wav"); +} -- cgit v1.2.3