diff options
author | Michael J. Bishop <mbtyke@gmail.com> | 2013-02-21 23:46:44 -0500 |
---|---|---|
committer | Michael J. Bishop <mbtyke@gmail.com> | 2013-02-22 10:47:23 -0500 |
commit | a7d7dad8baefd2fae9f56ab46afe7af7fef215cd (patch) | |
tree | 4ddfeadc8de0da003b9dbc5c8fae63465c9b4af0 /tests/sdl_audio.c | |
parent | 122a07dd4f399b8985fafedf4e515b8484b17c3c (diff) |
Added some SDL_Mixer calls:
- `Mix_Playing`
- `Mix_Pause`
- `Mix_Pause`
- `Mix_Resume`
Diffstat (limited to 'tests/sdl_audio.c')
-rw-r--r-- | tests/sdl_audio.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/tests/sdl_audio.c b/tests/sdl_audio.c index 938df3c4..ce3bf5a9 100644 --- a/tests/sdl_audio.c +++ b/tests/sdl_audio.c @@ -6,13 +6,14 @@ Mix_Chunk *sound, *sound2; -void play2(); +int play2(); -void play() { +int play() { int channel = Mix_PlayChannel(-1, sound, 1); assert(channel == 0); emscripten_run_script("setTimeout(Module['_play2'], 500)"); + return channel; } void done(int channel) { @@ -22,11 +23,12 @@ void done(int channel) { REPORT_RESULT(); } -void play2() { +int play2() { Mix_ChannelFinished(done); int channel2 = Mix_PlayChannel(-1, sound2, 1); assert(channel2 == 1); + return channel2; } int main(int argc, char **argv) { @@ -40,7 +42,17 @@ int main(int argc, char **argv) { sound2 = Mix_LoadWAV("sound2.wav"); assert(sound); - play(); + int channel = play(); + printf( "Pausing Channel %d", channel ); + Mix_Pause(channel); + int paused = Mix_Paused(channel); + printf( "Channel %d %s", channel, paused ? "is paused" : "is NOT paused" ); + assert(paused); + Mix_Resume(channel); + paused = Mix_Paused(channel); + printf( "Channel %d %s", channel, paused ? "is paused" : "is NOT paused" ); + assert(paused == 0); + if (argc == 12121) play2(); // keep it alive emscripten_run_script("element = document.createElement('input');" |