feat: use new meter format
This commit is contained in:
Generated
+18
-17
@@ -397,7 +397,7 @@ dependencies = [
|
||||
"semver",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror 2.0.19",
|
||||
"thiserror 2.0.20",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -798,9 +798,10 @@ version = "0.1.0"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_with",
|
||||
"strum",
|
||||
"strum_macros",
|
||||
"thiserror 2.0.19",
|
||||
"thiserror 2.0.20",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2004,7 +2005,7 @@ dependencies = [
|
||||
"once_cell",
|
||||
"png 0.18.1",
|
||||
"serde",
|
||||
"thiserror 2.0.19",
|
||||
"thiserror 2.0.20",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
@@ -2628,7 +2629,7 @@ checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac"
|
||||
dependencies = [
|
||||
"getrandom 0.2.17",
|
||||
"libredox",
|
||||
"thiserror 2.0.19",
|
||||
"thiserror 2.0.20",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3338,7 +3339,7 @@ dependencies = [
|
||||
"tauri-runtime",
|
||||
"tauri-runtime-wry",
|
||||
"tauri-utils",
|
||||
"thiserror 2.0.19",
|
||||
"thiserror 2.0.20",
|
||||
"tokio",
|
||||
"tray-icon",
|
||||
"url",
|
||||
@@ -3389,7 +3390,7 @@ dependencies = [
|
||||
"sha2",
|
||||
"syn 2.0.119",
|
||||
"tauri-utils",
|
||||
"thiserror 2.0.19",
|
||||
"thiserror 2.0.20",
|
||||
"time",
|
||||
"url",
|
||||
"uuid",
|
||||
@@ -3442,7 +3443,7 @@ dependencies = [
|
||||
"serde_json",
|
||||
"tauri",
|
||||
"tauri-plugin",
|
||||
"thiserror 2.0.19",
|
||||
"thiserror 2.0.20",
|
||||
"url",
|
||||
"windows",
|
||||
"zbus",
|
||||
@@ -3466,7 +3467,7 @@ dependencies = [
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tauri-utils",
|
||||
"thiserror 2.0.19",
|
||||
"thiserror 2.0.20",
|
||||
"url",
|
||||
"webkit2gtk",
|
||||
"webview2-com",
|
||||
@@ -3529,7 +3530,7 @@ dependencies = [
|
||||
"serde_json",
|
||||
"serde_with",
|
||||
"swift-rs",
|
||||
"thiserror 2.0.19",
|
||||
"thiserror 2.0.20",
|
||||
"toml 1.1.3+spec-1.1.0",
|
||||
"url",
|
||||
"urlpattern",
|
||||
@@ -3581,11 +3582,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "2.0.19"
|
||||
version = "2.0.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09a43598840e33d5b0331f38c5e30d13bb11c11210a4b58f0d9b18a5a5eefcd9"
|
||||
checksum = "ec86235f5fcc2a73650310756d2ac5b138a5780bbbdfae3eeccec992c435ba4f"
|
||||
dependencies = [
|
||||
"thiserror-impl 2.0.19",
|
||||
"thiserror-impl 2.0.20",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3601,9 +3602,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "2.0.19"
|
||||
version = "2.0.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "43cbfe0cf76104d42a574802844187e84a305e531ed54455f11fbde0f10541cd"
|
||||
checksum = "bc04cd3e1236dd4a98afca4569f2deb3f120e5422a4023be2cb683f8486292af"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -3918,7 +3919,7 @@ dependencies = [
|
||||
"once_cell",
|
||||
"png 0.18.1",
|
||||
"serde",
|
||||
"thiserror 2.0.19",
|
||||
"thiserror 2.0.20",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
@@ -4278,7 +4279,7 @@ version = "0.38.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "381336cfffd772377d291702245447a5251a2ffa5bad679c99e61bc48bacbf9c"
|
||||
dependencies = [
|
||||
"thiserror 2.0.19",
|
||||
"thiserror 2.0.20",
|
||||
"windows",
|
||||
"windows-core 0.61.2",
|
||||
]
|
||||
@@ -4713,7 +4714,7 @@ dependencies = [
|
||||
"sha2",
|
||||
"soup3",
|
||||
"tao-macros",
|
||||
"thiserror 2.0.19",
|
||||
"thiserror 2.0.20",
|
||||
"url",
|
||||
"webkit2gtk",
|
||||
"webkit2gtk-sys",
|
||||
|
||||
@@ -44,7 +44,8 @@ impl AppState {
|
||||
#[derive(serde::Serialize)]
|
||||
pub struct DSP408Snapshot {
|
||||
pub state: types::DSPState,
|
||||
pub meters: types::Meters,
|
||||
pub input_meters: types::InputMeters,
|
||||
pub output_meters: types::OutputMeters,
|
||||
pub mode: types::DSPMode,
|
||||
}
|
||||
|
||||
@@ -101,7 +102,8 @@ pub async fn get_dsp_snapshot(
|
||||
state.with_device_mut(id, |device| {
|
||||
Ok(DSP408Snapshot {
|
||||
state: device.dsp.state().clone(),
|
||||
meters: device.dsp.meters().clone(),
|
||||
input_meters: device.dsp.input_meters().clone(),
|
||||
output_meters: device.dsp.output_meters().clone(),
|
||||
mode: device.dsp.mode(),
|
||||
})
|
||||
})
|
||||
@@ -202,7 +204,7 @@ pub async fn recall_preset(
|
||||
pub async fn get_meter_levels(
|
||||
state: State<'_, AppState>,
|
||||
id: u64,
|
||||
) -> Result<dsp_thomann::dsp408::types::Meters, String> {
|
||||
) -> Result<(types::InputMeters, types::OutputMeters), String> {
|
||||
state.with_device_mut(id, |device| {
|
||||
device.dsp.get_meter_levels().map_err(|e| e.to_string())
|
||||
})
|
||||
|
||||
@@ -18,15 +18,14 @@
|
||||
width: 100%;
|
||||
|
||||
font-family: var(--font-mono);
|
||||
font-size: 3cqh;
|
||||
font-size: var(--font--sm);
|
||||
font-weight: var(--font-weight-normal);
|
||||
text-align: center;
|
||||
text-align: left;
|
||||
|
||||
color: var(--accent-brand);
|
||||
|
||||
background: transparent;
|
||||
border: none;
|
||||
/* padding: 0.5ch; */
|
||||
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
@@ -47,11 +46,12 @@
|
||||
height: 100%;
|
||||
|
||||
box-sizing: border-box;
|
||||
|
||||
padding-right: 1%;
|
||||
}
|
||||
|
||||
.choice-stepper__arrow-btn {
|
||||
width: 3cqh;
|
||||
height: 3cqh;
|
||||
height: 50%;
|
||||
|
||||
min-width: 0;
|
||||
min-height: 0;
|
||||
@@ -61,13 +61,11 @@
|
||||
justify-content: center;
|
||||
|
||||
padding: 0;
|
||||
padding-top: 0.2cqh;
|
||||
margin: 0;
|
||||
|
||||
color: var(--accent-brand);
|
||||
background: transparent;
|
||||
border: none;
|
||||
border-radius: 0.75cqh;
|
||||
border-radius: var(--radius-md);
|
||||
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
@@ -35,13 +35,14 @@
|
||||
justify-content: center;
|
||||
|
||||
flex: 0 0 auto;
|
||||
gap: var(--space-1);
|
||||
padding: var(--space-1);
|
||||
height: var(--header-height);
|
||||
}
|
||||
|
||||
.sidebar-rail--expanded .sidebar-header {
|
||||
justify-content: space-between;
|
||||
padding-inline: var(--space-3);
|
||||
padding-left: var(--space-3);
|
||||
}
|
||||
|
||||
.sidebar-toggle {
|
||||
|
||||
@@ -8,67 +8,7 @@ import MeterBar from '../../../../components/MeterBar/MeterBar';
|
||||
import { useMemo, useState } from 'react';
|
||||
import ChoiceStepper from '../../../../components/ChoiceStepper/ChoiceStepper';
|
||||
import './CompressorSection.css';
|
||||
|
||||
// Enum order defines stepper order (1:1 -> Limit).
|
||||
const RATIO_ORDER: Ratio[] = [
|
||||
Ratio.Ratio1_1,
|
||||
Ratio.Ratio1_1_1,
|
||||
Ratio.Ratio1_1_3,
|
||||
Ratio.Ratio1_1_5,
|
||||
Ratio.Ratio1_1_7,
|
||||
Ratio.Ratio1_2,
|
||||
Ratio.Ratio1_2_5,
|
||||
Ratio.Ratio1_3,
|
||||
Ratio.Ratio1_3_5,
|
||||
Ratio.Ratio1_4,
|
||||
Ratio.Ratio1_5,
|
||||
Ratio.Ratio1_6,
|
||||
Ratio.Ratio1_8,
|
||||
Ratio.Ratio1_10,
|
||||
Ratio.Ratio1_20,
|
||||
Ratio.Limit,
|
||||
];
|
||||
|
||||
const RATIO_LABEL: Record<Ratio, string> = {
|
||||
[Ratio.Ratio1_1]: '1:1',
|
||||
[Ratio.Ratio1_1_1]: '1.1:1',
|
||||
[Ratio.Ratio1_1_3]: '1.3:1',
|
||||
[Ratio.Ratio1_1_5]: '1.5:1',
|
||||
[Ratio.Ratio1_1_7]: '1.7:1',
|
||||
[Ratio.Ratio1_2]: '2:1',
|
||||
[Ratio.Ratio1_2_5]: '2.5:1',
|
||||
[Ratio.Ratio1_3]: '3:1',
|
||||
[Ratio.Ratio1_3_5]: '3.5:1',
|
||||
[Ratio.Ratio1_4]: '4:1',
|
||||
[Ratio.Ratio1_5]: '5:1',
|
||||
[Ratio.Ratio1_6]: '6:1',
|
||||
[Ratio.Ratio1_8]: '8:1',
|
||||
[Ratio.Ratio1_10]: '10:1',
|
||||
[Ratio.Ratio1_20]: '20:1',
|
||||
[Ratio.Limit]: 'Limit',
|
||||
};
|
||||
|
||||
// Numeric ratio used only for drawing the transfer curve; Limit ~= brickwall.
|
||||
const RATIO_NUMERIC: Record<Ratio, number> = {
|
||||
[Ratio.Ratio1_1]: 1,
|
||||
[Ratio.Ratio1_1_1]: 1.1,
|
||||
[Ratio.Ratio1_1_3]: 1.3,
|
||||
[Ratio.Ratio1_1_5]: 1.5,
|
||||
[Ratio.Ratio1_1_7]: 1.7,
|
||||
[Ratio.Ratio1_2]: 2,
|
||||
[Ratio.Ratio1_2_5]: 2.5,
|
||||
[Ratio.Ratio1_3]: 3,
|
||||
[Ratio.Ratio1_3_5]: 3.5,
|
||||
[Ratio.Ratio1_4]: 4,
|
||||
[Ratio.Ratio1_5]: 5,
|
||||
[Ratio.Ratio1_6]: 6,
|
||||
[Ratio.Ratio1_8]: 8,
|
||||
[Ratio.Ratio1_10]: 10,
|
||||
[Ratio.Ratio1_20]: 20,
|
||||
[Ratio.Limit]: 1000,
|
||||
};
|
||||
|
||||
const KNEE_VALUES = Array.from({ length: 13 }, (_, i) => i); // 0..12 dB, integer steps
|
||||
import { RATIO_ORDER, RATIO_LABEL, RATIO_NUMERIC, KNEE_VALUES } from '../../constants';
|
||||
|
||||
const COMPRESSOR_SLIDER_PARAMS = [
|
||||
{ key: 'threshold', label: 'Threshold', min: -90, max: 20, step: 0.5, unit: ' dB' },
|
||||
@@ -76,19 +16,6 @@ const COMPRESSOR_SLIDER_PARAMS = [
|
||||
{ key: 'release', label: 'Release', min: 10, max: 3000, step: 1, unit: ' ms' },
|
||||
] as const;
|
||||
|
||||
// ASSUMPTION: output meter indices follow the 4 input channels (0-3), i.e.
|
||||
// Out1 -> 4, Out2 -> 5, etc. Adjust to match dsp.meters.channels ordering.
|
||||
const OUTPUT_METER_INDEX: Record<OutputChannel, number> = {
|
||||
[OutputChannel.Out1]: 4,
|
||||
[OutputChannel.Out2]: 5,
|
||||
[OutputChannel.Out3]: 6,
|
||||
[OutputChannel.Out4]: 7,
|
||||
[OutputChannel.Out5]: 8,
|
||||
[OutputChannel.Out6]: 9,
|
||||
[OutputChannel.Out7]: 10,
|
||||
[OutputChannel.Out8]: 11,
|
||||
} as const;
|
||||
|
||||
type CompressorParamKey = 'ratio' | 'attack' | 'release' | 'knee' | 'threshold';
|
||||
|
||||
type CompressorValues = {
|
||||
@@ -349,10 +276,13 @@ function CompressorSection({ dsp, set_compressor }: { dsp: DSP; set_compressor:
|
||||
<div className="compressor-graph__meters">
|
||||
{outputs.map((output) => {
|
||||
const outputState = dsp.state.current_config.output_states[output];
|
||||
const idx = OUTPUT_METER_INDEX[output];
|
||||
|
||||
return (
|
||||
<MeterBar key={output} label={outputState.name} meter={dsp.meters.channels[idx]} />
|
||||
<MeterBar
|
||||
key={output}
|
||||
label={outputState.name}
|
||||
meter={dsp.output_meters.meters[output]}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
|
||||
@@ -15,13 +15,6 @@ const GATE_PARAMS = [
|
||||
{ key: 'release', label: 'Release', min: 10, max: 3000, step: 1, unit: ' ms' },
|
||||
] as const;
|
||||
|
||||
const INPUT_METER_INDEX: Record<InputChannel, number> = {
|
||||
[InputChannel.InA]: 0,
|
||||
[InputChannel.InB]: 1,
|
||||
[InputChannel.InC]: 2,
|
||||
[InputChannel.InD]: 3,
|
||||
} as const;
|
||||
|
||||
type GateParamKey = (typeof GATE_PARAMS)[number]['key'];
|
||||
|
||||
type GateValues = {
|
||||
@@ -185,9 +178,14 @@ function GateSection({ dsp, set_gate }: { dsp: DSP; set_gate: SetGateFn }) {
|
||||
<div className="gate-graph__meters">
|
||||
{inputs.map((input) => {
|
||||
const inputState = dsp.state.current_config.input_states[input];
|
||||
const idx = INPUT_METER_INDEX[input];
|
||||
const meter = dsp.meters.channels[idx];
|
||||
return <MeterBar key={input} label={inputState.name} meter={meter} />;
|
||||
|
||||
return (
|
||||
<MeterBar
|
||||
key={input}
|
||||
label={inputState.name}
|
||||
meter={dsp.input_meters.meters[input]}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
PEQBand,
|
||||
PEQFilter,
|
||||
DelayUnit,
|
||||
Ratio,
|
||||
} from './types';
|
||||
|
||||
export const INPUT_ORDER: InputChannel[] = [
|
||||
@@ -101,6 +102,67 @@ export const GEQ_GAIN_MAX = 12;
|
||||
export const GEQ_GAIN_STEP = 0.1;
|
||||
export const GEQ_CURVE_Q = 8.65 * 0.5;
|
||||
|
||||
// ------ Compressor constants ------
|
||||
|
||||
export const RATIO_ORDER: Ratio[] = [
|
||||
Ratio.Ratio1_1,
|
||||
Ratio.Ratio1_1_1,
|
||||
Ratio.Ratio1_1_3,
|
||||
Ratio.Ratio1_1_5,
|
||||
Ratio.Ratio1_1_7,
|
||||
Ratio.Ratio1_2,
|
||||
Ratio.Ratio1_2_5,
|
||||
Ratio.Ratio1_3,
|
||||
Ratio.Ratio1_3_5,
|
||||
Ratio.Ratio1_4,
|
||||
Ratio.Ratio1_5,
|
||||
Ratio.Ratio1_6,
|
||||
Ratio.Ratio1_8,
|
||||
Ratio.Ratio1_10,
|
||||
Ratio.Ratio1_20,
|
||||
Ratio.Limit,
|
||||
];
|
||||
|
||||
export const RATIO_LABEL: Record<Ratio, string> = {
|
||||
[Ratio.Ratio1_1]: '1:1',
|
||||
[Ratio.Ratio1_1_1]: '1.1:1',
|
||||
[Ratio.Ratio1_1_3]: '1.3:1',
|
||||
[Ratio.Ratio1_1_5]: '1.5:1',
|
||||
[Ratio.Ratio1_1_7]: '1.7:1',
|
||||
[Ratio.Ratio1_2]: '2:1',
|
||||
[Ratio.Ratio1_2_5]: '2.5:1',
|
||||
[Ratio.Ratio1_3]: '3:1',
|
||||
[Ratio.Ratio1_3_5]: '3.5:1',
|
||||
[Ratio.Ratio1_4]: '4:1',
|
||||
[Ratio.Ratio1_5]: '5:1',
|
||||
[Ratio.Ratio1_6]: '6:1',
|
||||
[Ratio.Ratio1_8]: '8:1',
|
||||
[Ratio.Ratio1_10]: '10:1',
|
||||
[Ratio.Ratio1_20]: '20:1',
|
||||
[Ratio.Limit]: 'Limit',
|
||||
};
|
||||
|
||||
export const RATIO_NUMERIC: Record<Ratio, number> = {
|
||||
[Ratio.Ratio1_1]: 1,
|
||||
[Ratio.Ratio1_1_1]: 1.1,
|
||||
[Ratio.Ratio1_1_3]: 1.3,
|
||||
[Ratio.Ratio1_1_5]: 1.5,
|
||||
[Ratio.Ratio1_1_7]: 1.7,
|
||||
[Ratio.Ratio1_2]: 2,
|
||||
[Ratio.Ratio1_2_5]: 2.5,
|
||||
[Ratio.Ratio1_3]: 3,
|
||||
[Ratio.Ratio1_3_5]: 3.5,
|
||||
[Ratio.Ratio1_4]: 4,
|
||||
[Ratio.Ratio1_5]: 5,
|
||||
[Ratio.Ratio1_6]: 6,
|
||||
[Ratio.Ratio1_8]: 8,
|
||||
[Ratio.Ratio1_10]: 10,
|
||||
[Ratio.Ratio1_20]: 20,
|
||||
[Ratio.Limit]: 1000,
|
||||
};
|
||||
|
||||
export const KNEE_VALUES = Array.from({ length: 13 }, (_, i) => i); // 0..12 dB, integer steps
|
||||
|
||||
// ------ Filter constants ------
|
||||
|
||||
export const CROSSOVER_FILTER_LABEL: { value: CrossoverFilter; label: string }[] = [
|
||||
|
||||
@@ -34,14 +34,17 @@ function pollIntervalFor(id: number): number {
|
||||
|
||||
async function poll(dsp: DSP408, setDsps: SetDsps) {
|
||||
try {
|
||||
const meters = await invoke<DSP408['meters']>('get_meter_levels', { id: dsp.id });
|
||||
const [input_meters, output_meters] = await invoke<
|
||||
[DSP408['input_meters'], DSP408['output_meters']]
|
||||
>('get_meter_levels', { id: dsp.id });
|
||||
|
||||
updateDSP(setDsps, dsp.id, (d) =>
|
||||
d.pollingPaused
|
||||
? d
|
||||
: ({
|
||||
...d,
|
||||
meters,
|
||||
input_meters,
|
||||
output_meters,
|
||||
} as DSP408)
|
||||
);
|
||||
} catch {
|
||||
@@ -118,7 +121,8 @@ export async function create(params: {
|
||||
status: 'disconnected',
|
||||
pollingPaused: true,
|
||||
state: snapshot.state,
|
||||
meters: snapshot.meters,
|
||||
input_meters: snapshot.input_meters,
|
||||
output_meters: snapshot.output_meters,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -242,7 +242,8 @@ export type DSPMode = 'demo' | 'disconnected' | 'connected';
|
||||
|
||||
export type DSP408Snapshot = {
|
||||
state: DSPState;
|
||||
meters: Meters;
|
||||
input_meters: DSP408InputMeters;
|
||||
output_meters: DSP408OutputMeters;
|
||||
mode: DSPMode;
|
||||
};
|
||||
|
||||
@@ -252,6 +253,10 @@ export interface Meter {
|
||||
clip: boolean;
|
||||
}
|
||||
|
||||
export interface Meters {
|
||||
channels: Meter[];
|
||||
export interface DSP408InputMeters {
|
||||
meters: Record<InputChannel, Meter>;
|
||||
}
|
||||
|
||||
export interface DSP408OutputMeters {
|
||||
meters: Record<OutputChannel, Meter>;
|
||||
}
|
||||
|
||||
+8
-2
@@ -1,4 +1,9 @@
|
||||
import { DSPState as DSP408State, Meters as DSP408Meters, DSPMode } from './features/dsp408/types';
|
||||
import {
|
||||
DSPState as DSP408State,
|
||||
DSPMode,
|
||||
DSP408OutputMeters,
|
||||
DSP408InputMeters,
|
||||
} from './features/dsp408/types';
|
||||
|
||||
export type DSPStatus = 'connected' | 'connecting' | 'disconnected';
|
||||
|
||||
@@ -41,7 +46,8 @@ interface DSPBase {
|
||||
export type DSP408 = DSPBase & {
|
||||
type: 'DSP408';
|
||||
state: DSP408State;
|
||||
meters: DSP408Meters;
|
||||
input_meters: DSP408InputMeters;
|
||||
output_meters: DSP408OutputMeters;
|
||||
};
|
||||
|
||||
export type DSP204 = DSPBase & {
|
||||
|
||||
+1
-1
@@ -79,7 +79,7 @@
|
||||
|
||||
/* ---------- Card ---------- */
|
||||
--card-width: 500px;
|
||||
--card-control-height: 36px;
|
||||
--card-control-height: 40px;
|
||||
|
||||
/* ---------- Button ---------- */
|
||||
--disabled-opacity: 0.45;
|
||||
|
||||
Reference in New Issue
Block a user