When the main loop should pause after running a tick, don't update the SDL audio queue.

This commit is contained in:
Jukka Jylänki 2014-09-26 23:33:14 +03:00
Родитель a9664e598b
Коммит cdaaa74df7
1 изменённых файлов: 7 добавлений и 6 удалений

Просмотреть файл

@ -1018,18 +1018,19 @@ mergeInto(LibraryManager.library, {
}
});
// Queue new audio data. This is important to be right after the main loop invocation, so that we will immediately be able
// to queue the newest produced audio samples.
// TODO: Consider adding pre- and post- rAF callbacks so that GL.newRenderingFrameStarted() and SDL.audio.queueNewAudioData()
// do not need to be hardcoded into this function, but can be more generic.
if (typeof SDL === 'object' && SDL.audio && SDL.audio.queueNewAudioData) SDL.audio.queueNewAudioData();
if (Browser.mainLoop.shouldPause) {
// catch pauses from the main loop itself
Browser.mainLoop.paused = true;
Browser.mainLoop.shouldPause = false;
return;
}
// Queue new audio data. This is important to be right after the main loop invocation, so that we will immediately be able
// to queue the newest produced audio samples.
// TODO: Consider adding pre- and post- rAF callbacks so that GL.newRenderingFrameStarted() and SDL.audio.queueNewAudioData()
// do not need to be hardcoded into this function, but can be more generic.
if (typeof SDL === 'object' && SDL.audio && SDL.audio.queueNewAudioData) SDL.audio.queueNewAudioData();
Browser.mainLoop.scheduler();
}
if (fps && fps > 0) {