aboutsummaryrefslogtreecommitdiff
path: root/tests/sdl_audio.c
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-05-04 17:33:51 -0700
committerAlon Zakai <alonzakai@gmail.com>2012-05-04 17:33:51 -0700
commit3651e7c0c0b1097a4f47275fc151162e309326d0 (patch)
tree5a28f19311e5acbc0501f00f29e0f0ab5e68b3ed /tests/sdl_audio.c
parent5d34069298cf26ecc4e78779a77a7491f8feafe6 (diff)
support for SDL channels and channelFinished
Diffstat (limited to 'tests/sdl_audio.c')
-rw-r--r--tests/sdl_audio.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/tests/sdl_audio.c b/tests/sdl_audio.c
index 4927d868..938df3c4 100644
--- a/tests/sdl_audio.c
+++ b/tests/sdl_audio.c
@@ -10,14 +10,23 @@ void play2();
void play() {
int channel = Mix_PlayChannel(-1, sound, 1);
- assert(channel >= 0);
+ assert(channel == 0);
emscripten_run_script("setTimeout(Module['_play2'], 500)");
}
+void done(int channel) {
+ assert(channel == 1);
+
+ int result = 1;
+ REPORT_RESULT();
+}
+
void play2() {
+ Mix_ChannelFinished(done);
+
int channel2 = Mix_PlayChannel(-1, sound2, 1);
- assert(channel2 >= 0);
+ assert(channel2 == 1);
}
int main(int argc, char **argv) {
@@ -42,9 +51,6 @@ int main(int argc, char **argv) {
printf("you should hear two sounds. press the button to replay!\n");
- int result = 1;
- REPORT_RESULT();
-
return 0;
}