adjust smoothing in now playing spectrum

This commit is contained in:
Boof2015
2026-07-15 14:50:56 -04:00
parent b290cfed7a
commit b5f1ca9e99
9 changed files with 55 additions and 19 deletions
+7 -2
View File
@@ -34,6 +34,8 @@ interface SpectrumCurveProps {
frameMs?: number;
/** Native pull cadence. Defaults to frameMs; 0 advances analysis every display frame. */
analysisFrameMs?: number;
/** Previous native spectrum-frame retention in [0, 0.99]. */
smoothing?: number;
dbMin?: number;
dbMax?: number;
tiltDbPerOctave?: number;
@@ -54,6 +56,7 @@ type SkiaViewApiShape = {
const DEFAULT_POINTS = 120;
const MINI_FRAME_MS = 32;
const DEFAULT_SMOOTHING = 0.92;
const DISPLAY_DB_MIN = -90;
const DISPLAY_DB_MAX = -10;
const SPECTRUM_SAMPLE_RATE = 48000;
@@ -376,6 +379,7 @@ export function SpectrumCurve({
pointCount,
frameMs = MINI_FRAME_MS,
analysisFrameMs,
smoothing = DEFAULT_SMOOTHING,
dbMin = DISPLAY_DB_MIN,
dbMax = DISPLAY_DB_MAX,
tiltDbPerOctave = TILT_DB_PER_OCT,
@@ -567,8 +571,8 @@ export function SpectrumCurve({
lastAnalysis = t;
const got =
source === 'post'
? AstraScope.getSpectrumFramePostEq(spectrumBins)
: AstraScope.getSpectrumFrame(spectrumBins);
? AstraScope.getSpectrumFramePostEq(spectrumBins, smoothing)
: AstraScope.getSpectrumFrame(spectrumBins, smoothing);
if (got > 0) {
writeSpectrumPoints(spectrumBins, renderValues, pointOptions);
hasNewFrame = true;
@@ -601,6 +605,7 @@ export function SpectrumCurve({
reduceMotion,
resolvedPointCount,
source,
smoothing,
tiltDbPerOctave,
width,
]);
+3
View File
@@ -25,6 +25,7 @@ interface VisualizerProps {
showChrome?: boolean;
mode?: Mode;
edgeFade?: boolean;
spectrumSmoothing?: number;
/** Freeze the live scopes without unmounting (e.g. while occluded by an overlay). */
paused?: boolean;
}
@@ -41,6 +42,7 @@ export function Visualizer({
showChrome = true,
mode: controlledMode,
edgeFade = false,
spectrumSmoothing,
paused = false,
}: VisualizerProps) {
const styles = useStyles();
@@ -72,6 +74,7 @@ export function Visualizer({
<SpectrumCurve
active={spectrumActive}
frameMs={STAGE_FRAME_MS}
smoothing={spectrumSmoothing}
width={width}
height={height}
glow
@@ -109,6 +109,7 @@ const SUB_ICON_SIZE = 20;
const MENU_ANIMATION_IN_MS = 130;
const MENU_ANIMATION_OUT_MS = 100;
const MENU_ENTER_OFFSET_Y = -8;
const NOW_PLAYING_SPECTRUM_SMOOTHING = 0.85;
interface NowPlayingMenuItem {
key: string;
@@ -983,6 +984,7 @@ export function NowPlayingOverlay() {
size={artBoxSize}
stripWidth={layout.scopeWidth}
artworkUri={backdropArtworkUri}
spectrumSmoothing={NOW_PLAYING_SPECTRUM_SMOOTHING}
paused={!playerOpen || queueOpen || !effectiveScopeStageVisible}
/>
</Animated.View>
@@ -1457,6 +1459,7 @@ function ScopeRail({ width, height, mode, paused, revealed, onSwap }: ScopeRailP
showChrome={false}
mode={mode}
edgeFade
spectrumSmoothing={NOW_PLAYING_SPECTRUM_SMOOTHING}
paused={paused}
/>
<Animated.View pointerEvents="none" style={[styles.scopeSwap, labelStyle]}>
+9 -1
View File
@@ -35,6 +35,7 @@ interface ScopeRackProps {
/** Strip span (the rail's width): wider than the card, overflowing it. */
stripWidth: number;
artworkUri: string | null;
spectrumSmoothing?: number;
/** Freeze the scopes without unmounting (overlay closed / queue open). */
paused?: boolean;
}
@@ -45,7 +46,13 @@ interface ScopeRackProps {
* backdrop dissolves past the former card frame, while the strips span the
* full rail width and independently fade at their ends.
*/
export function ScopeRack({ size, stripWidth, artworkUri, paused = false }: ScopeRackProps) {
export function ScopeRack({
size,
stripWidth,
artworkUri,
spectrumSmoothing,
paused = false,
}: ScopeRackProps) {
const styles = useStyles();
const artwork = useImage(artworkUri);
const active = useScopeActive() && !paused;
@@ -114,6 +121,7 @@ export function ScopeRack({ size, stripWidth, artworkUri, paused = false }: Scop
<SpectrumCurve
active={active}
frameMs={STAGE_FRAME_MS}
smoothing={spectrumSmoothing}
width={width}
height={stripHeight}
glow