MCPcopy Create free account
hub / github.com/RavEngine/RavEngine / loop

Function loop

deps/SDL2/test/loopwavequeue.c:51–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49}
50
51void
52loop()
53{
54#ifdef __EMSCRIPTEN__
55 if (done || (SDL_GetAudioStatus() != SDL_AUDIO_PLAYING)) {
56 emscripten_cancel_main_loop();
57 }
58 else
59#endif
60 {
61 /* The device from SDL_OpenAudio() is always device #1. */
62 const Uint32 queued = SDL_GetQueuedAudioSize(1);
63 SDL_Log("Device has %u bytes queued.\n", (unsigned int) queued);
64 if (queued <= 8192) { /* time to requeue the whole thing? */
65 if (SDL_QueueAudio(1, wave.sound, wave.soundlen) == 0) {
66 SDL_Log("Device queued %u more bytes.\n", (unsigned int) wave.soundlen);
67 } else {
68 SDL_Log("Device FAILED to queue %u more bytes: %s\n", (unsigned int) wave.soundlen, SDL_GetError());
69 }
70 }
71 }
72}
73
74int
75main(int argc, char *argv[])

Callers 1

mainFunction · 0.70

Calls 5

SDL_GetAudioStatusFunction · 0.85
SDL_GetQueuedAudioSizeFunction · 0.85
SDL_LogFunction · 0.85
SDL_QueueAudioFunction · 0.85
SDL_GetErrorFunction · 0.85

Tested by

no test coverage detected