feat: dont draw geq/peq curves if bypass
This commit is contained in:
@@ -9,9 +9,6 @@ This template should help get you started developing with Tauri, React and Types
|
||||
# TODO
|
||||
- Move meters polling logic outside dsp state because it causes re-render of everything tied to dsp constantly
|
||||
- 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
|
||||
|
||||
- Check end to end behavioour
|
||||
@@ -1,5 +1,5 @@
|
||||
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 Button from '../../../../components/Button/Button';
|
||||
import ChannelGroup from '../../../../components/ChannelGroup/ChannelGroup';
|
||||
@@ -58,23 +58,33 @@ function getGainCurvePoints(freqs: number[], gainDb: number): CurvePoint[] {
|
||||
|
||||
function getPeqCrossoverPoints(
|
||||
freqs: number[],
|
||||
peqChain: { bands: Record<string, unknown> },
|
||||
peqChain: {
|
||||
bypass: boolean;
|
||||
bands: Record<PEQBand, PEQ>;
|
||||
},
|
||||
crossover: {
|
||||
high_pass: { frequency: number; slope: unknown };
|
||||
low_pass: { frequency: number; slope: unknown };
|
||||
high_pass: { frequency: number; slope: CrossoverFilter };
|
||||
low_pass: { frequency: number; slope: CrossoverFilter };
|
||||
}
|
||||
) {
|
||||
return sumCurvePoints([
|
||||
getPeqCurvePoints({ freqs, bands: peqChain.bands as any }),
|
||||
...(peqChain.bypass
|
||||
? []
|
||||
: [
|
||||
getPeqCurvePoints({
|
||||
freqs,
|
||||
bands: peqChain.bands,
|
||||
}),
|
||||
]),
|
||||
getCrossoverCurvePoints({
|
||||
freqs,
|
||||
highPass: {
|
||||
frequency: crossover.high_pass.frequency,
|
||||
filter_type: crossover.high_pass.slope as any,
|
||||
filter_type: crossover.high_pass.slope,
|
||||
},
|
||||
lowPass: {
|
||||
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
|
||||
): ChannelCurves {
|
||||
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 peqCrossover = getPeqCrossoverPoints(freqs, state.peq_chain, state.crossover);
|
||||
const total = sumCurvePoints([geq, peqCrossover, getGainCurvePoints(freqs, gain)]);
|
||||
|
||||
const geqValues = GEQ_BANDS_LABEL.map(
|
||||
({ frequency }) => state.geq.gains[frequency] ?? 0
|
||||
);
|
||||
|
||||
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 };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user