| 49 | } |
| 50 | |
| 51 | void |
| 52 | loop() |
| 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 | |
| 74 | int |
| 75 | main(int argc, char *argv[]) |
no test coverage detected