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

Function nextTest

test/browser/test_sdl_audio_beep.cpp:175–206  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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