Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void BenchmarkCallback(void* userdata, Uint8* stream, int len)
- {
- SDL_AudioSpec* spec = (SDL_AudioSpec*) userdata;
- uint32_t SamplesWritten = len / (spec->size / spec->samples);
- memset(stream, 0x10, len);
- if (SecondDone)
- ; /* Don't update anything anymore! */
- else if (AlmostDone) {
- if (--AlmostDone == 0) {
- clock_gettime(CLOCK_MONOTONIC, &EndTime);
- SecondDone = true;
- }
- } else if (SamplesWritten >= SamplesRemaining) {
- SamplesRemaining = 0;
- /* We are almost done, but we must wait for SDL to request 2 more
- * buffers via this callback, because only then will we know that
- * everything has actually played. */
- AlmostDone = 2;
- } else {
- SamplesRemaining -= SamplesWritten;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement