From db377c97b42f5f0f6acf4719286b0d22c342ed3c Mon Sep 17 00:00:00 2001 From: Boof2015 <75185879+Boof2015@users.noreply.github.com> Date: Tue, 21 Apr 2026 20:02:48 -0400 Subject: [PATCH] get rid of seperate gain in waveform --- src/renderer/components/ScopeModule.tsx | 1 - src/renderer/components/ScopeSettingsSection.tsx | 16 +--------------- src/renderer/visualizers/Waveform.ts | 11 ++--------- src/shared/profileState.ts | 15 ++++++++++++++- src/types/settings.ts | 3 +-- src/types/waveform.ts | 15 --------------- test/profile-library.test.ts | 12 ++++++++++++ test/renderer-helpers.test.ts | 14 ++++++-------- 8 files changed, 36 insertions(+), 51 deletions(-) diff --git a/src/renderer/components/ScopeModule.tsx b/src/renderer/components/ScopeModule.tsx index 9defa94..5aedc42 100644 --- a/src/renderer/components/ScopeModule.tsx +++ b/src/renderer/components/ScopeModule.tsx @@ -296,7 +296,6 @@ export function scopeSettingsToOptions( }, mode: s.mode, scrollSpeed: s.scrollSpeed, - gainDb: s.gainDb, multiband: s.multiband, } } diff --git a/src/renderer/components/ScopeSettingsSection.tsx b/src/renderer/components/ScopeSettingsSection.tsx index 4827fef..1be5d92 100644 --- a/src/renderer/components/ScopeSettingsSection.tsx +++ b/src/renderer/components/ScopeSettingsSection.tsx @@ -69,10 +69,7 @@ export function scopeSummary(kind: ScopeKind, settings: ScopeSettings[ScopeKind] return 'Bar Meter' case 'waveform': { const scopeSettings = settings as ScopeSettings['waveform'] - const summary = [`${scopeSettings.gainDb > 0 ? '+' : ''}${scopeSettings.gainDb} dB`] - if (scopeSettings.mode === 'stereo') { - summary.push('Stereo') - } + const summary = [scopeSettings.mode === 'stereo' ? 'Stereo' : 'Mono'] if (scopeSettings.multiband) { summary.push('RGB') } @@ -523,17 +520,6 @@ export default function ScopeSettingsSection({ /> - 0 ? '+' : ''}${current.gainDb.toFixed(0)} dB`} - min={-12} - max={12} - step={1} - fullWidth={false} - onChange={(value) => onUpdate('waveform', { gainDb: value })} - /> - = typeof parsed.spectrum === 'object' && parsed.spectrum !== null ? parsed.spectrum : {} + const rawWaveform: Partial = typeof parsed.waveform === 'object' && parsed.waveform !== null + ? parsed.waveform + : {} const rawNowPlaying: Partial = typeof legacyParsed.nowPlaying === 'object' && legacyParsed.nowPlaying !== null ? legacyParsed.nowPlaying : (typeof legacyParsed.astra === 'object' && legacyParsed.astra !== null ? legacyParsed.astra : {}) @@ -149,7 +153,16 @@ export function mergeScopeSettings(raw: unknown): ScopeSettings { spectrogram: { ...DEFAULT_SCOPE_SETTINGS.spectrogram, ...(parsed.spectrogram ?? {}) }, vumeter: { ...DEFAULT_SCOPE_SETTINGS.vumeter, ...(parsed.vumeter ?? {}) }, lufsmeter: { ...DEFAULT_SCOPE_SETTINGS.lufsmeter, ...(parsed.lufsmeter ?? {}) }, - waveform: { ...DEFAULT_SCOPE_SETTINGS.waveform, ...(parsed.waveform ?? {}) }, + waveform: { + ...DEFAULT_SCOPE_SETTINGS.waveform, + mode: rawWaveform.mode === 'stereo' || rawWaveform.mode === 'mono' + ? rawWaveform.mode + : DEFAULT_SCOPE_SETTINGS.waveform.mode, + scrollSpeed: clampWaveformScrollSpeed(rawWaveform.scrollSpeed ?? DEFAULT_SCOPE_SETTINGS.waveform.scrollSpeed), + multiband: typeof rawWaveform.multiband === 'boolean' + ? rawWaveform.multiband + : DEFAULT_SCOPE_SETTINGS.waveform.multiband, + }, nowPlaying: { ...DEFAULT_SCOPE_SETTINGS.nowPlaying, ...rawNowPlaying }, } } diff --git a/src/types/settings.ts b/src/types/settings.ts index ca645ad..f812ee1 100644 --- a/src/types/settings.ts +++ b/src/types/settings.ts @@ -48,7 +48,6 @@ export interface ScopeSettings { waveform: { mode: WaveformMode scrollSpeed: number - gainDb: number multiband: boolean } nowPlaying: { @@ -68,7 +67,7 @@ export const DEFAULT_SCOPE_SETTINGS: ScopeSettings = { spectrogram: { fftSize: 2048, scrollSpeed: 2, clarityMode: 'sharper', scaleMode: 'log', colorScheme: 'heat' }, vumeter: { mode: 'bar', orientation: 'horizontal' }, lufsmeter: { mode: 'bar' }, - waveform: { mode: DEFAULT_WAVEFORM_MODE, scrollSpeed: 1, gainDb: 0, multiband: false }, + waveform: { mode: DEFAULT_WAVEFORM_MODE, scrollSpeed: 1, multiband: false }, nowPlaying: { showCoverArt: true, showTitle: true, diff --git a/src/types/waveform.ts b/src/types/waveform.ts index 944149b..f61edda 100644 --- a/src/types/waveform.ts +++ b/src/types/waveform.ts @@ -4,10 +4,6 @@ export const MIN_WAVEFORM_SCROLL_SPEED = 0.5 export const MAX_WAVEFORM_SCROLL_SPEED = 8 export const WAVEFORM_SCROLL_SPEED_STEP = 0.5 export const DEFAULT_WAVEFORM_SCROLL_SPEED = 1 -export const MIN_WAVEFORM_GAIN_DB = -12 -export const MAX_WAVEFORM_GAIN_DB = 18 -export const WAVEFORM_GAIN_DB_STEP = 0.5 -export const DEFAULT_WAVEFORM_GAIN_DB = 0 export const DEFAULT_WAVEFORM_MODE: WaveformMode = 'mono' export function clampWaveformScrollSpeed(value: unknown): number { @@ -19,14 +15,3 @@ export function clampWaveformScrollSpeed(value: unknown): number { const snapped = Math.round(numeric / WAVEFORM_SCROLL_SPEED_STEP) * WAVEFORM_SCROLL_SPEED_STEP return Math.min(MAX_WAVEFORM_SCROLL_SPEED, Math.max(MIN_WAVEFORM_SCROLL_SPEED, snapped)) } - -export function clampWaveformGainDb(value: unknown): number { - const numeric = Number(value) - if (!Number.isFinite(numeric)) { - return DEFAULT_WAVEFORM_GAIN_DB - } - - const snapped = Math.round(numeric / WAVEFORM_GAIN_DB_STEP) * WAVEFORM_GAIN_DB_STEP - const rounded = Math.round(snapped * 10) / 10 - return Math.min(MAX_WAVEFORM_GAIN_DB, Math.max(MIN_WAVEFORM_GAIN_DB, rounded)) -} diff --git a/test/profile-library.test.ts b/test/profile-library.test.ts index 265f1ac..0a5d1a0 100644 --- a/test/profile-library.test.ts +++ b/test/profile-library.test.ts @@ -191,6 +191,14 @@ test('partial files normalize, unsupported versions fail, and import does not ch id: 'profile_partial', name: 'Partial', scopeOrder: ['spectrogram'], + scopeSettings: { + waveform: { + mode: 'stereo', + scrollSpeed: 2, + gainDb: 6, + multiband: true, + }, + }, scopePopouts: { spectrogram: { poppedOut: true } }, }, null, 2)}\n`, 'utf8') @@ -199,6 +207,10 @@ test('partial files normalize, unsupported versions fail, and import does not ch assert.equal(partialSnapshot.profiles.profile_partial.scopeSettings.spectrum.showSideLine, false) assert.equal(partialSnapshot.profiles.profile_partial.scopeSettings.spectrum.heatmapSmoothing, 0.5) assert.equal(partialSnapshot.profiles.profile_partial.scopeSettings.spectrogram.colorScheme, 'heat') + assert.equal(partialSnapshot.profiles.profile_partial.scopeSettings.waveform.mode, 'stereo') + assert.equal(partialSnapshot.profiles.profile_partial.scopeSettings.waveform.scrollSpeed, 2) + assert.equal(partialSnapshot.profiles.profile_partial.scopeSettings.waveform.multiband, true) + assert.equal(Object.hasOwn(partialSnapshot.profiles.profile_partial.scopeSettings.waveform, 'gainDb'), false) assert.equal(partialSnapshot.profiles.profile_partial.scopePopouts.spectrogram.poppedOut, true) assert.equal(partialSnapshot.profiles.profile_partial.widthWeights.spectrum, 1) diff --git a/test/renderer-helpers.test.ts b/test/renderer-helpers.test.ts index fcfb367..bc0524f 100644 --- a/test/renderer-helpers.test.ts +++ b/test/renderer-helpers.test.ts @@ -1721,6 +1721,7 @@ test('scopeSettingsToOptions wires waveform stereo mode into analyzer options', assert.equal(options.backgroundColor, theme.waveform.background) assert.equal(options.gridMajorColor, theme.waveform.guides) assert.equal(options.gridMinorColor, theme.waveform.guidesSecondary) + assert.equal(Object.hasOwn(options, 'gainDb'), false) }) test('scopeSettingsToOptions forwards shared scope background and guides to oscilloscope and vectorscope', () => { @@ -1934,17 +1935,16 @@ test('scopeSettingsToOptions forwards themed backgrounds and track colors to spe assert.equal(lufsmeter.labelColor, theme.lufsmeter.labels) }) -test('scopeSummary includes Stereo for waveform only when stereo mode is enabled', () => { +test('scopeSummary includes only waveform display modes', () => { const profile = createDefaultProfile('Default') - profile.scopeSettings.waveform.gainDb = 6 - assert.equal(scopeSummary('waveform', profile.scopeSettings.waveform), '+6 dB') + assert.equal(scopeSummary('waveform', profile.scopeSettings.waveform), 'Mono') profile.scopeSettings.waveform.mode = 'stereo' - assert.equal(scopeSummary('waveform', profile.scopeSettings.waveform), '+6 dB · Stereo') + assert.equal(scopeSummary('waveform', profile.scopeSettings.waveform), 'Stereo') profile.scopeSettings.waveform.multiband = true - assert.equal(scopeSummary('waveform', profile.scopeSettings.waveform), '+6 dB · Stereo · RGB') + assert.equal(scopeSummary('waveform', profile.scopeSettings.waveform), 'Stereo · RGB') }) test('scopeSummary includes spectrum peak mode when enabled', () => { @@ -2000,7 +2000,6 @@ test('applying a profile snapshot does not change the machine-local frame target const defaultProfile = createDefaultProfile('Default') const alternateProfile = createDefaultProfile('Live Mix') alternateProfile.hiddenScopes = [] - alternateProfile.scopeSettings.waveform.gainDb = 6 useSettingsStore.getState().applyExternalProfileSnapshot({ activeProfileId: 'profile_live_mix', @@ -2030,7 +2029,6 @@ test('applying a profile snapshot does not change the machine-local trim', () => const defaultProfile = createDefaultProfile('Default') const alternateProfile = createDefaultProfile('Live Mix') alternateProfile.hiddenScopes = [] - alternateProfile.scopeSettings.waveform.gainDb = 6 useSettingsStore.getState().applyExternalProfileSnapshot({ activeProfileId: 'profile_live_mix', @@ -2072,7 +2070,7 @@ test('profile draft comparisons return to clean after reverting a change', () => ...baselineProfile.scopeSettings, waveform: { ...baselineProfile.scopeSettings.waveform, - gainDb: baselineProfile.scopeSettings.waveform.gainDb + 3, + scrollSpeed: baselineProfile.scopeSettings.waveform.scrollSpeed + 1, }, }, scopePopouts: baselineProfile.scopePopouts,