scope rotation

This commit is contained in:
Boof2015
2026-07-10 21:08:29 -04:00
parent 4a9b325532
commit 7a1a799266
20 changed files with 695 additions and 191 deletions
+15 -2
View File
@@ -3,7 +3,7 @@ import type { ScopeKind } from './scope'
import type { ScopeSettings } from './settings'
export const PROFILE_FILE_FORMAT = 'prism-profile'
export const PROFILE_FILE_VERSION = 3
export const PROFILE_FILE_VERSION = 4
export const PROFILE_LOCAL_STATE_FORMAT = 'prism-profile-local'
export const PROFILE_LOCAL_STATE_VERSION = 1
export const LEGACY_PROFILE_MIGRATION_VERSION = 1
@@ -52,6 +52,19 @@ export interface PrismProfileFileV2 {
}
export interface PrismProfileFileV3 {
format: typeof PROFILE_FILE_FORMAT
version: 3
id: string
name: string
themeId?: string | null
scopeOrder: ScopeKind[]
hiddenScopes: ScopeKind[]
widthWeights: Record<ScopeKind, number>
scopeSettings: ScopeSettings
scopePopouts: PrismProfileFileScopePopoutMap
}
export interface PrismProfileFileV4 {
format: typeof PROFILE_FILE_FORMAT
version: typeof PROFILE_FILE_VERSION
id: string
@@ -64,7 +77,7 @@ export interface PrismProfileFileV3 {
scopePopouts: PrismProfileFileScopePopoutMap
}
export type PrismProfileFile = PrismProfileFileV1 | PrismProfileFileV2 | PrismProfileFileV3
export type PrismProfileFile = PrismProfileFileV1 | PrismProfileFileV2 | PrismProfileFileV3 | PrismProfileFileV4
export interface ProfileLocalMetadata {
windowBounds?: WindowBounds
+17
View File
@@ -10,6 +10,12 @@ export type ScopeKind =
export type AudioScopeKind = Exclude<ScopeKind, 'nowPlaying'>
export type TransformableScopeKind =
| 'spectrum'
| 'oscilloscope'
| 'spectrogram'
| 'waveform'
export const SCOPE_KINDS: ScopeKind[] = [
'spectrum',
'oscilloscope',
@@ -31,6 +37,17 @@ export const AUDIO_SCOPE_KINDS: AudioScopeKind[] = [
'waveform',
]
export const TRANSFORMABLE_SCOPE_KINDS: TransformableScopeKind[] = [
'spectrum',
'oscilloscope',
'spectrogram',
'waveform',
]
export function isTransformableScopeKind(value: ScopeKind): value is TransformableScopeKind {
return TRANSFORMABLE_SCOPE_KINDS.includes(value as TransformableScopeKind)
}
export function isAudioScopeKind(value: unknown): value is AudioScopeKind {
return typeof value === 'string' && AUDIO_SCOPE_KINDS.includes(value as AudioScopeKind)
}
+23
View File
@@ -0,0 +1,23 @@
export type ScopeDisplayRotation = 0 | 90 | 180 | 270
export interface ScopeDisplayTransformSettings {
rotation: ScopeDisplayRotation
mirrorHorizontal: boolean
}
export const SCOPE_DISPLAY_ROTATIONS: readonly ScopeDisplayRotation[] = [0, 90, 180, 270]
export const DEFAULT_SCOPE_DISPLAY_ROTATION: ScopeDisplayRotation = 0
export const DEFAULT_SCOPE_MIRROR_HORIZONTAL = false
export function isScopeDisplayRotation(value: unknown): value is ScopeDisplayRotation {
return typeof value === 'number'
&& SCOPE_DISPLAY_ROTATIONS.includes(value as ScopeDisplayRotation)
}
export function normalizeScopeDisplayRotation(value: unknown): ScopeDisplayRotation {
return isScopeDisplayRotation(value) ? value : DEFAULT_SCOPE_DISPLAY_ROTATION
}
export function normalizeScopeMirrorHorizontal(value: unknown): boolean {
return typeof value === 'boolean' ? value : DEFAULT_SCOPE_MIRROR_HORIZONTAL
}
+13 -11
View File
@@ -1,19 +1,22 @@
import type { VectorscopeMode } from '../renderer/visualizers/Vectorscope'
import {
DEFAULT_SPECTROGRAM_CONTRAST,
DEFAULT_SPECTROGRAM_ORIENTATION,
DEFAULT_SPECTROGRAM_TILT_DB_PER_OCTAVE,
type SpectrogramClarityMode,
type SpectrogramOrientation,
type SpectrogramScaleMode,
} from './spectrogram'
import { DEFAULT_VU_REFERENCE_DBFS, type VUMeterMode, type VUMeterNeedleChannels, type VUMeterOrientation } from './vumeter'
import { DEFAULT_LUFS_METER_READOUT, type LUFSMeterMode, type LUFSMeterReadout } from './lufsmeter'
import { DEFAULT_WAVEFORM_MODE, DEFAULT_WAVEFORM_SCROLL_SPEED, type WaveformMode } from './waveform'
import { DEFAULT_SPECTRUM_PEAK_INFO_MODE, type SpectrumPeakInfoMode } from './spectrum'
import {
DEFAULT_SCOPE_DISPLAY_ROTATION,
DEFAULT_SCOPE_MIRROR_HORIZONTAL,
type ScopeDisplayTransformSettings,
} from './scopeTransform'
export interface ScopeSettings {
spectrum: {
spectrum: ScopeDisplayTransformSettings & {
fftSize: number
tiltDbPerOctave: number
heatmap: boolean
@@ -25,7 +28,7 @@ export interface ScopeSettings {
showSideLine: boolean
peakInfoMode: SpectrumPeakInfoMode
}
oscilloscope: {
oscilloscope: ScopeDisplayTransformSettings & {
pitchLock: boolean
underfillEnabled: boolean
showGrid: boolean
@@ -38,14 +41,13 @@ export interface ScopeSettings {
persistence: number
lineWidth: number
}
spectrogram: {
spectrogram: ScopeDisplayTransformSettings & {
fftSize: number
tiltDbPerOctave: number
scrollSpeed: number
contrast: number
clarityMode: SpectrogramClarityMode
scaleMode: SpectrogramScaleMode
orientation: SpectrogramOrientation
colorScheme: 'heat' | 'mono'
}
vumeter: {
@@ -58,7 +60,7 @@ export interface ScopeSettings {
mode: LUFSMeterMode
readout: LUFSMeterReadout
}
waveform: {
waveform: ScopeDisplayTransformSettings & {
mode: WaveformMode
scrollSpeed: number
multiband: boolean
@@ -74,13 +76,13 @@ export interface ScopeSettings {
}
export const DEFAULT_SCOPE_SETTINGS: ScopeSettings = {
spectrum: { fftSize: 2048, tiltDbPerOctave: 2.0, heatmap: false, heatmapTiltDbPerOctave: 2.0, heatmapSmoothing: 0.5, showGrid: true, smoothing: 0.9, fillGradient: true, showSideLine: false, peakInfoMode: DEFAULT_SPECTRUM_PEAK_INFO_MODE },
oscilloscope: { pitchLock: true, underfillEnabled: false, showGrid: true, lineWidth: 2 },
spectrum: { rotation: DEFAULT_SCOPE_DISPLAY_ROTATION, mirrorHorizontal: DEFAULT_SCOPE_MIRROR_HORIZONTAL, fftSize: 2048, tiltDbPerOctave: 2.0, heatmap: false, heatmapTiltDbPerOctave: 2.0, heatmapSmoothing: 0.5, showGrid: true, smoothing: 0.9, fillGradient: true, showSideLine: false, peakInfoMode: DEFAULT_SPECTRUM_PEAK_INFO_MODE },
oscilloscope: { rotation: DEFAULT_SCOPE_DISPLAY_ROTATION, mirrorHorizontal: DEFAULT_SCOPE_MIRROR_HORIZONTAL, pitchLock: true, underfillEnabled: false, showGrid: true, lineWidth: 2 },
vectorscope: { mode: 'lissajous', multiband: false, showGrid: true, persistence: 0.10, lineWidth: 1.5 },
spectrogram: { fftSize: 4096, tiltDbPerOctave: DEFAULT_SPECTROGRAM_TILT_DB_PER_OCTAVE, scrollSpeed: 2, contrast: DEFAULT_SPECTROGRAM_CONTRAST, clarityMode: 'sharper', scaleMode: 'log', orientation: DEFAULT_SPECTROGRAM_ORIENTATION, colorScheme: 'heat' },
spectrogram: { rotation: DEFAULT_SCOPE_DISPLAY_ROTATION, mirrorHorizontal: DEFAULT_SCOPE_MIRROR_HORIZONTAL, fftSize: 4096, tiltDbPerOctave: DEFAULT_SPECTROGRAM_TILT_DB_PER_OCTAVE, scrollSpeed: 2, contrast: DEFAULT_SPECTROGRAM_CONTRAST, clarityMode: 'sharper', scaleMode: 'log', colorScheme: 'heat' },
vumeter: { mode: 'bar', orientation: 'horizontal', needleChannels: 'stereo', referenceDb: DEFAULT_VU_REFERENCE_DBFS },
lufsmeter: { mode: 'bar', readout: DEFAULT_LUFS_METER_READOUT },
waveform: { mode: DEFAULT_WAVEFORM_MODE, scrollSpeed: DEFAULT_WAVEFORM_SCROLL_SPEED, multiband: false },
waveform: { rotation: DEFAULT_SCOPE_DISPLAY_ROTATION, mirrorHorizontal: DEFAULT_SCOPE_MIRROR_HORIZONTAL, mode: DEFAULT_WAVEFORM_MODE, scrollSpeed: DEFAULT_WAVEFORM_SCROLL_SPEED, multiband: false },
nowPlaying: {
showCoverArt: true,
showTitle: true,