summaryrefslogtreecommitdiff
path: root/sound.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound.c')
-rw-r--r--sound.c20
1 files changed, 20 insertions, 0 deletions
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 <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");
+}