blob: b58a39b2f92f5bee5de3f3b473459c98c0ef93ed (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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");
}
|