diff options
author | banana <delgadillo.tyler@gmail.com> | 2024-03-22 13:46:36 -0700 |
---|---|---|
committer | banana <delgadillo.tyler@gmail.com> | 2024-03-22 13:46:36 -0700 |
commit | ad22993557296b02bc0c947cb3bb6247fac8f47f (patch) | |
tree | 2c83ab589acab8a5074583d625d54ec44677e5d0 /sound.c |
Diffstat (limited to 'sound.c')
-rw-r--r-- | sound.c | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -0,0 +1,20 @@ +#include <SDL2/SDL_mixer.h> + +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"); +} |