mirror of
https://github.com/Boof2015/prism.git
synced 2026-08-16 16:21:11 +02:00
add stereo to waveform scope, add side metering to spectrum
This commit is contained in:
@@ -58,7 +58,7 @@ function getScopeTheme(theme: PrismResolvedTheme, kind: ScopeKind): ScopeModuleT
|
||||
return theme[kind] as ScopeModuleTheme
|
||||
}
|
||||
|
||||
function scopeSettingsToOptions(
|
||||
export function scopeSettingsToOptions(
|
||||
kind: ScopeKind,
|
||||
settings: ScopeSettings[ScopeKind],
|
||||
theme: ScopeModuleTheme,
|
||||
@@ -69,6 +69,7 @@ function scopeSettingsToOptions(
|
||||
const t = theme as ResolvedSpectrumTheme
|
||||
return {
|
||||
lineColor: t.primary,
|
||||
secondaryLineColor: t.secondary,
|
||||
gradientColors: t.fillGradient,
|
||||
heatColors: t.heatColors,
|
||||
backgroundColor: t.background,
|
||||
@@ -80,6 +81,7 @@ function scopeSettingsToOptions(
|
||||
showGrid: s.showGrid,
|
||||
fillGradient: s.fillGradient,
|
||||
smoothing: s.smoothing,
|
||||
showSideLine: s.showSideLine,
|
||||
}
|
||||
}
|
||||
case 'oscilloscope': {
|
||||
@@ -164,6 +166,7 @@ function scopeSettingsToOptions(
|
||||
mid: t.midBand,
|
||||
high: t.highBand,
|
||||
},
|
||||
mode: s.mode,
|
||||
scrollSpeed: s.scrollSpeed,
|
||||
gainDb: s.gainDb,
|
||||
multiband: s.multiband,
|
||||
|
||||
@@ -20,10 +20,12 @@ function buildConsumerDemand(kind: ScopeKind): Record<ScopeKind, boolean> {
|
||||
}, {} as Record<ScopeKind, boolean>)
|
||||
}
|
||||
|
||||
function flushScopeAudioBatch(kind: ScopeKind): ScopePopoutAudioBatch {
|
||||
function flushScopeAudioBatch(kind: ScopeKind, scopeSettings: ScopeSettings): ScopePopoutAudioBatch {
|
||||
switch (kind) {
|
||||
case 'spectrum':
|
||||
return audioRouter.flushPendingSpectrumSamples()
|
||||
return scopeSettings.spectrum.showSideLine
|
||||
? audioRouter.flushPendingSpectrumStereoSamples()
|
||||
: audioRouter.flushPendingSpectrumSamples()
|
||||
case 'oscilloscope':
|
||||
return audioRouter.flushPendingOscilloscopeSamples()
|
||||
case 'vectorscope':
|
||||
@@ -35,7 +37,9 @@ function flushScopeAudioBatch(kind: ScopeKind): ScopePopoutAudioBatch {
|
||||
case 'lufsmeter':
|
||||
return audioRouter.flushPendingLUFSMeterSamples()
|
||||
case 'waveform':
|
||||
return audioRouter.flushPendingWaveformSamples()
|
||||
return scopeSettings.waveform.mode === 'stereo'
|
||||
? audioRouter.flushPendingWaveformStereoSamples()
|
||||
: audioRouter.flushPendingWaveformSamples()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,7 +175,7 @@ export default function ScopePopoutBridge(): null {
|
||||
}
|
||||
|
||||
for (const kind of activePopoutKindsRef.current) {
|
||||
const batch = flushScopeAudioBatch(kind)
|
||||
const batch = flushScopeAudioBatch(kind, useSettingsStore.getState().scopeSettings)
|
||||
if (batch.length > 0) {
|
||||
window.electronAPI.sendScopePopoutAudio(kind, batch)
|
||||
}
|
||||
|
||||
@@ -22,7 +22,8 @@ export function scopeSummary(kind: ScopeKind, settings: ScopeSettings[ScopeKind]
|
||||
switch (kind) {
|
||||
case 'spectrum': {
|
||||
const scopeSettings = settings as ScopeSettings['spectrum']
|
||||
return `${scopeSettings.heatmap ? 'Heat' : 'Fill'} · FFT ${scopeSettings.fftSize}`
|
||||
const summary = `${scopeSettings.heatmap ? 'Heat' : 'Fill'} · FFT ${scopeSettings.fftSize}`
|
||||
return scopeSettings.showSideLine ? `${summary} · Side` : summary
|
||||
}
|
||||
case 'oscilloscope': {
|
||||
const scopeSettings = settings as ScopeSettings['oscilloscope']
|
||||
@@ -47,9 +48,14 @@ export function scopeSummary(kind: ScopeKind, settings: ScopeSettings[ScopeKind]
|
||||
return 'Bar Meter'
|
||||
case 'waveform': {
|
||||
const scopeSettings = settings as ScopeSettings['waveform']
|
||||
return scopeSettings.multiband
|
||||
? `${scopeSettings.gainDb > 0 ? '+' : ''}${scopeSettings.gainDb} dB · RGB`
|
||||
: `${scopeSettings.gainDb > 0 ? '+' : ''}${scopeSettings.gainDb} dB`
|
||||
const summary = [`${scopeSettings.gainDb > 0 ? '+' : ''}${scopeSettings.gainDb} dB`]
|
||||
if (scopeSettings.mode === 'stereo') {
|
||||
summary.push('Stereo')
|
||||
}
|
||||
if (scopeSettings.multiband) {
|
||||
summary.push('RGB')
|
||||
}
|
||||
return summary.join(' · ')
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -213,6 +219,11 @@ export default function ScopeSettingsSection({
|
||||
active={current.showGrid}
|
||||
onClick={() => onUpdate('spectrum', { showGrid: !current.showGrid })}
|
||||
/>
|
||||
<ToggleChip
|
||||
label="Side"
|
||||
active={current.showSideLine}
|
||||
onClick={() => onUpdate('spectrum', { showSideLine: !current.showSideLine })}
|
||||
/>
|
||||
</ToggleGroup>
|
||||
|
||||
<RangeControl
|
||||
@@ -443,6 +454,19 @@ export default function ScopeSettingsSection({
|
||||
const current = settings as ScopeSettings['waveform']
|
||||
return (
|
||||
<>
|
||||
<ToggleGroup label="Mode">
|
||||
<ToggleChip
|
||||
label="Mono"
|
||||
active={current.mode === 'mono'}
|
||||
onClick={() => onUpdate('waveform', { mode: 'mono' })}
|
||||
/>
|
||||
<ToggleChip
|
||||
label="Stereo"
|
||||
active={current.mode === 'stereo'}
|
||||
onClick={() => onUpdate('waveform', { mode: 'stereo' })}
|
||||
/>
|
||||
</ToggleGroup>
|
||||
|
||||
<ToggleGroup label="Bands">
|
||||
<ToggleChip
|
||||
label="Multiband"
|
||||
|
||||
Reference in New Issue
Block a user