new scheduling for scopes

This commit is contained in:
Boof2015
2026-07-25 20:16:33 -04:00
parent 6dd82420c8
commit 629be4d9ef
7 changed files with 283 additions and 23 deletions
+2 -2
View File
@@ -8,7 +8,7 @@ interface OscilloscopeWaveProps {
active: boolean;
width: number;
height: number;
/** Live render cadence; 0 means display-sync. */
/** Live render cadence; 0 uses native adaptive display synchronization. */
frameMs?: number;
color?: string;
lineWidth?: number;
@@ -27,7 +27,7 @@ export function OscilloscopeWave({
active,
width,
height,
frameMs = 16,
frameMs = 0,
color: colorProp,
lineWidth = 2,
glow = false,
+6 -5
View File
@@ -12,9 +12,10 @@ import { createThemedStyles, useColors } from '@/theme/themed';
import { useScopeActive } from '@/scope/scopeStore';
const CANVAS_HEIGHT = 96;
// 60fps cap: display-sync (0) pinned the JS thread at 120Hz on high-refresh
// devices and starved every other animation.
const STAGE_FRAME_MS = 16;
// Spectrum remains intentionally capped; native oscilloscope rendering follows
// the display up to 90 Hz and falls back to at most 60 Hz under system pressure.
const SPECTRUM_FRAME_MS = 16;
const OSCILLOSCOPE_FRAME_MS = 0;
type Mode = 'spectrum' | 'scope';
@@ -73,7 +74,7 @@ export function Visualizer({
{mode === 'spectrum' ? (
<SpectrumCurve
active={spectrumActive}
frameMs={STAGE_FRAME_MS}
frameMs={SPECTRUM_FRAME_MS}
smoothing={spectrumSmoothing}
width={width}
height={height}
@@ -83,7 +84,7 @@ export function Visualizer({
) : (
<OscilloscopeWave
active={scopeWaveActive}
frameMs={STAGE_FRAME_MS}
frameMs={OSCILLOSCOPE_FRAME_MS}
width={width}
height={height}
glow
+6 -5
View File
@@ -16,9 +16,10 @@ import { useScopeActive } from '@/scope/scopeStore';
import { spacing } from '@/theme';
import { createThemedStyles } from '@/theme/themed';
// 60fps cap, matching Visualizer — display-sync starved the JS thread on
// high-refresh devices.
const STAGE_FRAME_MS = 16;
// Spectrum stays capped at 60 fps. The native oscilloscope follows the display
// up to 90 Hz and falls back to at most 60 Hz under system pressure.
const SPECTRUM_FRAME_MS = 16;
const OSCILLOSCOPE_FRAME_MS = 0;
// The rack artwork is atmosphere, not a second cover card. It bleeds beyond
// the old frame, stays softly defocused, and contributes restrained color.
const BACKDROP_BLUR_RADIUS = 10;
@@ -111,7 +112,7 @@ export function ScopeRack({
<View style={[styles.strips, { width, left: (size - width) / 2 }]}>
<OscilloscopeWave
active={active}
frameMs={STAGE_FRAME_MS}
frameMs={OSCILLOSCOPE_FRAME_MS}
width={width}
height={stripHeight}
glow
@@ -120,7 +121,7 @@ export function ScopeRack({
/>
<SpectrumCurve
active={active}
frameMs={STAGE_FRAME_MS}
frameMs={SPECTRUM_FRAME_MS}
smoothing={spectrumSmoothing}
width={width}
height={stripHeight}