feat: dont draw geq/peq curves if bypass

This commit is contained in:
2026-09-22 21:05:59 +02:00
parent 4aae47cd27
commit e1d6398d57
2 changed files with 41 additions and 14 deletions
-3
View File
@@ -9,9 +9,6 @@ This template should help get you started developing with Tauri, React and Types
# TODO # TODO
- Move meters polling logic outside dsp state because it causes re-render of everything tied to dsp constantly - Move meters polling logic outside dsp state because it causes re-render of everything tied to dsp constantly
- Check render to improve perfoormances - Check render to improve perfoormances
- Dont draw geq/peq on gain if bypass
- Diplay windows on reset geq, peq
- Preset change dont reset
- Disbale slider on peq when filter dont use it - Disbale slider on peq when filter dont use it
- Check end to end behavioour - Check end to end behavioour
@@ -1,5 +1,5 @@
import VerticalSlider from '../../../../components/VerticalSlider/VerticalSlider'; import VerticalSlider from '../../../../components/VerticalSlider/VerticalSlider';
import { InputChannel, Channel, OutputChannel } from '../../types'; import { InputChannel, Channel, OutputChannel, CrossoverFilter, PEQBand, PEQ } from '../../types';
import { DSP408 as DSP } from '../../../../types'; import { DSP408 as DSP } from '../../../../types';
import Button from '../../../../components/Button/Button'; import Button from '../../../../components/Button/Button';
import ChannelGroup from '../../../../components/ChannelGroup/ChannelGroup'; import ChannelGroup from '../../../../components/ChannelGroup/ChannelGroup';
@@ -58,23 +58,33 @@ function getGainCurvePoints(freqs: number[], gainDb: number): CurvePoint[] {
function getPeqCrossoverPoints( function getPeqCrossoverPoints(
freqs: number[], freqs: number[],
peqChain: { bands: Record<string, unknown> }, peqChain: {
bypass: boolean;
bands: Record<PEQBand, PEQ>;
},
crossover: { crossover: {
high_pass: { frequency: number; slope: unknown }; high_pass: { frequency: number; slope: CrossoverFilter };
low_pass: { frequency: number; slope: unknown }; low_pass: { frequency: number; slope: CrossoverFilter };
} }
) { ) {
return sumCurvePoints([ return sumCurvePoints([
getPeqCurvePoints({ freqs, bands: peqChain.bands as any }), ...(peqChain.bypass
? []
: [
getPeqCurvePoints({
freqs,
bands: peqChain.bands,
}),
]),
getCrossoverCurvePoints({ getCrossoverCurvePoints({
freqs, freqs,
highPass: { highPass: {
frequency: crossover.high_pass.frequency, frequency: crossover.high_pass.frequency,
filter_type: crossover.high_pass.slope as any, filter_type: crossover.high_pass.slope,
}, },
lowPass: { lowPass: {
frequency: crossover.low_pass.frequency, frequency: crossover.low_pass.frequency,
filter_type: crossover.low_pass.slope as any, filter_type: crossover.low_pass.slope,
}, },
}), }),
]); ]);
@@ -86,10 +96,30 @@ function getInputChannelCurves(
liveGain: number | undefined liveGain: number | undefined
): ChannelCurves { ): ChannelCurves {
const gain = liveGain ?? state.gain; const gain = liveGain ?? state.gain;
const geqValues = GEQ_BANDS_LABEL.map(({ frequency }) => state.geq.gains[frequency] ?? 0);
const geq = getGeqCurvePoints({ freqs, values: geqValues, q: GEQ_CURVE_Q }); const geqValues = GEQ_BANDS_LABEL.map(
const peqCrossover = getPeqCrossoverPoints(freqs, state.peq_chain, state.crossover); ({ frequency }) => state.geq.gains[frequency] ?? 0
const total = sumCurvePoints([geq, peqCrossover, getGainCurvePoints(freqs, gain)]); );
const geq = state.geq.bypass
? []
: getGeqCurvePoints({
freqs,
values: geqValues,
q: GEQ_CURVE_Q,
});
const peqCrossover = getPeqCrossoverPoints(
freqs,
state.peq_chain,
state.crossover
);
const total = sumCurvePoints([
geq,
peqCrossover,
getGainCurvePoints(freqs, gain),
]);
return { geq, peqCrossover, total }; return { geq, peqCrossover, total };
} }