mirror of
https://github.com/Boof2015/astra-mobile.git
synced 2026-08-19 04:06:43 +02:00
new scheduling for scopes
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user