Smooth realtime display frame pacing
This commit is contained in:
+8
-2
@@ -2698,14 +2698,20 @@ async function loop(now){
|
||||
const currentAudioSeq = Math.max(currentMetricsSeq, currentVisualsSeq, currentXySeq);
|
||||
const audioDirty = currentAudioSeq > lastRenderedAudioSeq;
|
||||
const shouldRenderFrame =
|
||||
audioOk ||
|
||||
renderDirty ||
|
||||
audioDirty ||
|
||||
!audioOk ||
|
||||
style === 'options-panel' ||
|
||||
style === 'recorder' ||
|
||||
renderStyle === 'clock';
|
||||
if (elapsed >= target){
|
||||
lastFrameTime = now - (elapsed % targetMs);
|
||||
// With live audio, requestAnimationFrame itself is the display clock. An
|
||||
// additional exact 60 Hz comparison occasionally rejected a real 60 Hz
|
||||
// frame because of fractional timestamp jitter, creating 33 ms pauses in
|
||||
// otherwise smooth peak decay. Only throttle the disconnected state.
|
||||
const frameDue = audioOk || elapsed >= target;
|
||||
if (frameDue){
|
||||
lastFrameTime = audioOk ? now : now - (elapsed % targetMs);
|
||||
try{
|
||||
updateRect();
|
||||
meterHitRects.length = 0;
|
||||
|
||||
Reference in New Issue
Block a user