aboutsummaryrefslogtreecommitdiff
path: root/tests/sdl_audio_mix.c
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-06-17 14:06:20 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-06-17 14:06:20 -0700
commit31f73d04a0f1120746e40b7a35b5d609dbc598ab (patch)
tree6475258a71783f670d3a74977adb9c9a188a8657 /tests/sdl_audio_mix.c
parentc47a05ce615425df9ecdc1765a753885d707cdea (diff)
parent5b41371bb5897a49e1fdcad18d053f775105c846 (diff)
Merge pull request #1286 from michaeljbishop/looping-audio-test
Added test for SDL_Mix that includes looping audio.
Diffstat (limited to 'tests/sdl_audio_mix.c')
-rw-r--r--tests/sdl_audio_mix.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/sdl_audio_mix.c b/tests/sdl_audio_mix.c
index f72f9c43..a1c0485d 100644
--- a/tests/sdl_audio_mix.c
+++ b/tests/sdl_audio_mix.c
@@ -5,9 +5,11 @@
#include <emscripten.h>
static Mix_Chunk *sound = NULL;
+static Mix_Chunk *noiseLoop = NULL;
static Mix_Music *music = NULL;
static int soundChannel = 0;
+static int noiseLoopChannel = 0;
void one_iter();
void one_iter() {
@@ -19,6 +21,12 @@ void one_iter() {
soundChannel = Mix_PlayChannel(-1, sound, 0);
printf("channel = %d", soundChannel);
assert(soundChannel != -1 && soundChannel != 0);
+
+ noiseLoopChannel = Mix_PlayChannel(-1, noiseLoop, -1);
+ printf("noiseLoopChannel = %d", noiseLoopChannel);
+ assert(noiseLoopChannel != -1 && noiseLoopChannel != 0);
+ // set noiseLoopChannel to half volume
+ Mix_Volume(noiseLoopChannel,MIX_MAX_VOLUME/10);
break;
case 2:
printf("channel %d is playing = %d", soundChannel, Mix_Playing(soundChannel));
@@ -70,9 +78,11 @@ int main(int argc, char **argv) {
sound = Mix_LoadWAV("sound.ogg");
assert(sound);
+ noiseLoop = Mix_LoadWAV("noise.ogg");
+ assert(noiseLoop);
+
music = Mix_LoadMUS("music.ogg");
assert(music);
-
emscripten_set_main_loop(one_iter, 30, 0);
// force a quit