3
#include <SDL/SDL_mixer.h>
5
#include <emscripten.h>
7
static Mix_Chunk *sound = NULL;
8
static Mix_Music *music = NULL;
10
static int soundChannel = 0;
14
static int frames = 0;
19
soundChannel = Mix_PlayChannel(-1, sound, 0);
20
printf("channel = %d", soundChannel);
21
assert(soundChannel != -1 && soundChannel != 0);
24
printf("channel %d is playing = %d", soundChannel, Mix_Playing(soundChannel));
25
assert(Mix_Playing(soundChannel));
28
Mix_Pause(soundChannel);
29
Mix_PlayMusic(music, 1);
32
assert(Mix_Paused(soundChannel));
33
assert(Mix_PlayingMusic());
36
Mix_Resume(soundChannel);
40
assert(Mix_Playing(soundChannel));
41
assert(Mix_PausedMusic());
47
assert(Mix_PlayingMusic());
50
Mix_HaltChannel(soundChannel);
59
int main(int argc, char **argv) {
60
SDL_Init(SDL_INIT_AUDIO);
61
Mix_Init(MIX_INIT_OGG);
63
// This reserves channel 0 for other purposes.
64
// We are just going to verify that we are not
65
// allocated channel 0 when we call Mix_PlayChannel(-1, ...)
66
Mix_ReserveChannels(1);
68
int ret = Mix_OpenAudio(0, 0, 0, 0); // we ignore all these..
71
sound = Mix_LoadWAV("sound.ogg");
73
music = Mix_LoadMUS("music.ogg");
76
emscripten_set_main_loop(one_iter, 30, 0);