~ubuntu-branches/ubuntu/vivid/emscripten/vivid

« back to all changes in this revision

Viewing changes to tests/sdl_audio_mix.c

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-09-20 22:44:35 UTC
  • mfrom: (4.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20130920224435-apuwj4fsl3fqv1a6
Tags: 1.5.6~20130920~6010666-1
* New snapshot release
* Update the list of supported architectures to the same as libv8
  (Closes: #723129)
* emlibtool has been removed from upstream.
* Fix warning syntax-error-in-dep5-copyright
* Refresh of the patches

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
#include <emscripten.h>
6
6
 
7
7
static Mix_Chunk *sound = NULL;
 
8
static Mix_Chunk *noiseLoop = NULL;
8
9
static Mix_Music *music = NULL;
9
10
 
10
11
static int soundChannel = 0;
 
12
static int noiseLoopChannel = 0;
11
13
 
12
14
void one_iter();
13
15
void one_iter() {
19
21
      soundChannel = Mix_PlayChannel(-1, sound, 0);
20
22
      printf("channel = %d", soundChannel);
21
23
      assert(soundChannel != -1 && soundChannel != 0);
 
24
 
 
25
      noiseLoopChannel = Mix_PlayChannel(-1, noiseLoop, -1);
 
26
      printf("noiseLoopChannel = %d", noiseLoopChannel);
 
27
      assert(noiseLoopChannel != -1 && noiseLoopChannel != 0);
 
28
      // set noiseLoopChannel to half volume
 
29
      Mix_Volume(noiseLoopChannel,MIX_MAX_VOLUME/10);
22
30
      break;
23
31
    case 2:
24
32
      printf("channel %d is playing = %d", soundChannel, Mix_Playing(soundChannel));
70
78
 
71
79
  sound = Mix_LoadWAV("sound.ogg");
72
80
  assert(sound);
 
81
  noiseLoop = Mix_LoadWAV("noise.ogg");
 
82
  assert(noiseLoop);
 
83
 
73
84
  music = Mix_LoadMUS("music.ogg");
74
85
  assert(music);
75
 
 
76
86
  emscripten_set_main_loop(one_iter, 30, 0);
77
87
 
78
88
  // force a quit