MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / nextTest

Function nextTest

test/browser/test_sdl2_audio_beep.cpp:168–199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

166int s = 0;
167
168void nextTest(void *unused = 0) {
169 ++f;
170 if (f >= NUM_ELEMS(freqs)) {
171 f = 0;
172 ++c;
173 if (c >= NUM_ELEMS(channels)) {
174 c = 0;
175 ++s;
176 if (s >= NUM_ELEMS(sdlAudioFormats)) {
177 printf("All tests done. Quit.\n");
178#ifdef __EMSCRIPTEN__
179 emscripten_cancel_main_loop();
180#endif
181 return;
182 }
183 }
184 }
185
186 double Hz = 440;
187 try {
188 beep = new Beeper(freqs[f], channels[c], sdlAudioFormats[s]);
189 } catch(...) {
190 printf("FAILED to play beep for %d msecs at %d Hz tone with audio format %s, %d channels, and %d samples/sec.\n",
191 tone_duration, (int)Hz, SdlAudioFormatToString(sdlAudioFormats[s]), channels[c], freqs[f]);
192 nextTest();
193 return;
194 }
195
196 printf("Playing back a beep for %d msecs at %d Hz tone with audio format %s, %d channels, and %d samples/sec.\n",
197 tone_duration, (int)Hz, SdlAudioFormatToString(sdlAudioFormats[s]), channels[c], freqs[f]);
198 beep->beep(Hz, tone_duration);
199}
200
201void update() {
202 SDL_LockAudio();

Callers 2

updateFunction · 0.70
mainFunction · 0.70

Calls 3

printfFunction · 0.85
SdlAudioFormatToStringFunction · 0.70
beepMethod · 0.45

Tested by

no test coverage detected