1use crate::input::Peq;
4
5#[derive(Debug, Clone, PartialEq)]
6pub enum Note {
7 PolarityReversed {
12 role: String,
13 confidence: f64,
14 compared: usize,
15 opposite: usize,
16 },
17 PolaritySplit {
18 groups: (Vec<String>, Vec<String>),
19 confidence: f64,
20 },
21 LiftCapped {
22 from_ms: f64,
23 taps: usize,
24 lift_ms: f64,
25 },
26 SubFilters(Vec<(String, crate::setup::SubFilter)>),
27 LowProtect {
28 role: String,
29 rolloff_hz: f64,
30 hp_hz: Option<f64>,
31 limited: bool,
32 reduced: usize,
33 cuts: usize,
34 },
35 RcLimit {
36 hz: f64,
37 auto: bool,
38 schroeder_hz: Option<f64>,
39 basis: secs_types::calibration::RcHiBasis,
40 factor: u8,
41 band_hz: Option<f64>,
42 band_t60_s: Option<f64>,
43 positions: Option<usize>,
44 },
45 RcBands {
46 bands: Vec<(f64, f64)>,
47 },
48 LfAlign {
53 role: String,
54 strength: f64,
55 arrival_ms: Option<f64>,
56 limited: bool,
57 },
58 ModeDecay {
62 role: String,
63 target_t60_s: f64,
64 modes: Vec<(f64, f64, f64)>,
65 },
66 HfPhase {
71 role: String,
72 rotation_deg: Option<f64>,
73 limited: bool,
74 },
75 InputHp {
78 hz: f64,
79 },
80 Latency {
81 latency_ms: f64,
82 lift_ms: f64,
83 main_extra_ms: f64,
84 },
85 PhaseStrength(Vec<(String, f64)>),
86 PhaseBand(Vec<(String, Option<f64>)>),
87 LongModeBoost {
89 cap_db: f64,
90 modes: Vec<(f64, f64)>,
91 },
92 GdCuts {
93 role: String,
94 cuts: Vec<Peq>,
95 },
96 BaCost(f64),
98 BaBusPass {
99 first: f64,
100 second: f64,
101 kept_first: bool,
102 },
103 BaManual,
104 LayoutFallback(String),
105 Layout(String),
106 TwoWay {
107 roles: Vec<String>,
108 gain_db: f64,
109 xo_hz: f64,
110 },
111 BusGainAnchored(f64),
112 Mimo(MimoNote),
113}
114
115#[derive(Debug, Clone, PartialEq)]
117pub enum MimoNote {
118 InsufficientPositions {
119 measured: usize,
120 },
121 ExcludedSupports(Vec<String>),
122 SupportRanges(Vec<(String, Option<(f64, f64)>)>),
123 GuardReduced {
124 role: String,
125 gain_db: f64,
126 cause: GuardCause,
127 },
128 GuardDisabled {
129 role: String,
130 cause: GuardCause,
131 },
132 SupportLimit {
133 max_supports: usize,
134 },
135 FirBudget {
136 support_count: usize,
137 taps_total: usize,
138 },
139}
140
141#[derive(Debug, Clone, PartialEq)]
145pub struct GuardCause {
146 pub rejected_db: f64,
147 pub band: Option<(f64, f64, f64)>,
150 pub tail: Option<(f64, f64)>,
152}
153
154#[cfg(test)]
155impl MimoNote {
156 pub(crate) fn oracle_text(&self) -> String {
158 match self {
159 Self::InsufficientPositions { measured } => {
160 format!("측정 위치 {measured}곳 — MIMO 는 3곳 이상일 때만")
161 }
162 Self::ExcludedSupports(roles) => format!("서포트 제외(사용자): {}", roles.join(", ")),
163 Self::SupportRanges(ranges) => format!(
164 "서포트 대역 {}",
165 ranges
166 .iter()
167 .map(|(role, range)| match range {
168 Some((lo, hi)) => format!("{role} {lo:.0}–{hi:.0}"),
169 None => format!("{role} 제외"),
170 })
171 .collect::<Vec<_>>()
172 .join(", ")
173 ),
174 Self::GuardReduced { role, gain_db, .. } => {
175 format!("{role}: 대역 늦은 에너지 악화로 서포트 {gain_db:.0} dB")
176 }
177 Self::GuardDisabled { role, .. } => format!("{role}: MIMO 끔(악화)"),
178 Self::SupportLimit { max_supports } => format!("입력당 서포트 ≤ {max_supports}"),
179 Self::FirBudget {
180 support_count,
181 taps_total,
182 } => {
183 let digits = taps_total.to_string();
184 let grouped = digits
185 .chars()
186 .enumerate()
187 .fold(String::new(), |mut out, (i, ch)| {
188 if i > 0 && (digits.len() - i).is_multiple_of(3) {
189 out.push(',');
190 }
191 out.push(ch);
192 out
193 });
194 format!("FIR 서포트 {support_count}개 · 총 {grouped}탭(48 kHz)")
195 }
196 }
197 }
198}