Просмотр исходного кода

Merge branch 'feature/parity135f' into feature/parity135

# Conflicts:
#	resources/i18n/pt-BR.txt
#	src/core/LynxTune.cpp
#	src/core/LynxTune.h
#	src/ui/I18nData.h
#	tests/tests.cpp
Ka1-S 1 месяц назад
Родитель
Сommit
14db5fb4cb

+ 33 - 28
docs/PARITY.md

@@ -25,17 +25,22 @@ Round 128 covers the FabFilter / Slate / Antares roles (below). Round 129 covers
 
 # FabFilter / Slate / Antares roles (round 128)
 
-| LYNX engine | Original (trial here) | Config before | Design before | Config after | Design after |
-|---|---|---|---|---|---|
-| Facet EQ | Pro-Q 4 (v4.1.3) | 6 | 8 | 8 | 8 |
-| Apex Limiter | Pro-L 2 (v2.2.6) | 4 | 7 | 7 | 8 |
-| Crest Compressor | Pro-C 3 (v3.0.2) | 6 | 7 | 8 | 8 |
-| Prism Multiband | Pro-MB (v1.3.3) | 4 | 6 | 5 | 6 |
-| Sentry Gate | Pro-G (v1.4.2) | 6 | 7 | 8 | 8 |
-| Hush De-esser | Pro-DS (v1.3.2) | 4 | 6 | 7 | 8 |
-| Ember Saturator | Saturn 2 (v2.1.3); Decapitator role (not installed) | 3 | 6 | 6 | 7 |
-| Aether | Fresh Air (v1.1.7) | 8 | 8 | 9 | 8 |
-| LYNX Tune | Auto-Tune Pro (v11.6, Auto mode) | 5 | 6 | 7 | 7 |
+| LYNX engine | Original (trial here) | Config before | Design before | Config after | Design after | Config 135 | Design 135 |
+|---|---|---|---|---|---|---|---|
+| Facet EQ | Pro-Q 4 (v4.1.3) | 6 | 8 | 8 | 8 | 9 | 8 |
+| Apex Limiter | Pro-L 2 (v2.2.6) | 4 | 7 | 7 | 8 | 9 | 9 |
+| Crest Compressor | Pro-C 3 (v3.0.2) | 6 | 7 | 8 | 8 | 8 | 8 |
+| Prism Multiband | Pro-MB (v1.3.3) | 4 | 6 | 5 | 6 | 7 | 7 |
+| Sentry Gate | Pro-G (v1.4.2) | 6 | 7 | 8 | 8 | 9 | 8 |
+| Hush De-esser | Pro-DS (v1.3.2) | 4 | 6 | 7 | 8 | 8 | 8 |
+| Ember Saturator | Saturn 2 (v2.1.3); Decapitator role (not installed) | 3 | 6 | 6 | 7 | 6 | 7 |
+| Aether | Fresh Air (v1.1.7) | 8 | 8 | 9 | 8 | 9 | 8 |
+| LYNX Tune | Auto-Tune Pro (v11.6, Auto mode) | 5 | 6 | 7 | 7 | 8 | 7 |
+
+Columns "135" = round 135 (parity135f, `docs/analise/REA_rodada135f.md`): Apex's loudness meter, true / sample peak
+metering, display modes, oversampling and side-chain triggering; oversampling in Sentry and Hush; Prism up to six
+bands (double-click splits a band), band pan, external side chain; Crest's wet / dry pan; Facet's Flat Tilt / All
+Pass shapes and Character; LYNX Tune's Learn (scale from MIDI) and Classic mode.
 
 After = round 128 (per-plugin tables below and `docs/analise/REA_rodada128.md`). The shared header (undo / redo, A/B,
 presets) is round 129's PresetBar, reused here (no second system); the scores include it.
@@ -74,7 +79,7 @@ range.
 | Full-window spectrum + EQ curve, nodes on the curve | ✅ | |
 | Double-click empty space = new band; drag = frequency / gain; wheel = Q | ✅ | |
 | Bands | ⚠️ | 8 bands (original: 24) |
-| Shapes | ⚠️ | Bell, Low/High Shelf, Low/High Cut, Notch, Band Pass, Tilt Shelf (no Flat Tilt, no All Pass) |
+| Shapes | ✅ | Bell, Low/High Shelf, Low/High Cut, Notch, Band Pass, Tilt Shelf; round 135: Flat Tilt (a constant slope over ±5 octaves) and All Pass (phase only), translated from Pro-Q 4 states (were a tilt shelf / dropped) |
 | Slopes | ⚠️ | 6–96 dB/oct; no 0 dB/oct, no Brickwall |
 | Floating band panel: shape, slope, FREQ, GAIN, Q, band ◀ n ▶, close | ✅ | |
 | Band panel: power button (bypass one band) | ✅ | round 128: the band's coloured power button (also in the node tip and the band menu); a band switched off keeps its settings and shows a hollow node |
@@ -87,7 +92,7 @@ range.
 | Right-click a node: shape, slope, dynamic range, solo, reset, remove | ✅ | |
 | Processing: Zero Latency / Natural Phase / Linear Phase | ✅ | |
 | Linear-phase resolution | ❌ | fixed |
-| Character (Clean / Subtle / Warm) | ❌ | |
+| Character (Clean / Subtle / Warm) | ✅ | round 135: in the Processing menu (shown after the mode in the bottom bar); LYNX's own soft-knee curves on the output, unity below about −20 dBFS (the reference's law is not measured) |
 | Gain scale | ✅ | |
 | Output level | ✅ | |
 | Output pan / pan mode, phase invert | ✅ | round 128: PAN in the bottom bar (left / right or mid / side), polarity in OUT's right-click menu |
@@ -119,19 +124,19 @@ K-12/14/20, Loudness), loudness meters (momentary / short term / integrated, tar
 | RELEASE knob | ✅ | |
 | CHANNEL LINKING: TRANSIENTS and RELEASE knobs | ✅ | round 128: two knobs; the release is linked at least as much as the transients |
 | Knob panel folds away («) | ✅ | |
-| ADVANCED panel (»): channel link details, DC offset filter, side-chain triggering | ⚠️ | round 128: » fold-out with DC offset filter, unity gain, audition limiting; no side-chain triggering |
+| ADVANCED panel (»): channel link details, DC offset filter, side-chain triggering | ✅ | round 128: » fold-out with DC offset filter, unity gain, audition limiting; round 135: side-chain triggering |
 | True Peak Limiting (bottom bar) | ✅ | TP button + bar menu |
-| Oversampling (bottom bar) | ❌ | (the 4x true-peak estimator is the only oversampling) |
+| Oversampling (bottom bar) | ⚠️ | round 135: Off / 2x / 4x / 8x in the bottom bar (the limiter runs at the high rate; latency + the oversampler's); the original goes to 32x |
 | Dither + noise shaping (bottom bar) | ✅ | round 128: Off / 16–24 bits, TPDF; None / Basic / Optimized / Weighted error-feedback shaping |
 | Output level read-out (bottom bar "Out: 0.0 dBTP") | ✅ | |
 | Unity Gain (monitor at the same loudness) | ✅ | round 128 (Advanced) |
 | Audition Limiting (hear what is removed) | ✅ | round 128 (Advanced) |
 | Meters: output peak bars with holds + gain-reduction meter | ✅ | |
 | Meter scale menu (−16/−32/−48 dB, K-12/14/20) | ✅ | round 128: next to TP; rescales the display and the meters |
-| Loudness meter (LUFS momentary / short term / integrated, range, true peak) | ❌ | |
-| True-peak / sample-peak metering switch | ❌ | |
-| Display mode (Slow Down / Fast / Slow / Infinite / Off) | ❌ | |
-| External side chain | ❌ | |
+| Loudness meter (LUFS momentary / short term / integrated, range, true peak) | ✅ | round 135: LOUDNESS button on the display → a panel at the right: short-term and momentary bars with the target line (−23 … −9 LUFS), integrated, short term, momentary, range (LU) and peak read-outs, Reset; ITU-R BS.1770-4 / EBU R 128 (K-weighting, 400 ms / 3 s, gated integration, EBU Tech 3342 range), checked on the EBU test cases |
+| True-peak / sample-peak metering switch | ✅ | round 135: in the loudness panel; the output meter and its hold follow it (4x true-peak interpolation) |
+| Display mode (Slow Down / Fast / Slow / Infinite / Off) | ✅ | round 135: menu beside the meter scale — Fast (10 ms a pixel), Slow, Slow down (recent fast, the past compressed), Infinite (0.5 s a pixel, ~11 minutes), Off (meters only) |
+| External side chain | ✅ | round 135: "Side-chain triggering" (Advanced): the slot's side chain triggers the limiting, the ceiling still holds the programme |
 
 ## Crest Compressor ← Pro-C 3
 
@@ -155,7 +160,7 @@ lookahead, meter scale, knee display, input meter.
 | Character Off / Tube / Diode / Bright, pre / post, drive | ✅ | |
 | AUTO GAIN | ✅ | |
 | DRY knob (dry level, parallel compression) | ✅ | round 128: DRY under AUTO GAIN (−∞ … +36 dB, the original's law); MIX moved to the bottom bar (0–100 %, the original goes to 200 %) |
-| Wet / dry pan (mid / side balance) | ❌ | |
+| Wet / dry pan (mid / side balance) | ✅ | round 135: WET PAN / DRY PAN in the side-chain panel (left / right balance of each path) |
 | SIDE CHAIN panel: listen, level, stereo link, detector EQ with nodes | ✅ | 3 EQ bands (original: 6) |
 | Side chain Internal / External | ✅ | |
 | Side chain Host Sync / MIDI triggering | ❌ | |
@@ -179,15 +184,15 @@ lookahead on, expert mode, display range, analyser options.
 | Original feature | LYNX | Note |
 |---|---|---|
 | Spectrum window with band regions and nodes | ✅ | |
-| Click / drag in empty space = create a band anywhere; bands with gaps | ❌ | 4 contiguous bands (switching one on = "adding") |
-| Up to 6 bands | ❌ | 4 |
+| Click / drag in empty space = create a band anywhere; bands with gaps | ⚠️ | round 135: double-click the empty display = a new band there (the band under the mouse splits at that frequency, the new one starts as its copy); right-click → Split / Remove the band; bands stay contiguous — a band switched off is the gap |
+| Up to 6 bands | ✅ | round 135: 1–6 bands (the band count; 4 = the old engine sample for sample); Pro-MB states translate up to six |
 | Node: drag up / down = range, left / right = move band; edges = crossovers | ✅ | |
 | Wheel = threshold | ✅ | |
 | S / M buttons per band | ✅ | |
 | Floating band panel: power, THRESHOLD, RANGE, ATTACK, RELEASE, OUTPUT, mode, RATIO, KNEE | ✅ | |
 | LOOKAHEAD per band | ✅ | round 128: LOOKAHEAD in the band panel (0–20 ms, capped by the global look-ahead, which sets the latency); translated from Pro-MB |
-| EXPERT (»): side-chain filtering, external side chain, stereo link per band | ❌ | |
-| Band output pan (mid / side) | ❌ | |
+| EXPERT (»): side-chain filtering, external side chain, stereo link per band | ⚠️ | round 135: external side chain (bottom bar Int / Ext: the detectors hear the side chain split by the same crossovers); no side-chain filtering or per-band stereo link |
+| Band output pan (mid / side) | ⚠️ | round 135: PAN in the band panel (left / right balance of the band); no mid / side |
 | Crossover slope per band 6–48 dB/oct | ⚠️ | one global slope 12 / 24 / 48 |
 | Processing mode Linear / Dynamic / Minimum phase | ❌ | |
 | Oversampling | ❌ | |
@@ -215,7 +220,7 @@ pan, oversampling Off / 2x / 4x, expert mode, channel mode L/R or M/S, input / o
 | EXPERT: side-chain GAIN + L/R MIX (two channels) | ✅ | round 128: GAIN / MIX per detector channel (L / R, or M / S); translated from Pro-G |
 | EXPERT: WET + PAN, DRY + PAN | ✅ | round 128: WET PAN / DRY PAN next to DRY / OUTPUT; translated |
 | Channel mode Left/Right or Mid/Side (bottom bar) | ✅ | round 128: bottom bar; the detector channels become mid / side; translated |
-| Oversampling (bottom bar) | ❌ | |
+| Oversampling (bottom bar) | ✅ | round 135: Off / 2x / 4x / 8x (the gain is applied at the high rate; latency + the oversampler's); the look-ahead switch stays under its knob |
 | In / Out levels (bottom bar) | ✅ | round 128: In added (−24 … +24 dB); translated |
 | Level meter | ✅ | |
 
@@ -238,7 +243,7 @@ output level and pan.
 | STEREO LINK knob with MID switch | ✅ | round 128 |
 | LOOKAHEAD knob 0–15 ms with power button | ✅ | round 128 (the look-ahead is the latency; the mixer re-plans its delay compensation) |
 | DISPLAY button (hide / show the waveform) | ✅ | round 128: the window shrinks without it |
-| Oversampling (bottom bar) | ❌ | |
+| Oversampling (bottom bar) | ✅ | round 135: Off / 2x / 4x / 8x for Hush's own voicing (the band and its gain at the high rate; the measured classic voicing has none) |
 | In / Out levels (bottom bar) | ✅ | round 128: In ±12 dB, Out ±12 dB (no pan) |
 | Release | — | Pro-DS has no release control; LYNX keeps RELEASE as an extra (bottom bar) |
 | Input meter with threshold arrow, reduction meter | ✅ | |
@@ -306,10 +311,10 @@ edits (Remove / Bypass, Latched / Momentary), Hold, Auto Key.
 | Hold (freeze the read-out) | ✅ | round 128: click the ring (HOLD lights) |
 | Scales | ⚠️ | 16: the modern list (chromatic, major, minor, harmonic / melodic minor, modes, pentatonics, blues, whole tone, diminished) + custom; no historical tunings (Pythagorean, just, 19/24/31/53-tone …) |
 | Auto Key (detect the key) | ✅ | round 128: button under Scale; key + major / minor from what was sung while the editor is open (pitch-class time, Krumhansl–Kessler profiles) |
-| Learn (scale from MIDI) | ❌ | |
+| Learn (scale from MIDI) | ✅ | round 135 (the original's "Learn Scale from MIDI" switch, read from its parameter list): LEARN SCALE (correction section, top right): while on, the notes played on the MIDI channel build the custom scale (switching it on starts a new one) and are not used as targets |
 | Keyboard at the bottom: click a note = remove / bypass, latch | ✅ | round 128: four-octave keyboard with BYPASS / REMOVE modes and LATCH; a key edits its note name in every octave (no single-octave edits) |
 | Per-note Bypass (pass uncorrected) vs Remove | ✅ | round 128 (translated from the state's legacy scale edits) |
-| Classic mode | ❌ | |
+| Classic mode | ✅ | round 135: CLASSIC (correction section, top left): the short-latency path with the same retune. [EXEC] Auto-Tune Pro hosted black-box: "Use Classic Mode DSP" leaves the retune trajectory unchanged (452 Hz at 150 ms: the same pitch at every point to 0.1 Hz) and drops the latency from 2670 to 37 samples; LYNX's classic = its low-latency mode |
 | Formant Correction on / off | ✅ | |
 | Throat Length | ⚠️ | "Formant shift" in semitones instead of a throat length % |
 | Transpose ±12 | ✅ | |

+ 71 - 0
docs/analise/REA_rodada135f.md

@@ -0,0 +1,71 @@
+# REA round 135f — FabFilter / Slate / Antares roles: the PARITY.md gaps users touch
+
+Sub-round of parity135 (branch `feature/parity135f`). English-first, clean-room. No third-party binary was opened
+in this sub-round: the gaps come from docs/PARITY.md (round 128's black-box captures of the official trials and
+their manuals) [MANUAL]; every behaviour below is LYNX's own code, checked by tests/Parity135fTests.inc [EXEC].
+Every new parameter is appended (saved projects keep their meaning) and defaults to the old sound / view.
+
+## 1. Apex Limiter ← Pro-L 2
+- **Loudness meter** (core/Loudness.h, header-only): ITU-R BS.1770-4 K-weighting (coefficients derived for any rate;
+  at 48 kHz equal to the standard's table [EXEC]), momentary 400 ms / short term 3 s every 100 ms, integrated with the
+  −70 LUFS absolute and −10 LU relative gates (0.1 LU histogram: unlimited length, no allocation), loudness range after
+  EBU Tech 3342 (−20 LU gate, 10th–95th percentile), 4x true peak (48-tap windowed sinc). EBU test cases [EXEC]:
+  1 kHz at −23 dBFS = −23.0 LUFS M / S / I at 44.1 / 48 / 96 kHz; −36 / −23 / −36 → I = −23; −20 / −30 → LRA 10 LU.
+- Editor: LOUDNESS button → panel (short-term / momentary bars, target line −23 … −9 LUFS, integrated, short term,
+  momentary, range, peak, Sample / True peak tabs, Reset). The engine publishes the values on meters 1, 4–7.
+- **Peak meter** (sample / true peak) drives the output meter, its hold and the peak read-out.
+- **Display modes**: Fast (10 ms a pixel, the old view), Slow (30 ms), Slow down (the span grows to the left),
+  Infinite (an editor-side history of 0.5 s columns, ~11 minutes), Off.
+- **Oversampling** Off / 2x / 4x / 8x: a second limiter core runs at the high rate between the shared half-band
+  oversampler's up and down paths (the "capture then return" use of mixsuite::Oversampler, as Crest does); its latency
+  is padded to whole base-rate samples, so PDC stays exact (a click comes out after exactly the reported latency
+  [EXEC]). Dither runs at the base rate after the down path; a final clip at the ceiling.
+- **Side-chain triggering**: the required gain comes from the slot's side chain (× the same gain), the safety clip
+  still holds the programme.
+
+## 2. Oversampling in Sentry and Hush (Pro-G / Pro-DS bottom bars)
+The detector stays at the base rate; the gain (and, in Hush, the band it acts on) is upsampled with the audio and
+applied at the high rate (output = input + band × (gain − 1)). Blocks over 1024 samples are split. With 4x the
+result equals the base-rate one delayed by the oversampler's latency to better than −20 dB [EXEC]. Hush's measured
+classic voicing (vmatch123) is left without oversampling. Sentry's bottom bar trades its duplicate look-ahead switch
+(the switch stays under the knob) for the menu.
+
+## 3. Prism Multiband ← Pro-MB
+- 1–6 contiguous bands (a band count; 4 = the old engine sample for sample [EXEC: the existing transparency and
+  dynamics tests pass unchanged]); bands 5–6, crossovers 4–5, their look-aheads, six band pans and the external side
+  chain are appended (param index of band b ≥ 4: 52 + 10 (b − 4) + field).
+- Double-click the empty display: a new band there (the band under the mouse splits at that frequency; the new one
+  copies its settings); band menu: Split / Remove the band. Pro-MB states translate up to six bands.
+- Band PAN (left / right balance of the band's output), external side chain (the detectors hear the side chain split
+  by the same crossovers).
+- Left: free (overlapping) band edges, per-band slopes, linear / minimum phase modes, oversampling, side-chain
+  filtering and per-band stereo link.
+
+## 4. Crest ← Pro-C 3
+Wet pan / dry pan (left / right balance of each path) in the side-chain panel; centred = the old code path exactly.
+Left: Host Sync / MIDI triggering, audition triggering, 6 side-chain EQ bands, 32x.
+
+## 5. Facet EQ ← Pro-Q 4
+- Flat Tilt (eight first-order shelves 1.25 octaves apart: a constant g / 5 dB per octave, 0 dB at the band frequency)
+  and All Pass (bilinear 2nd-order all-pass; the analog prototype for the FIR modes). Stored at shape values 1/16 and
+  3/16, between the old k / 8 values, so saved shapes keep their meaning; Pro-Q 4 states now translate both.
+- Character Clean / Subtle / Warm (Processing menu): own soft-knee output curves, unity below about −20 dBFS.
+- Left: 24 bands (Facet has 89 of the 96 parameter slots of a slot; more bands need a bigger parameter array),
+  0 dB/oct and Brickwall slopes, spectral dynamics, EQ match, linear-phase resolution.
+
+## 6. LYNX Tune ← Auto-Tune Pro
+- LEARN SCALE: while on, the pitch classes held on the MIDI channel (engine meter 3, a 12-bit mask) build the custom
+  scale in the editor (switching it on starts a new one); learning notes are not used as targets.
+- CLASSIC: the short-latency path with the same retune. [EXEC] Auto-Tune Pro 11.6 hosted black-box (its public
+  parameters only: "Use Classic Mode DSP", "Learn Scale from MIDI"): a 452 Hz tone, chromatic, retune 150 ms, rendered
+  with Classic off / on — the output pitch at 10 … 800 ms after the onset is the same to 0.1 Hz (451.2 → 440.3 Hz),
+  the reported latency drops from 2670 to 37 samples. LYNX's Classic therefore keeps the retune and runs the
+  low-latency configuration (1.25 periods instead of 2). Data: D:\lynx-work\parity135\f (modern.wav, classic.wav).
+- Params appended in one block commented "round 135f" (sub-round w appends Waves Tune RT params after it).
+
+## Where I stopped
+- Black-box: Auto-Tune Pro (re-activated by the user) for Classic; no GUI opened. Waves not used.
+- Done: §1–§6 with tests (tests/Parity135fTests.inc), pt-BR strings, PARITY.md rows + "135" score columns.
+- Not done (ranked): Prism free band edges / phase modes / oversampling; Facet 24 bands (needs maxEffectParams > 96)
+  and Brickwall; Crest Host Sync / MIDI triggering; Ember's Saturn rows (6 bands, modulation, M/S) — left alone so
+  sub-round s can edit Ember for Decapitator.

+ 29 - 0
resources/i18n/pt-BR.txt

@@ -3501,6 +3501,35 @@ countries: br
 "Steps (b = count)" = "Degraus (b = quantidade)"
 "Switch: a when c is off, b when on" = "Chave: a com c desligado, b com c ligado"
 "all above" = "todas acima"
+# round 135f: FabFilter-role parity (Apex loudness / display / oversampling, Prism six bands, Facet shapes, LYNX Tune learn)
+"Learn scale" = "Aprender escala"
+"Flat tilt" = "Inclinação plana"
+"All pass" = "Passa-tudo"
+"Subtle" = "Sutil"
+"Slow down" = "Desacelerar"
+"Infinite" = "Infinito"
+"Sample peak" = "Pico de amostra"
+"Loudness meter: momentary, short term and integrated LUFS, loudness range, peak" = "Medidor de loudness: LUFS momentâneo, de curto prazo e integrado, faixa de loudness, pico"
+"Display speed: Fast, Slow, Slow down (the past compressed), Infinite (the whole take), Off (meters only)" = "Velocidade do display: Rápido, Lento, Desacelerar (o passado comprimido), Infinito (o take inteiro), Desligado (só medidores)"
+"Loudness target: the line on the loudness bars" = "Alvo de loudness: a linha nas barras de loudness"
+"Reset the integrated loudness, the range and the peak hold" = "Zera o loudness integrado, a faixa e o pico retido"
+"Advanced: DC offset filter, unity gain, audition limiting, side-chain triggering" = "Avançado: filtro de offset DC, ganho unitário, ouvir a limitação, disparo por side chain"
+"Side-chain triggering" = "Disparo por side chain"
+"The limiter reacts to the slot's side-chain input (mixer: right-click the slot - Side chain)" = "O limitador reage à entrada de side chain do slot (mixer: clique direito no slot - Side chain)"
+"Display off" = "Display desligado"
+"Integrated" = "Integrado"
+"Short term" = "Curto prazo"
+"Momentary" = "Momentâneo"
+"True peak" = "True peak"
+"Drag a node: range (up / down), band (left / right)  -  drag an edge: crossover  -  double-click: new band  -  wheel: threshold" = "Arraste um nó: faixa (cima / baixo), banda (esquerda / direita)  -  arraste uma borda: crossover  -  clique duplo: nova banda  -  roda: threshold"
+"Split the band" = "Dividir a banda"
+"Remove the band" = "Remover a banda"
+"Click a band to open its panel; double-click = a new band here (up to six); right-click = band menu" = "Clique numa banda para abrir o painel; clique duplo = uma nova banda aqui (até seis); clique direito = menu da banda"
+"Band 5" = "Banda 5"
+"Band 6" = "Banda 6"
+"Band 1|Band 2|Band 3|Band 4|Band 5|Band 6" = "Banda 1|Banda 2|Banda 3|Banda 4|Banda 5|Banda 6"
+"Crossover 4" = "Crossover 4"
+"Crossover 5" = "Crossover 5"
 # round 132: issue #4 feature requests (audio editor in View, preview volume, rack piano-roll view, metronome volume, tempo tapper, sample gain)
 "Open the audio editor" = "Abrir o editor de áudio"
 "Tempo tapper (tap the tempo)" = "Tempo tapper (bater o andamento)"

+ 208 - 38
src/core/ApexLimiter.cpp

@@ -5,6 +5,9 @@
 #include <cmath>
 #include <cstdio>
 
+#include "core/Loudness.h"
+#include "core/MixSuite.h"
+
 namespace lynx::apex
 {
 namespace
@@ -75,46 +78,42 @@ private:
     long long index = 0;
 };
 
-class ApexLimiterEffect final : public Effect
+// one limiter at one sample rate (the base rate, or an oversampled rate)
+struct Core
 {
-public:
-    void prepare (double sr) noexcept override
+    // `extra`: a plain delay added to the output (an oversampled core pads its latency to whole base-rate samples)
+    void prepare (double sr, int extra = 0)
     {
         sampleRate = sr;
         maxLook = (int) std::ceil (maxLookaheadMs * 0.001 * sr);
-        latency = maxLook + interpDelay;
-        inL.assign ((std::size_t) maxLook + 2, 0.0f); inR.assign ((std::size_t) maxLook + 2, 0.0f);
-        outL.assign ((std::size_t) maxLook + 2, 0.0f); outR.assign ((std::size_t) maxLook + 2, 0.0f);
+        extraDelay = std::max (0, extra);
+        const auto ring = (std::size_t) (maxLook + extraDelay + 2);
+        inL.assign (ring, 0.0f); inR.assign (ring, 0.0f);
+        outL.assign (ring, 0.0f); outR.assign (ring, 0.0f);
         boxL.assign ((std::size_t) maxLook + 1, 1.0); boxR.assign ((std::size_t) maxLook + 1, 1.0);
         minAll.setCapacity (maxLook + 1); minL.setCapacity (maxLook + 1); minR.setCapacity (maxLook + 1);
         reset();
     }
+    int latency() const noexcept { return maxLook + interpDelay + extraDelay; }
 
-    void reset() noexcept override
+    void reset() noexcept
     {
         std::fill (inL.begin(), inL.end(), 0.0f); std::fill (inR.begin(), inR.end(), 0.0f);
         std::fill (outL.begin(), outL.end(), 0.0f); std::fill (outR.begin(), outR.end(), 0.0f);
-        histL.fill (0.0); histR.fill (0.0);
+        histL.fill (0.0); histR.fill (0.0); scHistL.fill (0.0); scHistR.fill (0.0);
         pos = 0;
         fastL = fastR = slowL = slowR = 1.0;
         dcXL = dcXR = dcYL = dcYR = 0.0;
         err = {};
         rng = 0x9e3779b97f4a7c15ull;
-        look = -1; // rebuilt by the next process()
+        look = -1; // rebuilt by the next run()
     }
 
-    int latencySamples() const noexcept override { return latency; }
-
-    // live meters for the editor (round 114): 0 = gain reduction over 0 … 30 dB (0..1), 2 = input peak, 3 = output peak
-    float controlOutput (int k) const noexcept override
+    // `scl` / `scr`: the external side chain (round 135) — when given, the required gain is computed from it (after
+    // the same gain) instead of the programme; the safety clip still holds the programme at the ceiling.
+    // Returns the lowest gain of the block.
+    double run (float* left, float* right, int n, const EffectParams& p, const float* scl, const float* scr, bool ditherHere) noexcept
     {
-        return k == 0 ? meterGr.load (std::memory_order_relaxed) : k == 2 ? meterIn.load (std::memory_order_relaxed)
-                      : k == 3 ? meterOut.load (std::memory_order_relaxed) : 0.0f;
-    }
-
-    void process (float* left, float* right, int n, const EffectParams& p, double) noexcept override
-    {
-        if (inL.empty()) prepare (sampleRate);
         const double gain = std::pow (10.0, gainDb (p[0]) / 20.0);
         const double ceiling = std::pow (10.0, ceilingDb (p[1]) / 20.0);
         const int newLook = std::clamp ((int) std::lround (lookaheadMs (p[2]) * 0.001 * sampleRate), 1, maxLook);
@@ -137,13 +136,13 @@ public:
         const bool unity = p[pUnity] >= 0.5f, audition = p[pAudition] >= 0.5f, dcFilter = p[pDcFilter] >= 0.5f;
         if (! dcFilter) dcXL = dcXR = dcYL = dcYR = 0.0;
         dcR = std::exp (-2.0 * pi * 5.0 / sampleRate);
-        bits = ditherBits (p[pDither]);
+        bits = ditherHere ? ditherBits (p[pDither]) : 0;
         shaping = noiseShaping (p[pShaping]);
         const auto& ip = interp();
         const int len = (int) inL.size();
-        const int pad = maxLook - look;
+        const int pad = maxLook - look + extraDelay;
+        const bool external = scl != nullptr && scr != nullptr;
         double minGain = 1.0;
-        float inPeak = 0.0f, outPeak = 0.0f;
 
         for (int i = 0; i < n; ++i)
         {
@@ -158,15 +157,22 @@ public:
             std::rotate (histL.begin(), histL.begin() + 1, histL.end()); histL.back() = xl * gain;
             std::rotate (histR.begin(), histR.begin() + 1, histR.end()); histR.back() = xr * gain;
             const double cl = histL[(std::size_t) interpTaps / 2 - 1], cr = histR[(std::size_t) interpTaps / 2 - 1];
-            double pl = std::abs (cl), pr = std::abs (cr);
+            const auto& dl = external ? scHistL : histL;
+            const auto& dr = external ? scHistR : histR;
+            if (external)
+            {
+                std::rotate (scHistL.begin(), scHistL.begin() + 1, scHistL.end()); scHistL.back() = scl[i] * gain;
+                std::rotate (scHistR.begin(), scHistR.begin() + 1, scHistR.end()); scHistR.back() = scr[i] * gain;
+            }
+            double pl = std::abs (dl[(std::size_t) interpTaps / 2 - 1]), pr = std::abs (dr[(std::size_t) interpTaps / 2 - 1]);
             if (truePeak)
                 for (int ph = 0; ph < 3; ++ph)
                 {
                     double sl = 0.0, sr = 0.0;
                     for (int k = 0; k < interpTaps; ++k)
                     {
-                        sl += ip.h[(std::size_t) ph][(std::size_t) k] * histL[(std::size_t) k];
-                        sr += ip.h[(std::size_t) ph][(std::size_t) k] * histR[(std::size_t) k];
+                        sl += ip.h[(std::size_t) ph][(std::size_t) k] * dl[(std::size_t) k];
+                        sr += ip.h[(std::size_t) ph][(std::size_t) k] * dr[(std::size_t) k];
                     }
                     pl = std::max (pl, std::abs (sl)); pr = std::max (pr, std::abs (sr));
                 }
@@ -198,7 +204,6 @@ public:
             }
 
             minGain = std::min (minGain, std::min (gL, gR));
-            inPeak = std::max (inPeak, std::max (std::abs (left[i]), std::abs (right[i])));
             inL[(std::size_t) pos] = (float) cl; inR[(std::size_t) pos] = (float) cr;
             const int back = (pos - look + len) % len;
             double yl = std::clamp (inL[(std::size_t) back] * gL, -ceiling, ceiling); // safety clip
@@ -210,15 +215,11 @@ public:
             outL[(std::size_t) pos] = (float) yl; outR[(std::size_t) pos] = (float) yr;
             const int rd = (pos - pad + len) % len;
             left[i] = outL[(std::size_t) rd]; right[i] = outR[(std::size_t) rd];
-            outPeak = std::max (outPeak, std::max (std::abs (left[i]), std::abs (right[i])));
             pos = (pos + 1) % len;
         }
-        meterGr.store ((float) std::clamp (-20.0 * std::log10 (std::max (minGain, 1e-9)) / 30.0, 0.0, 1.0), std::memory_order_relaxed);
-        meterIn.store (std::min (inPeak, 1.0f), std::memory_order_relaxed);
-        meterOut.store (std::min (outPeak, 1.0f), std::memory_order_relaxed);
+        return minGain;
     }
 
-private:
     // TPDF dither at the chosen word length with error-feedback noise shaping
     double dither (double x, int ch) noexcept
     {
@@ -238,22 +239,178 @@ private:
     }
 
     double sampleRate = 48000.0;
-    int maxLook = 240, look = -1, latency = 244;
+    int maxLook = 240, look = -1, extraDelay = 0;
     int bits = 0, shaping = 0;
     std::array<std::array<double, 3>, 2> err {};
     unsigned long long rng = 0x9e3779b97f4a7c15ull;
     double dcXL = 0.0, dcXR = 0.0, dcYL = 0.0, dcYR = 0.0, dcR = 0.9993;
     std::vector<float> inL, inR, outL, outR;
-    std::array<double, interpTaps> histL {}, histR {};
+    std::array<double, interpTaps> histL {}, histR {}, scHistL {}, scHistR {};
     std::vector<double> boxL, boxR;
     double boxSumL = 1.0, boxSumR = 1.0;
     int boxPos = 0, pos = 0;
     SlidingMin minAll, minL, minR;
     double fastL = 1.0, fastR = 1.0, slowL = 1.0, slowR = 1.0;
-    std::atomic<float> meterGr { 0.0f }, meterIn { 0.0f }, meterOut { 0.0f };
+};
+
+class ApexLimiterEffect final : public Effect
+{
+public:
+    void prepare (double sr) noexcept override
+    {
+        sampleRate = sr;
+        base.prepare (sr);
+        for (int k = 0; k < 3; ++k)
+        {
+            // the high-rate core's latency padded to the base core's latency × factor (whole base-rate samples)
+            const int f = 2 << k;
+                const int overLatency = (int) std::ceil (maxLookaheadMs * 0.001 * sr * f) + interpDelay;
+            over[(std::size_t) k].prepare (sr * f, f * base.latency() - overLatency);
+        }
+        loud.prepare (sr);
+        latency.store (latencyFor (sr, knownFactor), std::memory_order_relaxed);
+        reset();
+    }
+
+    void reset() noexcept override
+    {
+        base.reset();
+        for (auto& c : over) c.reset();
+        for (auto& o : os) o.reset();
+        for (auto& o : osSide) o.reset();
+        for (auto& o : osSc) o.reset();
+        loud.reset();
+    }
+
+    int latencySamples() const noexcept override { return latency.load (std::memory_order_relaxed); }
+
+    void setSidechain (const float* l, const float* r) noexcept override { scL = l; scR = r; }
+    void presetLatency (const EffectParams& p) noexcept
+    {
+        knownFactor = oversamplingFactor (p[pOversampling]);
+        latency.store (latencyFor (sampleRate, knownFactor), std::memory_order_relaxed);
+    }
+
+    // live meters for the editor (round 114): 0 = gain reduction over 0 … 30 dB (0..1), 2 = input peak, 3 = output
+    // peak (true peak when the peak meter is set to it, round 135); round 135's loudness meter (LUFS / LU / dB, as
+    // they are): 1 = momentary, 4 = short term, 5 = integrated, 6 = loudness range, 7 = the highest output peak so far
+    float controlOutput (int k) const noexcept override
+    {
+        return k >= 0 && k < (int) meters.size() ? meters[(std::size_t) k].load (std::memory_order_relaxed) : 0.0f;
+    }
+
+    void process (float* left, float* right, int n, const EffectParams& p, double) noexcept override
+    {
+        if (base.inL.empty()) prepare (sampleRate);
+        const auto factor = oversamplingFactor (p[pOversampling]);
+        if (factor != osFactor)
+        {
+            osFactor = factor;
+            for (auto& c : over) c.reset();
+            for (auto& o : os) { o.setFactor (std::max (2, factor)); o.reset(); }
+            for (auto& o : osSide) { o.setFactor (std::max (2, factor)); o.reset(); }
+            for (auto& o : osSc) { o.setFactor (std::max (2, factor)); o.reset(); }
+        }
+        knownFactor = factor;
+        latency.store (latencyFor (sampleRate, factor), std::memory_order_relaxed);
+        // the loudness meter's reset button flips its value (a "momentary" switch)
+        if (p[pLoudnessReset] != lastReset) { lastReset = p[pLoudnessReset]; loud.reset(); }
+        const bool external = p[pSidechain] >= 0.5f && scL != nullptr && scR != nullptr;
+
+        float inPeak = 0.0f;
+        for (int i = 0; i < n; ++i) inPeak = std::max (inPeak, std::max (std::abs (left[i]), std::abs (right[i])));
+        double minGain = 1.0;
+        if (factor == 1)
+            minGain = base.run (left, right, n, p, external ? scL : nullptr, external ? scR : nullptr, true);
+        else
+        {
+            auto& core = over[(std::size_t) (factor == 2 ? 0 : factor == 4 ? 1 : 2)];
+            for (int start = 0; start < n; start += chunk)
+            {
+                const int m = std::min (chunk, n - start), up = m * factor;
+                // upsample (the audio, and the side chain on the same path so both stay aligned), limit at the high
+                // rate, then the down path returns the limited high-rate samples
+                for (int c = 0; c < 2; ++c)
+                {
+                    std::copy (c == 0 ? left + start : right + start, (c == 0 ? left : right) + start + m, copy.begin());
+                    auto* dst = c == 0 ? upL.data() : upR.data();
+                    int k = 0;
+                    osSide[(std::size_t) c].process (copy.data(), m, [&] (float v) noexcept { dst[std::min (k++, up - 1)] = v; return 0.0f; });
+                    if (external)
+                    {
+                        std::copy (c == 0 ? scL + start : scR + start, (c == 0 ? scL : scR) + start + m, copy.begin());
+                        auto* sdst = c == 0 ? upScL.data() : upScR.data();
+                        int j = 0;
+                        osSc[(std::size_t) c].process (copy.data(), m, [&] (float v) noexcept { sdst[std::min (j++, up - 1)] = v; return 0.0f; });
+                    }
+                }
+                minGain = std::min (minGain, core.run (upL.data(), upR.data(), up, p, external ? upScL.data() : nullptr, external ? upScR.data() : nullptr, false));
+                for (int c = 0; c < 2; ++c)
+                {
+                    const auto* src = c == 0 ? upL.data() : upR.data();
+                    int k = 0;
+                    os[(std::size_t) c].process (c == 0 ? left + start : right + start, m, [&] (float) noexcept { return src[std::min (k++, up - 1)]; });
+                }
+            }
+            // the down path's ripple may pass the ceiling by a hair: the final clip (and the dither at the base rate)
+            const double ceiling = std::pow (10.0, ceilingDb (p[1]) / 20.0);
+            const int bits = ditherBits (p[pDither]);
+            base.bits = bits;
+            base.shaping = noiseShaping (p[pShaping]);
+            const bool audition = p[pAudition] >= 0.5f;
+            for (int i = 0; i < n; ++i)
+            {
+                double yl = left[i], yr = right[i];
+                if (! audition && p[pUnity] < 0.5f) { yl = std::clamp (yl, -ceiling, ceiling); yr = std::clamp (yr, -ceiling, ceiling); }
+                if (bits > 0) { yl = base.dither (yl, 0); yr = base.dither (yr, 1); }
+                left[i] = (float) yl; right[i] = (float) yr;
+            }
+        }
+        scL = scR = nullptr; // a side chain is given again before every block that has one
+
+        loud.process (left, right, n);
+        const bool tpMeter = p[pPeakMeter] >= 0.5f;
+        const auto blockTp = loud.takeBlockTruePeak(), blockSp = loud.takeBlockSamplePeak();
+        const auto outPeak = (float) (tpMeter ? blockTp : blockSp);
+        store (0, (float) std::clamp (-20.0 * std::log10 (std::max (minGain, 1e-9)) / 30.0, 0.0, 1.0));
+        store (2, std::min (inPeak, 1.0f));
+        store (3, std::min (outPeak, 2.0f));
+        store (1, (float) loud.momentary());
+        store (4, (float) loud.shortTermLoudness());
+        store (5, (float) loud.integratedLoudness());
+        store (6, (float) loud.loudnessRange());
+        store (7, (float) (tpMeter ? loud.truePeakDb() : loud.samplePeakDb()));
+    }
+
+private:
+    void store (int k, float v) noexcept { meters[(std::size_t) k].store (v, std::memory_order_relaxed); }
+
+    static constexpr int chunk = 1024, maxFactor = 8;
+    double sampleRate = 48000.0;
+    Core base;
+    std::array<Core, 3> over; // 2x, 4x, 8x
+    std::array<mixsuite::Oversampler, 2> os, osSide, osSc;
+    int osFactor = 1, knownFactor = 1;
+    std::array<float, chunk> copy {};
+    std::array<float, chunk * maxFactor> upL {}, upR {}, upScL {}, upScR {};
+    const float* scL = nullptr;
+    const float* scR = nullptr;
+    loudness::Meter loud;
+    float lastReset = 0.0f;
+    std::atomic<int> latency { latencyAt (48000.0) };
+    std::array<std::atomic<float>, 8> meters {};
 };
 } // namespace
 
+int oversamplingFactor (float v) noexcept { return 1 << std::clamp ((int) std::lround (v * 3.0f), 0, 3); }
+int latencyFor (double sr, int factor) noexcept { return latencyAt (sr) + (factor > 1 ? mixsuite::Oversampler::latency() : 0); }
+int displayMode (float v) noexcept { return std::clamp ((int) std::lround (v * 4.0f), 0, 4); }
+double loudnessTarget (float v) noexcept
+{
+    static constexpr double t[] { -23.0, -18.0, -16.0, -14.0, -11.0, -9.0 };
+    return t[std::clamp ((int) std::lround (v * 5.0f), 0, 5)];
+}
+
 double gainDb (float v) noexcept { return (double) std::clamp (v, 0.0f, 1.0f) * 30.0; }
 double ceilingDb (float v) noexcept { return ((double) std::clamp (v, 0.0f, 1.0f) - 1.0) * 30.0; }
 double lookaheadMs (float v) noexcept { return (double) std::clamp (v, 0.0f, 1.0f) * maxLookaheadMs; }
@@ -281,7 +438,10 @@ const EffectInfo& info()
                                   { "Style", 0.0f }, { "True Peak", 1.0f }, { "Link", 1.0f },
                                   // round 128
                                   { "Attack", 0.0f }, { "Link release", 0.0f }, { "Dither", 0.0f }, { "Noise shaping", 2.0f / 3.0f },
-                                  { "Unity gain", 0.0f }, { "Audition", 0.0f }, { "DC filter", 0.0f }, { "Meter scale", 0.4f } } };
+                                  { "Unity gain", 0.0f }, { "Audition", 0.0f }, { "DC filter", 0.0f }, { "Meter scale", 0.4f },
+                                  // round 135
+                                  { "Oversampling", 0.0f }, { "Peak meter", 1.0f }, { "Display", 0.0f }, { "Loudness reset", 0.0f },
+                                  { "Side chain", 0.0f }, { "Loudness meter", 0.0f }, { "Loudness target", 0.6f } } };
     return i;
 }
 
@@ -295,7 +455,12 @@ std::string paramText (int p, float v)
         case 2: std::snprintf (t, sizeof (t), "%.2f ms", lookaheadMs (v)); break;
         case 3: std::snprintf (t, sizeof (t), releaseMs (v) < 100 ? "%.1f ms" : "%.0f ms", releaseMs (v)); break;
         case 4: return styleName (style (v));
-        case 5: case pUnity: case pAudition: case pDcFilter: return v >= 0.5f ? "On" : "Off";
+        case 5: case pUnity: case pAudition: case pDcFilter: case pSidechain: case pLoudnessShown: return v >= 0.5f ? "On" : "Off";
+        case pOversampling: return oversamplingFactor (v) == 1 ? "Off" : std::to_string (oversamplingFactor (v)) + "x";
+        case pPeakMeter: return v >= 0.5f ? "True peak" : "Sample peak";
+        case pDisplayMode: { static const char* n[] = { "Fast", "Slow", "Slow down", "Infinite", "Off" }; return n[displayMode (v)]; }
+        case pLoudnessReset: return "Reset";
+        case pLoudnessTarget: std::snprintf (t, sizeof (t), "%.0f LUFS", loudnessTarget (v)); break;
         case pAttack:
         {
             const auto ms = attackMs (v);
@@ -316,5 +481,10 @@ std::string paramText (int p, float v)
 
 int latencyAt (double sr) noexcept { return (int) std::ceil (maxLookaheadMs * 0.001 * sr) + interpDelay; }
 
-std::unique_ptr<Effect> make() { return std::make_unique<ApexLimiterEffect>(); }
+std::unique_ptr<Effect> make (const EffectParams* initial)
+{
+    auto fx = std::make_unique<ApexLimiterEffect>();
+    if (initial != nullptr) fx->presetLatency (*initial);
+    return fx;
+}
 } // namespace lynx::apex

+ 15 - 5
src/core/ApexLimiter.h

@@ -18,7 +18,12 @@
 // a value above [6] adds linking; default 0 = as before), [9] dither (off, 16, 18, 20, 22, 24 bits), [10] noise shaping
 // (none, basic, optimized, weighted), [11] unity gain (monitor at the input's level), [12] audition limiting (hear
 // what the limiter removes), [13] DC offset filter, [14] meter scale (editor only: −16 / −32 / −48 dB, K-12 / K-14 /
-// K-20).
+// K-20). Round 135 (appended, editor / meter settings or off by default — the sound of saved projects is unchanged):
+// [15] oversampling (off, 2x, 4x, 8x: the limiter runs at the high rate; latency + the oversampler's), [16] peak
+// meter (sample peak / true peak; the output meter and the peak read-out), [17] display mode (editor: Fast, Slow,
+// Slow down, Infinite, Off), [18] loudness reset (a push button: each flip clears the integrated loudness, range
+// and peak hold), [19] side chain (off / on: the limiter is triggered by the slot's side-chain input), [20] the
+// loudness meter panel shown (editor), [21] loudness target (−23, −18, −16, −14, −11, −9 LUFS; editor).
 
 #include <array>
 #include <memory>
@@ -29,9 +34,10 @@
 
 namespace lynx::apex
 {
-constexpr int paramCount = 15;
+constexpr int paramCount = 22;
 enum Param { pGain, pCeiling, pLookahead, pRelease, pStyle, pTruePeak, pLink, pAttack, pLinkRelease, pDither, pShaping,
-             pUnity, pAudition, pDcFilter, pMeterScale };
+             pUnity, pAudition, pDcFilter, pMeterScale,
+             pOversampling, pPeakMeter, pDisplayMode, pLoudnessReset, pSidechain, pLoudnessShown, pLoudnessTarget };
 constexpr double maxLookaheadMs = 5.0;
 
 // Round 128: 8 styles. The four original styles keep the positions their saved values round to (0, 1/3, 2/3, 1 of
@@ -49,13 +55,17 @@ int ditherBits (float v) noexcept;    // 0 = off, else 16 .. 24
 int noiseShaping (float v) noexcept;  // 0 none, 1 basic, 2 optimized, 3 weighted
 int meterScale (float v) noexcept;    // 0 −16 dB, 1 −32 dB, 2 −48 dB, 3 K-12, 4 K-14, 5 K-20
 Style style (float v) noexcept;
+int oversamplingFactor (float v) noexcept; // 1 (off), 2, 4 or 8
+int displayMode (float v) noexcept;        // 0 Fast, 1 Slow, 2 Slow down, 3 Infinite, 4 Off
+double loudnessTarget (float v) noexcept;  // LUFS
 const char* styleName (Style s) noexcept;
 
 const EffectInfo& info();
 std::string paramText (int param, float v);
 
-// Constant latency at a sample rate (samples).
+// Constant latency at a sample rate (samples), without oversampling; latencyFor: with an oversampling factor.
 int latencyAt (double sampleRate) noexcept;
+int latencyFor (double sampleRate, int factor) noexcept;
 
-std::unique_ptr<Effect> make();
+std::unique_ptr<Effect> make (const EffectParams* initial = nullptr);
 } // namespace lynx::apex

+ 217 - 50
src/core/DynamicsSuite.cpp

@@ -193,6 +193,7 @@ Character characterOf (float v) noexcept { return (Character) pick (v, 4); }
 double driveDb (float v) noexcept { return lin (v, -24.0, 24.0); }
 double scLevelDb (float v) noexcept { return lin (v, -36.0, 36.0); }
 int oversamplingOf (float v) noexcept { return 1 << pick (v, 4); }
+double panOf (float v) noexcept { return std::clamp ((double) v * 2.0 - 1.0, -1.0, 1.0); }
 double trimDb (float v) noexcept { return lin (v, -36.0, 36.0); }
 LinkMode linkModeOf (float v) noexcept { return (LinkMode) pick (v, linkModes); }
 float linkModeValue (LinkMode m) noexcept { return (float) (int) m / (float) (linkModes - 1); }
@@ -740,6 +741,16 @@ private:
             }
         }
 
+        float wetA = 1.0f, wetB = 1.0f, dryA = 1.0f, dryB = 1.0f;
+        {
+            const auto balance = [] (double pan, float& a, float& b) {
+                if (pan > 0.0) a = (float) (1.0 - pan);
+                else if (pan < 0.0) b = (float) (1.0 + pan);
+            };
+            balance (panOf (p[wetPan]), wetA, wetB);
+            balance (panOf (p[dryPan]), dryA, dryB);
+        }
+        const bool panned = wetA != 1.0f || wetB != 1.0f || dryA != 1.0f || dryB != 1.0f;
         for (int i = 0; i < n; ++i)
         {
             float a = wl[(std::size_t) i], b = wr[(std::size_t) i];
@@ -757,7 +768,12 @@ private:
             float da = dl[(std::size_t) i], db = dr[(std::size_t) i];
             dryLa.process (da, db);
             dryDelay.process (da, db);
-            if (dryG > 0.0f) // round 128: the dry level added on top (parallel compression)
+            if (panned) // round 135: the wet and dry paths balanced on their own
+            {
+                l[i] = (a * mx * wetA + da * ((1.0f - mx) + dryG) * dryA) * outGain;
+                r[i] = (b * mx * wetB + db * ((1.0f - mx) + dryG) * dryB) * outGain;
+            }
+            else if (dryG > 0.0f) // round 128: the dry level added on top (parallel compression)
             {
                 l[i] = (da + (a - da) * mx + da * dryG) * outGain;
                 r[i] = (db + (b - db) * mx + db * dryG) * outGain;
@@ -878,14 +894,23 @@ double bandCurve (const EffectParams& p, int b, double x) noexcept
 
 using Split = LrSplit;
 
-std::array<double, 3> crossovers (const EffectParams& p) noexcept
+} // namespace
+
+int bandCount (const EffectParams& p) noexcept { return 1 + pick (p[bandCountParam], bands); }
+float bandCountValue (int n) noexcept { return (float) (std::clamp (n, 1, bands) - 1) / (float) (bands - 1); }
+double panOf (float v) noexcept { return std::clamp ((double) v * 2.0 - 1.0, -1.0, 1.0); }
+
+std::array<double, bands - 1> crossovers (const EffectParams& p) noexcept
 {
-    std::array<double, 3> f { crossoverHz (p[xover1]), crossoverHz (p[xover2]), crossoverHz (p[xover3]) };
-    f[1] = std::max (f[1], f[0] * 1.05);
-    f[2] = std::max (f[2], f[1] * 1.05);
+    std::array<double, bands - 1> f {};
+    for (int k = 0; k < bands - 1; ++k)
+    {
+        f[(std::size_t) k] = crossoverHz (p[(std::size_t) crossoverParam (k)]);
+        if (k > 0)
+            f[(std::size_t) k] = std::max (f[(std::size_t) k], f[(std::size_t) (k - 1)] * 1.05);
+    }
     return f;
 }
-} // namespace
 
 double bandStaticDb (const EffectParams& p, int b, double inputDb)
 {
@@ -898,20 +923,24 @@ double responseDb (const EffectParams& p, const double* bandGainDb, double sampl
 {
     const auto f = crossovers (p);
     const auto slope = slopeDbOct (p[Global::slope]);
-    std::array<Split, 3> s;
-    for (int k = 0; k < 3; ++k)
-        s[(std::size_t) k].design (sampleRate, f[(std::size_t) k], slope);
+    const auto nb = bandCount (p);
     const auto w = 2.0 * pi * hz / sampleRate;
-    // bands of the tree: B0 = L1, B1 = H1·L2, B2 = H1·H2·L3, B3 = H1·H2·H3; out = x + Σ (g − 1)·Bk
-    const auto l1 = s[0].response (false, w), h1 = s[0].response (true, w);
-    const auto l2 = s[1].response (false, w), h2 = s[1].response (true, w);
-    const auto l3 = s[2].response (false, w), h3 = s[2].response (true, w);
-    const std::complex<double> band[4] { l1, h1 * l2, h1 * h2 * l3, h1 * h2 * h3 };
+    // bands of the tree: B0 = L1, B1 = H1·L2, B2 = H1·H2·L3, …, the last = H1·…·H(n−1); out = x + Σ (g − 1)·Bk
+    std::array<std::complex<double>, bands> band {};
+    std::complex<double> rest { 1.0, 0.0 };
+    for (int k = 0; k < nb - 1; ++k)
+    {
+        Split s;
+        s.design (sampleRate, f[(std::size_t) k], slope);
+        band[(std::size_t) k] = rest * s.response (false, w);
+        rest *= s.response (true, w);
+    }
+    band[(std::size_t) (nb - 1)] = rest;
     bool solo = false;
-    for (int b = 0; b < bands; ++b)
+    for (int b = 0; b < nb; ++b)
         solo = solo || on (p[(std::size_t) param (b, fSolo)]);
     std::complex<double> y = solo ? std::complex<double> {} : std::complex<double> { 1.0, 0.0 };
-    for (int b = 0; b < bands; ++b)
+    for (int b = 0; b < nb; ++b)
     {
         const auto g = dbToGain (bandGainDb[b]);
         if (solo)
@@ -949,6 +978,8 @@ public:
     {
         for (auto& s : split)
             s.reset();
+        for (auto& s : scSplit)
+            s.reset();
         delay.reset();
         for (auto& d : bandDelay)
             d.reset();
@@ -960,6 +991,11 @@ public:
 
     int latencySamples() const noexcept override { return latency.load (std::memory_order_relaxed); }
     float controlOutput (int k) const noexcept override { return meters.read (k); }
+    void setSidechain (const float* l, const float* r) noexcept override
+    {
+        scL = l;
+        scR = r;
+    }
 
     void process (float* l, float* r, int n, const EffectParams& p, double) noexcept override
     {
@@ -967,14 +1003,20 @@ public:
         configure (p);
         const auto f = crossovers (p);
         const auto slope = slopeDbOct (p[Global::slope]);
+        const auto nb = bandCount (p);
         if (! designed || f != lastF || slope != lastSlope)
         {
-            for (int k = 0; k < 3; ++k)
+            for (int k = 0; k < bands - 1; ++k)
+            {
                 split[(std::size_t) k].design (sr, f[(std::size_t) k], slope);
+                scSplit[(std::size_t) k].design (sr, f[(std::size_t) k], slope);
+            }
             lastF = f;
             lastSlope = slope;
             designed = true;
         }
+        // round 135: the detectors hear the slot's side chain, split by the same crossovers
+        const bool external = on (p[scExternal]) && scL != nullptr && scR != nullptr;
         const auto inPeak = blockPeak (l, r, n);
         const auto inGain = (float) dbToGain (trimDb (p[input]));
         const auto outGain = (float) dbToGain (trimDb (p[output]));
@@ -982,9 +1024,13 @@ public:
 
         std::array<double, bands> aA {}, aR {}, level {};
         std::array<bool, bands> enabled {}, soloed {};
+        std::array<float, bands> panL {}, panR {};
         bool anySolo = false;
-        for (int b = 0; b < bands; ++b)
+        for (int b = 0; b < nb; ++b)
         {
+            const auto pan = (float) panOf (p[(std::size_t) bandPanParam (b)]);
+            panL[(std::size_t) b] = pan > 0.0f ? 1.0f - pan : 1.0f;
+            panR[(std::size_t) b] = pan < 0.0f ? 1.0f + pan : 1.0f;
             aA[(std::size_t) b] = coef (attackMs (p[(std::size_t) param (b, fAttack)]), sr);
             aR[(std::size_t) b] = coef (releaseMs (p[(std::size_t) param (b, fRelease)]), sr);
             level[(std::size_t) b] = levelDb (p[(std::size_t) param (b, fLevel)]);
@@ -992,7 +1038,7 @@ public:
             soloed[(std::size_t) b] = on (p[(std::size_t) param (b, fSolo)]);
             anySolo = anySolo || soloed[(std::size_t) b];
             // round 128: a band's own look-ahead (≤ the global one): its gain waits for the difference
-            const auto bandLa = std::min (laMs, lookaheadMs (p[(std::size_t) (bandLookahead0 + b)]));
+            const auto bandLa = std::min (laMs, lookaheadMs (p[(std::size_t) bandLookaheadParam (b)]));
             gainDelay[(std::size_t) b].setLength (std::max (0, laSamples - (int) std::lround (bandLa * 0.001 * sr)));
         }
         std::array<double, bands> extreme {};
@@ -1000,24 +1046,45 @@ public:
         for (int i = 0; i < n; ++i)
         {
             const float xl = l[i] * inGain, xr = r[i] * inGain;
-            float bl[bands], br[bands];
-            float lo, hi, lo2, hi2;
-            split[0].run (xl, 0, bl[0], hi);
-            split[1].run (hi, 0, bl[1], hi2);
-            split[2].run (hi2, 0, bl[2], bl[3]);
-            split[0].run (xr, 1, br[0], lo);
-            split[1].run (lo, 1, br[1], lo2);
-            split[2].run (lo2, 1, br[2], br[3]);
+            float bl[bands], br[bands], sl0[bands], sr0[bands];
+            {
+                // the crossover tree: each split takes the high part of the one before
+                float hl = xl, hr = xr;
+                for (int k = 0; k < nb - 1; ++k)
+                {
+                    float nl, nr;
+                    split[(std::size_t) k].run (hl, 0, bl[k], nl);
+                    split[(std::size_t) k].run (hr, 1, br[k], nr);
+                    hl = nl;
+                    hr = nr;
+                }
+                bl[nb - 1] = hl;
+                br[nb - 1] = hr;
+                if (external)
+                {
+                    float el = scL[i] * inGain, er = scR[i] * inGain;
+                    for (int k = 0; k < nb - 1; ++k)
+                    {
+                        float nl, nr;
+                        scSplit[(std::size_t) k].run (el, 0, sl0[k], nl);
+                        scSplit[(std::size_t) k].run (er, 1, sr0[k], nr);
+                        el = nl;
+                        er = nr;
+                    }
+                    sl0[nb - 1] = el;
+                    sr0[nb - 1] = er;
+                }
+            }
 
             float dl = xl, dr = xr;
             delay.process (dl, dr); // the look-ahead: the audio waits, the detectors don't
             float yl = anySolo ? 0.0f : dl, yr = anySolo ? 0.0f : dr;
-            for (int b = 0; b < bands; ++b)
+            for (int b = 0; b < nb; ++b)
             {
                 float g = 1.0f;
                 if (enabled[(std::size_t) b])
                 {
-                    const auto m = std::max (std::abs (bl[b]), std::abs (br[b]));
+                    const auto m = external ? std::max (std::abs (sl0[b]), std::abs (sr0[b])) : std::max (std::abs (bl[b]), std::abs (br[b]));
                     const auto x = std::max (-120.0, 20.0 * std::log10 ((double) m + 1e-12));
                     auto& e = env[(std::size_t) b];
                     e = x > e ? aA[(std::size_t) b] * e + (1.0 - aA[(std::size_t) b]) * x
@@ -1030,27 +1097,29 @@ public:
                 g = gainDelay[(std::size_t) b].process (g);
                 float sl = bl[b], sr2 = br[b];
                 bandDelay[(std::size_t) b].process (sl, sr2);
+                const auto gl = g * panL[(std::size_t) b], gr = g * panR[(std::size_t) b];
                 if (anySolo)
                 {
                     if (soloed[(std::size_t) b])
                     {
-                        yl += g * sl;
-                        yr += g * sr2;
+                        yl += gl * sl;
+                        yr += gr * sr2;
                     }
                 }
-                else if (g != 1.0f)
+                else if (gl != 1.0f || gr != 1.0f)
                 {
-                    yl += (g - 1.0f) * sl;
-                    yr += (g - 1.0f) * sr2;
+                    yl += (gl - 1.0f) * sl;
+                    yr += (gr - 1.0f) * sr2;
                 }
             }
             l[i] = (dl + (yl - dl) * mx) * outGain;
             r[i] = (dr + (yr - dr) * mx) * outGain;
         }
         for (int b = 0; b < bands; ++b)
-            meters.set (b, (float) std::clamp (extreme[(std::size_t) b] / 30.0, -1.0, 1.0));
+            meters.set (bandMeter (b), b < nb ? (float) std::clamp (extreme[(std::size_t) b] / 30.0, -1.0, 1.0) : 0.0f);
         meters.set (4, inPeak);
         meters.set (5, blockPeak (l, r, n));
+        scL = scR = nullptr;
     }
 
 private:
@@ -1077,8 +1146,10 @@ private:
             p[i] = info.params[i].defaultValue;
         return p;
     }();
-    std::array<Split, 3> split;
-    std::array<double, 3> lastF {};
+    std::array<Split, bands - 1> split, scSplit;
+    std::array<double, bands - 1> lastF {};
+    const float* scL = nullptr;
+    const float* scR = nullptr;
     int lastSlope = 0;
     bool designed = false;
     StereoDelay delay;
@@ -1174,6 +1245,7 @@ public:
     {
         sr = rate;
         laOn = -1;
+        osFactor = 0;
         configure (lastParams);
         reset();
     }
@@ -1184,6 +1256,8 @@ public:
         gainDelay.reset();
         hp.reset();
         lp.reset();
+        for (auto& o : os) o.reset();
+        osGain.reset();
         level = 0.0;
         gain = 0.0;
         holdLeft = 0;
@@ -1197,7 +1271,25 @@ public:
         scR = r;
     }
 
-    void process (float* l, float* r, int n, const EffectParams& p, double) noexcept override
+    void process (float* l, float* r, int n, const EffectParams& p, double bpm) noexcept override
+    {
+        if (n > maxBlock) // the oversampled path works on blocks of at most maxBlock samples
+        {
+            const auto* sl = scL;
+            const auto* sr2 = scR;
+            for (int i = 0; i < n; i += maxBlock)
+            {
+                if (sl != nullptr && sr2 != nullptr) { scL = sl + i; scR = sr2 + i; }
+                processBlock (l + i, r + i, std::min (maxBlock, n - i), p, bpm);
+            }
+            scL = scR = nullptr;
+            return;
+        }
+        processBlock (l, r, n, p, bpm);
+    }
+
+private:
+    void processBlock (float* l, float* r, int n, const EffectParams& p, double) noexcept
     {
         lastParams = p;
         configure (p);
@@ -1246,6 +1338,7 @@ public:
         const auto la = laOn > 0 ? lookaheadMs (p[lookahead]) : 0.0;
         gainDelay.setLength (std::max (0, laSamples - (int) std::lround (la * 0.001 * sr)));
         double maxGr = 0.0;
+        const bool over = osFactor > 1;
 
         for (int i = 0; i < n; ++i)
         {
@@ -1301,6 +1394,13 @@ public:
             const auto g = gainDelay.process ((float) gain);
             float a = l[i], b = r[i];
             delay.process (a, b);
+            if (over) // round 135: the gain is upsampled with the audio and applied at the high rate (below)
+            {
+                gains[(std::size_t) i] = g;
+                l[i] = a;
+                r[i] = b;
+                continue;
+            }
             if (panned)
             {
                 l[i] = (a * g * wetA + a * dryGain * dryA) * outGain;
@@ -1312,25 +1412,60 @@ public:
                 r[i] = (b * g + b * dryGain) * outGain;
             }
         }
+        if (over)
+        {
+            const auto m = n * osFactor;
+            if (listen) // the side chain heard through the same path (the latency stays)
+                for (int c = 0; c < 2; ++c)
+                    os[(std::size_t) c].process (c == 0 ? l : r, n, [] (float x) noexcept { return x; });
+            else
+            {
+                int k = 0;
+                osGain.process (gains.data(), n, [&] (float x) noexcept { upGain[(std::size_t) std::min (k++, m - 1)] = x; return 0.0f; });
+                for (int c = 0; c < 2; ++c)
+                {
+                    const auto wet = (c == 0 ? wetA : wetB) * outGain, dryK = (c == 0 ? dryA : dryB) * dryGain * outGain;
+                    int j = 0;
+                    os[(std::size_t) c].process (c == 0 ? l : r, n, [&] (float x) noexcept {
+                        return x * upGain[(std::size_t) std::min (j++, m - 1)] * wet + x * dryK;
+                    });
+                }
+            }
+        }
         meters.set (0, (float) std::clamp (maxGr / 30.0, 0.0, 1.0));
         meters.set (2, inPeak);
         meters.set (3, blockPeak (l, r, n));
         scL = scR = nullptr;
     }
 
-private:
-    // the look-ahead switch sets the latency (10 ms), the knob only how much of it the detector leads
+    // the look-ahead switch sets the latency (10 ms), the knob only how much of it the detector leads; the
+    // oversampler adds its own (round 135)
     void configure (const EffectParams& p) noexcept
     {
         const int want = on (p[lookaheadOn]) ? 1 : 0;
-        if (want == laOn)
+        const int factor = crest::oversamplingOf (p[oversampling]);
+        if (want == laOn && factor == osFactor)
             return;
+        if (factor != osFactor)
+        {
+            osFactor = factor;
+            for (auto& o : os) { o.setFactor (std::max (2, factor)); o.reset(); }
+            osGain.setFactor (std::max (2, factor));
+            osGain.reset();
+        }
         laOn = want;
         laSamples = want ? (int) std::lround (0.010 * sr) : 0;
         delay.setLength (laSamples);
-        latency.store (laSamples, std::memory_order_relaxed);
+        latency.store (laSamples + (osFactor > 1 ? mixsuite::Oversampler::latency() : 0), std::memory_order_relaxed);
     }
 
+    static constexpr int maxBlock = 1024, maxFactor = 8;
+    int osFactor = 0;
+    std::array<mixsuite::Oversampler, 2> os;
+    mixsuite::Oversampler osGain;
+    std::array<float, maxBlock> gains {};
+    std::array<float, maxBlock * maxFactor> upGain {};
+
     double sr = 48000.0;
     int laOn = -1, laSamples = 0;
     std::atomic<int> latency { 0 };
@@ -1368,7 +1503,8 @@ const EffectInfo& crestInfo()
                                      { "SC3 shape", 0.0f }, { "SC3 freq.", 0.80f }, { "SC3 gain", 0.5f }, { "SC3 Q", 0.5f }, { "SC3 slope", 0.125f },
                                      { "Oversampling", 0.0f }, { "Auto gain", 1.0f }, { "Mix", 1.0f }, { "Input", 0.5f }, { "Output", 0.5f },
                                      { "Dry", 0.0f }, { "Auto threshold", 0.0f }, { "Link mode", 0.0f }, { "Meter scale", 0.75f },
-                                     { "Input meter", 1.0f } } };
+                                     { "Input meter", 1.0f },
+                                     { "Wet pan", 0.5f }, { "Dry pan", 0.5f } } }; // round 135
     return info;
 }
 
@@ -1380,11 +1516,13 @@ const EffectInfo& prismInfo()
             { "B1 threshold", "B1 ratio", "B1 range", "B1 expand", "B1 knee", "B1 attack", "B1 release", "B1 level", "B1 on", "B1 solo" },
             { "B2 threshold", "B2 ratio", "B2 range", "B2 expand", "B2 knee", "B2 attack", "B2 release", "B2 level", "B2 on", "B2 solo" },
             { "B3 threshold", "B3 ratio", "B3 range", "B3 expand", "B3 knee", "B3 attack", "B3 release", "B3 level", "B3 on", "B3 solo" },
-            { "B4 threshold", "B4 ratio", "B4 range", "B4 expand", "B4 knee", "B4 attack", "B4 release", "B4 level", "B4 on", "B4 solo" }
+            { "B4 threshold", "B4 ratio", "B4 range", "B4 expand", "B4 knee", "B4 attack", "B4 release", "B4 level", "B4 on", "B4 solo" },
+            { "B5 threshold", "B5 ratio", "B5 range", "B5 expand", "B5 knee", "B5 attack", "B5 release", "B5 level", "B5 on", "B5 solo" },
+            { "B6 threshold", "B6 ratio", "B6 range", "B6 expand", "B6 knee", "B6 attack", "B6 release", "B6 level", "B6 on", "B6 solo" }
         };
         // defaults: −18 dB, 4.5 : 1, range −12 dB (downward), knee 24 dB, attack 20 %, release 20 %, 0 dB, on
         const float defaults[prism::fieldsPerBand] { prism::thresholdValue (-18.0), 0.6f, 0.3f, 0.0f, 0.5f, 0.2f, 0.2f, 0.5f, 1.0f, 0.0f };
-        for (int b = 0; b < prism::bands; ++b)
+        for (int b = 0; b < prism::legacyBands; ++b)
             for (int f = 0; f < prism::fieldsPerBand; ++f)
                 i.params.push_back ({ names[b][f], defaults[f] });
         i.params.push_back ({ "Crossover 1", prism::crossoverValue (120.0) });
@@ -1397,6 +1535,19 @@ const EffectInfo& prismInfo()
         i.params.push_back ({ "Output", 0.5f });
         for (const auto* n : { "B1 lookahead", "B2 lookahead", "B3 lookahead", "B4 lookahead" })
             i.params.push_back ({ n, 1.0f }); // 20 ms: each band leads by the whole global look-ahead (as before)
+        // round 135: bands 5 and 6, crossovers 4 and 5, their look-aheads, the band count (4), each band's output pan,
+        // the external side chain
+        for (int b = prism::legacyBands; b < prism::bands; ++b)
+            for (int f = 0; f < prism::fieldsPerBand; ++f)
+                i.params.push_back ({ names[b][f], defaults[f] });
+        i.params.push_back ({ "Crossover 4", prism::crossoverValue (10000.0) });
+        i.params.push_back ({ "Crossover 5", prism::crossoverValue (14000.0) });
+        i.params.push_back ({ "B5 lookahead", 1.0f });
+        i.params.push_back ({ "B6 lookahead", 1.0f });
+        i.params.push_back ({ "Bands", prism::bandCountValue (4) });
+        for (const auto* n : { "B1 pan", "B2 pan", "B3 pan", "B4 pan", "B5 pan", "B6 pan" })
+            i.params.push_back ({ n, 0.5f });
+        i.params.push_back ({ "External SC", 0.0f });
         return i;
     }();
     return info;
@@ -1412,7 +1563,8 @@ const EffectInfo& sentryInfo()
                                      { "Output", 0.5f },
                                      { "Channel mode", 0.0f }, { "SC gain L", 0.5f }, { "SC mix L", 0.5f }, { "SC gain R", 0.5f },
                                      { "SC mix R", 0.5f }, { "Wet pan", 0.5f }, { "Dry pan", 0.5f }, { "Ducking", 0.0f },
-                                     { "Input", 0.5f } } };
+                                     { "Input", 0.5f },
+                                     { "Oversampling", 0.0f } } }; // round 135
     return info;
 }
 
@@ -1486,15 +1638,21 @@ std::string paramText (EffectKind kind, int param, float v)
             }
             case meterScale: return fmt ("%.0f dB", meterRangeDb (v));
             case inputMeter: return on (v) ? "shown" : "hidden";
+            case wetPan: case dryPan:
+            {
+                const auto x = panOf (v);
+                return std::abs (x) < 0.005 ? std::string ("C") : fmt (x < 0 ? "%.0f%% L" : "%.0f%% R", std::abs (x) * 100.0);
+            }
             default: return on (v) ? "on" : "off";
         }
     }
     if (kind == EffectKind::prismMultiband)
     {
         using namespace prism;
-        if (param < bands * fieldsPerBand)
+        const bool bandField = param < legacyBands * fieldsPerBand || (param >= band5 && param < band5 + 2 * fieldsPerBand);
+        if (bandField)
         {
-            switch (param % fieldsPerBand)
+            switch ((param < band5 ? param : param - band5) % fieldsPerBand)
             {
                 case fThreshold: return fmt ("%.1f dB", thresholdDb (v));
                 case fRatio: return ratioText (ratioOf (v));
@@ -1508,12 +1666,20 @@ std::string paramText (EffectKind kind, int param, float v)
         }
         switch (param)
         {
-            case xover1: case xover2: case xover3: return hzText (crossoverHz (v));
+            case xover1: case xover2: case xover3: case xover4: case xover5: return hzText (crossoverHz (v));
+            case bandCountParam: return std::to_string (1 + pick (v, bands));
+            case scExternal: return on (v) ? "external" : "internal";
             case slope: return std::to_string (slopeDbOct (v)) + " dB/oct";
             case lookahead: return v <= 0.0f ? "off" : msText (lookaheadMs (v));
             case mix: return fmt ("%.0f%%", v * 100.0);
             case input: case output: return db (trimDb (v));
-            default: return msText (lookaheadMs (v)); // the bands' own look-ahead
+            default:
+                if (param >= bandPan0 && param < bandPan0 + bands)
+                {
+                    const auto x = panOf (v);
+                    return std::abs (x) < 0.005 ? std::string ("C") : fmt (x < 0 ? "%.0f%% L" : "%.0f%% R", std::abs (x) * 100.0);
+                }
+                return msText (lookaheadMs (v)); // the bands' own look-ahead
         }
     }
     if (kind == EffectKind::sentryGate)
@@ -1540,6 +1706,7 @@ std::string paramText (EffectKind kind, int param, float v)
             case upRatio: return fmt ("%.2f : 1", upRatioOf (v));
             case dry: return fmt ("%.0f%%", v * 100.0);
             case output: case input: return db (lin (v, -24.0, 24.0));
+            case oversampling: return crest::oversamplingOf (v) == 1 ? "off" : std::to_string (crest::oversamplingOf (v)) + "x";
             case channelMode: return on (v) ? "Mid/Side" : "Left/Right";
             case scGainL: case scGainR: return db (scGainDb (v));
             case scMixL: case scMixR: return fmt ("%+.2f", mixOf (v));

+ 34 - 4
src/core/DynamicsSuite.h

@@ -23,6 +23,7 @@
 // peak; Prism: 0..3 = the bands' gain change in dB / 30 (negative = reduction, positive = boost), 4 = input peak,
 // 5 = output peak.
 
+#include <array>
 #include <memory>
 #include <string>
 
@@ -48,6 +49,8 @@ enum Param
     oversampling, autoGain, mix, input, output,
     // round 128 (Pro-C 3 parity): dry level (parallel compression), auto threshold, stereo-link mode, display settings
     dryGain, autoThreshold, linkMode, meterScale, inputMeter,
+    // round 135 (Pro-C 3 parity): the wet (compressed) and dry paths' stereo balance
+    wetPan, dryPan,
     count
 };
 constexpr int scBands = 3;
@@ -58,6 +61,7 @@ constexpr int linkModes = 5;
 LinkMode linkModeOf (float v) noexcept;
 float linkModeValue (LinkMode m) noexcept;
 double dryDb (float v) noexcept;         // −∞ (v = 0) … +36 dB; 0 dB at 0.5 (72 dB/unit above 0.25, square law below)
+double panOf (float v) noexcept;         // −1 (left) … +1 (right) balance of the wet / dry path
 float dryValue (double db) noexcept;
 double meterRangeDb (float v) noexcept;  // the display's range: 9, 18, 36, 72 or 90 dB
 // Auto threshold (round 128): the threshold follows the programme — the effective threshold is the detector input's
@@ -100,13 +104,36 @@ float characterCurve (Character c, float x) noexcept;
 // ---- Prism Multiband ----
 namespace prism
 {
-constexpr int bands = 4;
+// Round 135 (Pro-MB parity): up to 6 bands (was 4). Bands 1–4 and the first three crossovers keep their parameter
+// indices; bands 5–6, crossovers 4–5, their look-aheads, the band count, the bands' output pan and the external side
+// chain are appended. The band count (default 4) is how many contiguous bands the crossover tree has: 4 is the old
+// engine, sample for sample.
+constexpr int bands = 6;        // the most bands
+constexpr int legacyBands = 4;  // bands of the old parameter block
 constexpr int fieldsPerBand = 10;
 enum Field { fThreshold, fRatio, fRange, fMode, fKnee, fAttack, fRelease, fLevel, fEnabled, fSolo };
-enum Global { xover1 = bands * fieldsPerBand, xover2, xover3, slope, lookahead, mix, input, output,
+enum Global { xover1 = legacyBands * fieldsPerBand, xover2, xover3, slope, lookahead, mix, input, output,
               // round 128 (Pro-MB parity): each band's own look-ahead (≤ the global one, which sets the latency)
-              bandLookahead0, count = bandLookahead0 + bands };
-inline int param (int band, int field) noexcept { return band * fieldsPerBand + field; }
+              bandLookahead0,
+              // round 135: bands 5 and 6 (10 fields each), crossovers 4–5, their look-aheads, the band count, the pan
+              // of each band's output (6), the external side chain
+              band5 = bandLookahead0 + legacyBands, xover4 = band5 + 2 * fieldsPerBand, xover5, bandLookahead4, bandLookahead5,
+              bandCountParam, bandPan0, scExternal = bandPan0 + bands,
+              count };
+inline int param (int band, int field) noexcept
+{
+    return band < legacyBands ? band * fieldsPerBand + field : band5 + (band - legacyBands) * fieldsPerBand + field;
+}
+inline int crossoverParam (int k) noexcept { return k < 3 ? xover1 + k : xover4 + (k - 3); }      // k = 0 … 4
+inline int bandLookaheadParam (int b) noexcept { return b < legacyBands ? bandLookahead0 + b : bandLookahead4 + (b - legacyBands); }
+inline int bandPanParam (int b) noexcept { return bandPan0 + b; }
+// the live meter of band b (Effect::controlOutput): 0 … 3, then 6 and 7 (4 / 5 are the input / output peaks)
+inline int bandMeter (int b) noexcept { return b < legacyBands ? b : 6 + (b - legacyBands); }
+int bandCount (const EffectParams& p) noexcept;   // 1 … 6
+float bandCountValue (int n) noexcept;
+double panOf (float v) noexcept;                   // −1 (left) … +1 (right): the band's output balance
+// the crossovers in use (ascending, n − 1 of them)
+std::array<double, bands - 1> crossovers (const EffectParams& p) noexcept;
 
 double thresholdDb (float v) noexcept;   // −90 .. 0 dBFS (square-root law, finer near 0 dB)
 float thresholdValue (double db) noexcept;
@@ -138,6 +165,9 @@ enum Param
     // round 128 (Pro-G parity): channel mode, the expert side-chain gain / mix per detector channel, wet / dry pan,
     // ducking, input level
     channelMode, scGainL, scMixL, scGainR, scMixR, wetPan, dryPan, ducking, input,
+    // round 135 (Pro-G's bottom bar): oversampling off / 2x / 4x / 8x — the gate's gain is applied at the high rate
+    // (smoother, alias-free fast gating); latency + the oversampler's
+    oversampling,
     count
 };
 double scGainDb (float v) noexcept;      // −36 … +36 dB

+ 2 - 0
src/core/Effects.cpp

@@ -3126,6 +3126,8 @@ std::unique_ptr<Effect> makeEffect (const EffectSlot& slot)
         return facet::make (&slot.params);
     if (dyn::isDynKind (slot.kind)) // their look-ahead / oversampling latency known before the first block
         return dyn::make (slot.kind, &slot.params);
+    if (slot.kind == EffectKind::apexLimiter) // round 135: the oversampling latency known before the first block
+        return apex::make (&slot.params);
     if (slot.kind == EffectKind::hyperChorus)
         return hyperchorusfx::make (hyperchorusfx::instanceOf (slot.state));
     if (slot.kind == EffectKind::vintageChorus)

+ 12 - 9
src/core/FabFilterStates.cpp

@@ -272,8 +272,8 @@ int fromProMB (const State& s, EffectSlot& slot)
     if (count == 0)
         return 0;
     std::sort (used.begin(), used.begin() + count, [] (const Ref& a, const Ref& b) { return a.lo * a.hi < b.lo * b.hi; });
-    // our four contiguous bands: each used reference band in order, with a disabled gap band where the reference
-    // leaves room below / between (gaps are dropped first when there are more than four)
+    // our contiguous bands (up to six, round 135): each used reference band in order, with a disabled gap band where the
+    // reference leaves room below / between (gaps are dropped first when there are more than six)
     struct Seg { int ref; double lo, hi; };
     std::array<Seg, 16> segs {};
     int nseg = 0;
@@ -299,7 +299,7 @@ int fromProMB (const State& s, EffectSlot& slot)
             }
         if (gap < 0)
         {
-            nseg = bands; // more than four reference bands: the four lowest
+            nseg = bands; // more than six reference bands: the six lowest
             break;
         }
         // give the gap to a neighbour
@@ -311,14 +311,16 @@ int fromProMB (const State& s, EffectSlot& slot)
             segs[(std::size_t) k] = segs[(std::size_t) (k + 1)];
         --nseg;
     }
-    // unused bands of ours sit above everything, disabled
+    // unused bands of ours sit above everything, disabled; round 135: up to six bands (four at least, as before)
+    const int nb = std::max (legacyBands, std::min (nseg, bands));
+    set (Global::bandCountParam, bandCountValue (nb));
     double la = 0.0;
-    for (int b = 0; b < bands; ++b)
+    for (int b = 0; b < nb; ++b)
     {
-        if (b < bands - 1)
+        if (b < nb - 1)
         {
             const auto hz = b + 1 < nseg ? segs[(std::size_t) b].hi : 17000.0 + 300.0 * b;
-            set (Global::xover1 + b, crossoverValue (hz));
+            set (crossoverParam (b), crossoverValue (hz));
         }
         if (b >= nseg || segs[(std::size_t) b].ref < 0)
         {
@@ -340,7 +342,7 @@ int fromProMB (const State& s, EffectSlot& slot)
         const auto soloMute = roundIndex (s.at (base + 21));
         set (param (b, fSolo), soloMute == 1 || soloMute == 3 ? 1.0f : 0.0f);
         la = std::max (la, (double) s.at (base + 12));
-        set (Global::bandLookahead0 + b, linValue (s.at (base + 12), 0.0, 20.0)); // round 128: the band's own
+        set (bandLookaheadParam (b), linValue (s.at (base + 12), 0.0, 20.0)); // round 128: the band's own
         if (b == 0)
         {
             // the slope: the steeper of the band's sides, to our nearest
@@ -491,9 +493,10 @@ int fromProQ4 (const State& s, EffectSlot& slot)
         p[(std::size_t) k] = clamp01 (v);
         ++n;
     };
+    // round 135: Facet has the flat tilt and the all pass too (they were a tilt shelf and off)
     static constexpr facet::Shape shapes[10] { facet::Shape::bell, facet::Shape::lowShelf, facet::Shape::lowCut, facet::Shape::highShelf,
                                                facet::Shape::highCut, facet::Shape::notch, facet::Shape::bandPass,
-                                               facet::Shape::tiltShelf, facet::Shape::tiltShelf, facet::Shape::off };
+                                               facet::Shape::tiltShelf, facet::Shape::flatTilt, facet::Shape::allPass };
     static constexpr int slopes[11] { 6, 6, 12, 18, 24, 30, 36, 48, 72, 96, 96 };
     int band = 0;
     for (int b = 0; b < 24 && band < facet::bands; ++b)

+ 78 - 4
src/core/FacetEq.cpp

@@ -31,6 +31,15 @@ Section matched (const Analog& a, double w0, bool& ok) noexcept
 {
     Section s;
     ok = true;
+    if (a.n1 < 0.0 && a.n2 == a.d2 && a.n0 == a.d0 && a.d2 != 0.0)
+    {
+        // all pass (round 135): no magnitude to match — the bilinear all-pass at the band frequency, same Q
+        const double qb = 1.0 / a.d1, alpha = std::sin (std::min (w0, 0.98 * pi)) / (2.0 * qb), c = std::cos (std::min (w0, 0.98 * pi));
+        const double a0 = 1.0 + alpha;
+        s.b0 = (1.0 - alpha) / a0; s.b1 = -2.0 * c / a0; s.b2 = 1.0;
+        s.a1 = -2.0 * c / a0; s.a2 = (1.0 - alpha) / a0;
+        return s;
+    }
     const double nyq = pi / w0; // digital Nyquist on the normalized analog axis
 
     if (a.d2 == 0.0)
@@ -199,6 +208,29 @@ int analogSections (const EffectParams& p, int b, Analog* out, double extraDb =
             out[0] = { 0.0, 1.0 / qb, 0.0, 1.0, 1.0 / qb, 1.0 };
             return 1;
         }
+        case Shape::allPass: // round 135: (s² − s/Qb + 1) / (s² + s/Qb + 1)
+        {
+            const double qb = Q / std::sqrt (2.0);
+            out[0] = { 1.0, -1.0 / qb, 1.0, 1.0, 1.0 / qb, 1.0 };
+            return 1;
+        }
+        case Shape::flatTilt:
+        {
+            // round 135: eight first-order shelves 1.25 octaves apart (±5 octaves around the band frequency), each
+            // a step of g / 4 dB: a constant slope of g / 5 dB per octave, 0 dB at the band frequency
+            if (std::abs (g) < 1e-9 && ! keepFlat) return 0;
+            const double A = std::pow (10.0, (g / 4.0) / 40.0);
+            double at1 = 1.0;
+            for (int k = 0; k < 8; ++k)
+            {
+                const double c = std::pow (2.0, (k - 3.5) * 1.25);
+                out[k] = { 0.0, A / c, 1.0, 0.0, 1.0 / (A * c), 1.0 };
+                at1 *= std::sqrt (mag2 (out[k], 1.0));
+            }
+            out[0].n1 /= at1;
+            out[0].n0 /= at1;
+            return 8;
+        }
     }
     return 0;
 }
@@ -521,6 +553,12 @@ public:
             for (int i = 0; i < n; ++i) { left[i] *= outL; right[i] *= outR; }
         else if (outL != 1.0f)
             for (int i = 0; i < n; ++i) { left[i] *= outL; right[i] *= outL; }
+        if (characterNow > 0) // round 135: the character stage (Clean = untouched)
+            for (int i = 0; i < n; ++i)
+            {
+                left[i] = characterSample (characterNow, left[i]);
+                right[i] = characterSample (characterNow, right[i]);
+            }
         for (int b = 0; b < bands; ++b) meters[(std::size_t) b].store ((float) det[(std::size_t) b].gain, std::memory_order_relaxed);
     }
 
@@ -600,6 +638,7 @@ private:
         outL = level * (float) (pan > 0.0 ? 1.0 - pan : 1.0);
         outR = level * (float) (pan < 0.0 ? 1.0 + pan : 1.0);
         outMidSide = panMidSide (params[(std::size_t) panModeParam]) && outL != outR;
+        characterNow = character (params[(std::size_t) characterParam]);
 
         const int sb = soloBand (params[(std::size_t) soloParam]);
         const bool wasSolo = soloOn;
@@ -811,6 +850,7 @@ private:
     std::array<std::atomic<float>, bands> meters {};
     double attackCoef = 0.1, releaseCoef = 0.001;
     float outGain = 1.0f, outL = 1.0f, outR = 1.0f;
+    int characterNow = 0;
     std::array<Placement, bands> placed {};
     bool anyPlaced = false, anyMidSide = false, outMidSide = false;
     bool anyDynamic = false, soloOn = false, firLoaded = false, firDirty = true, sideGiven = false;
@@ -829,8 +869,36 @@ private:
 } // namespace
 
 
-Shape shape (float v) noexcept { return (Shape) std::clamp ((int) std::lround (v * (shapeCount - 1)), 0, shapeCount - 1); }
-float shapeValue (Shape s) noexcept { return (float) (int) s / (float) (shapeCount - 1); }
+// the nine original shapes sit at k / 8 (saved projects); round 135's at 1/16 (flat tilt) and 3/16 (all pass)
+Shape shape (float v) noexcept
+{
+    const int k = std::clamp ((int) std::lround (v * 16.0f), 0, 16);
+    if (k % 2 == 0) return (Shape) (k / 2);
+    if (k == 1 && std::abs (v - 1.0f / 16.0f) < 0.02f) return Shape::flatTilt;
+    if (k == 3 && std::abs (v - 3.0f / 16.0f) < 0.02f) return Shape::allPass;
+    return (Shape) std::clamp ((int) std::lround (v * 8.0f), 0, 8);
+}
+float shapeValue (Shape s) noexcept
+{
+    if (s == Shape::flatTilt) return 1.0f / 16.0f;
+    if (s == Shape::allPass) return 3.0f / 16.0f;
+    return (float) (int) s / 8.0f;
+}
+const std::array<Shape, shapeCount - 1>& menuShapes() noexcept
+{
+    static const std::array<Shape, shapeCount - 1> m { Shape::bell, Shape::lowShelf, Shape::lowCut, Shape::highShelf, Shape::highCut,
+                                                       Shape::notch, Shape::bandPass, Shape::tiltShelf, Shape::flatTilt, Shape::allPass };
+    return m;
+}
+int character (float v) noexcept { return std::clamp ((int) std::lround (v * 2.0f), 0, 2); }
+float characterSample (int c, float x) noexcept
+{
+    // Subtle: a soft knee that bends hot peaks a little (odd harmonics); Warm: an earlier, rounder knee. Both are unity
+    // at low level (below about −20 dBFS the curve is within 0.1 dB of a straight line).
+    if (c == 1) return x / std::sqrt (1.0f + 0.12f * x * x);
+    if (c == 2) return x / std::sqrt (1.0f + 0.3f * x * x) * (1.0f + 0.02f * std::min (1.0f, x * x));
+    return x;
+}
 double hz (float v) noexcept { return 10.0 * std::pow (3000.0, (double) std::clamp (v, 0.0f, 1.0f)); }
 float hzValue (double f) noexcept { return (float) std::clamp (std::log (f / 10.0) / std::log (3000.0), 0.0, 1.0); }
 double gainDb (float v) noexcept { return ((double) v - 0.5) * 60.0; }
@@ -849,7 +917,8 @@ double gainScale (float v) noexcept { return (double) v * 2.0; }
 
 const char* shapeName (Shape s) noexcept
 {
-    static const char* names[] = { "Off", "Bell", "Low Shelf", "High Shelf", "Low Cut", "High Cut", "Notch", "Band Pass", "Tilt Shelf" };
+    static const char* names[] = { "Off", "Bell", "Low Shelf", "High Shelf", "Low Cut", "High Cut", "Notch", "Band Pass", "Tilt Shelf",
+                                   "Flat Tilt", "All Pass" };
     return names[(int) s];
 }
 
@@ -899,6 +968,7 @@ const EffectInfo& info()
         e.params.push_back ({ "Analyzer Speed", 0.5f });
         e.params.push_back ({ "Analyzer Tilt", 0.75f });
         e.params.push_back ({ "Display Range", displayRangeValue (12.0) });
+        e.params.push_back ({ "Character", 0.0f }); // round 135
         return e;
     }();
     return i;
@@ -933,6 +1003,7 @@ std::string paramText (int p, float v)
     if (p == specSpeedParam) { static const char* a[] = { "Very slow", "Slow", "Medium", "Fast", "Very fast" }; return a[analyzerSpeed (v)]; }
     if (p == specTiltParam) { std::snprintf (t, sizeof (t), "%.1f dB/oct", analyzerTiltDb (v)); return t; }
     if (p == displayRangeParam) { std::snprintf (t, sizeof (t), "%.0f dB", displayRangeDb (v)); return t; }
+    if (p == characterParam) { static const char* a[] = { "Clean", "Subtle", "Warm" }; return a[character (v)]; }
     switch (p % fieldsPerBand)
     {
         case 0: return shapeName (shape (v));
@@ -1010,7 +1081,10 @@ double responseDb (const EffectParams& params, double sampleRate, double f, cons
     return db;
 }
 
-bool hasGain (Shape s) noexcept { return s == Shape::bell || s == Shape::lowShelf || s == Shape::highShelf || s == Shape::tiltShelf; }
+bool hasGain (Shape s) noexcept
+{
+    return s == Shape::bell || s == Shape::lowShelf || s == Shape::highShelf || s == Shape::tiltShelf || s == Shape::flatTilt;
+}
 double rangeDb (float v) noexcept { return ((double) std::clamp (v, 0.0f, 1.0f) - 0.5) * 60.0; }
 float rangeValue (double db) noexcept { return (float) std::clamp (db / 60.0 + 0.5, 0.0, 1.0); }
 double thresholdDb (float v) noexcept { return -80.0 + 80.0 * (double) std::clamp (v, 0.0f, 1.0f); }

+ 14 - 5
src/core/FacetEq.h

@@ -17,7 +17,11 @@
 // settings — stored this way so a zeroed parameter array, e.g. Crest's side-chain EQ, has every band on), [72 + b] stereo placement (stereo, left, right, mid, side), [80] auto gain, [81] output polarity
 // inverted, [82] output pan (0.5 = centre), [83] pan mode (left / right or mid / side), and editor-only display
 // settings: [84] analyser range (60 / 90 / 120 dB), [85] analyser speed, [86] analyser tilt (0 … 6 dB/oct),
-// [87] display range (3 / 6 / 12 / 30 dB).
+// [87] display range (3 / 6 / 12 / 30 dB). Round 135 (Pro-Q 4 parity): two more shapes — Flat Tilt (the whole
+// spectrum tilted at a constant slope: the gain is the level 5 octaves above the band frequency, the opposite 5 below)
+// and All Pass (a 2nd-order phase rotation at the band frequency, width by Q) — stored at shape values between the old
+// ones (1/16 and 3/16), so every saved shape keeps its meaning; [88] character (Clean = the old sound, Subtle, Warm:
+// a gentle analog-style saturation of the output, harmonics only on hot signals).
 //
 // Dynamic EQ (docs/analise/REA_rodada103.md §2, measured on the reference): each band with a gain (bell, shelves,
 // tilt) whose range is not 0 listens to its own region of the detector signal (band pass at the band frequency and
@@ -57,11 +61,12 @@ constexpr int specRangeParam = 84;  // editor only
 constexpr int specSpeedParam = 85;  // editor only
 constexpr int specTiltParam = 86;   // editor only
 constexpr int displayRangeParam = 87; // editor only
-constexpr int paramCount = 88;
+constexpr int characterParam = 88; // round 135
+constexpr int paramCount = 89;
 constexpr int maxSections = 8; // 96 dB/oct = 16th order
 
-enum class Shape { off, bell, lowShelf, highShelf, lowCut, highCut, notch, bandPass, tiltShelf };
-constexpr int shapeCount = 9;
+enum class Shape { off, bell, lowShelf, highShelf, lowCut, highCut, notch, bandPass, tiltShelf, flatTilt, allPass };
+constexpr int shapeCount = 11;
 constexpr std::array<int, 9> slopes { 6, 12, 18, 24, 30, 36, 48, 72, 96 }; // dB/oct
 
 inline int param (int band, int field) noexcept { return band * fieldsPerBand + field; } // 0 shape 1 freq 2 gain 3 Q 4 slope
@@ -79,7 +84,11 @@ float slopeValue (int dbPerOct) noexcept;
 double outputDb (float v) noexcept;    // ±24 dB
 double gainScale (float v) noexcept;   // 0 .. 200 %
 const char* shapeName (Shape s) noexcept;
-bool hasGain (Shape s) noexcept;       // bell, shelves, tilt: the shapes a gain (and dynamics) applies to
+bool hasGain (Shape s) noexcept;       // bell, shelves, tilts: the shapes a gain (and dynamics) applies to
+// the shapes in the order of the editor's menu (the reference's order: bell … tilt shelf, flat tilt, all pass)
+const std::array<Shape, shapeCount - 1>& menuShapes() noexcept;
+int character (float v) noexcept;      // 0 clean, 1 subtle, 2 warm
+float characterSample (int character, float x) noexcept; // the character stage's transfer curve
 
 enum class Phase { zeroLatency, natural, linear };
 constexpr int phaseCount = 3;

+ 264 - 0
src/core/Loudness.h

@@ -0,0 +1,264 @@
+#pragma once
+
+// Loudness and true-peak metering after ITU-R BS.1770-4 / EBU R 128 (round 135, Apex Limiter's loudness meter).
+//
+// - K-weighting: the two-stage pre-filter of BS.1770 (high shelf ≈ +4 dB above 1.5 kHz, then a 38 Hz high pass),
+//   coefficients derived for any sample rate (at 48 kHz they are the standard's table values).
+// - Momentary loudness = mean square over the last 400 ms, short-term = the last 3 s, refreshed every 100 ms;
+//   L = −0.691 + 10 log10 (Σ channel mean squares) (stereo: both channels weight 1).
+// - Integrated loudness: 400 ms blocks with 75 % overlap, gated at −70 LUFS (absolute) and 10 LU below the mean of
+//   the blocks that pass (relative). Blocks are kept in a 0.1 LU histogram (no allocation, unlimited length), so the
+//   relative gate is exact to the bin.
+// - Loudness range (EBU Tech 3342): the short-term values, gated at −70 LUFS and 20 LU below their mean; LRA = the
+//   95th minus the 10th percentile.
+// - True peak: 4× oversampling (48-tap windowed-sinc polyphase interpolator, BS.1770 annex 2), the highest
+//   absolute value (dBTP), and the plain sample peak beside it.
+//
+// No JUCE: tested in tests/Parity135fTests.inc. Not real-time hostile: nothing allocates after construction.
+
+#include <algorithm>
+#include <array>
+#include <cmath>
+
+namespace lynx::loudness
+{
+constexpr double silence = -120.0; // reported while nothing was measured
+
+struct Biquad
+{
+    double b0 = 1, b1 = 0, b2 = 0, a1 = 0, a2 = 0;
+    double z1 = 0, z2 = 0;
+    double run (double x) noexcept
+    {
+        const double y = b0 * x + z1;
+        z1 = b1 * x - a1 * y + z2;
+        z2 = b2 * x - a2 * y;
+        return y;
+    }
+    void clear() noexcept { z1 = z2 = 0; }
+};
+
+// the two K-weighting stages at `sr`
+inline void kWeighting (double sr, Biquad& shelf, Biquad& highPass) noexcept
+{
+    constexpr double pi = 3.14159265358979323846;
+    {
+        const double f0 = 1681.974450955533, g = 3.999843853973347, q = 0.7071752369554196;
+        const double k = std::tan (pi * f0 / sr);
+        const double vh = std::pow (10.0, g / 20.0), vb = std::pow (vh, 0.4996667741545416);
+        const double a0 = 1.0 + k / q + k * k;
+        shelf.b0 = (vh + vb * k / q + k * k) / a0;
+        shelf.b1 = 2.0 * (k * k - vh) / a0;
+        shelf.b2 = (vh - vb * k / q + k * k) / a0;
+        shelf.a1 = 2.0 * (k * k - 1.0) / a0;
+        shelf.a2 = (1.0 - k / q + k * k) / a0;
+    }
+    {
+        const double f0 = 38.13547087602444, q = 0.5003270373238773;
+        const double k = std::tan (pi * f0 / sr);
+        const double a0 = 1.0 + k / q + k * k;
+        highPass.b0 = 1.0; highPass.b1 = -2.0; highPass.b2 = 1.0;
+        highPass.a1 = 2.0 * (k * k - 1.0) / a0;
+        highPass.a2 = (1.0 - k / q + k * k) / a0;
+    }
+}
+
+inline double lufsOf (double meanSquare) noexcept { return meanSquare > 1e-14 ? -0.691 + 10.0 * std::log10 (meanSquare) : silence; }
+
+// gated statistics in 0.1 LU bins from −70 to +10 LUFS
+class Histogram
+{
+public:
+    static constexpr double lo = -70.0, step = 0.1;
+    static constexpr int bins = 800;
+    void clear() noexcept { count.fill (0); energy.fill (0.0); total = 0; }
+    void add (double meanSquare) noexcept
+    {
+        const double l = lufsOf (meanSquare);
+        if (l < lo) return; // absolute gate
+        const int b = std::clamp ((int) ((l - lo) / step), 0, bins - 1);
+        ++count[(std::size_t) b];
+        energy[(std::size_t) b] += meanSquare;
+        ++total;
+    }
+    long long size() const noexcept { return total; }
+    // integrated: the mean of the blocks at or above (mean of all − gate) LU
+    double gatedMean (double relativeGateLu) const noexcept
+    {
+        if (total == 0) return silence;
+        double e = 0.0;
+        long long c = 0;
+        for (int b = 0; b < bins; ++b) { e += energy[(std::size_t) b]; c += count[(std::size_t) b]; }
+        const double gate = lufsOf (e / (double) c) - relativeGateLu;
+        e = 0.0; c = 0;
+        for (int b = firstBin (gate); b < bins; ++b) { e += energy[(std::size_t) b]; c += count[(std::size_t) b]; }
+        return c > 0 ? lufsOf (e / (double) c) : silence;
+    }
+    // LRA: the spread between two percentiles of the blocks above the relative gate
+    double range (double relativeGateLu, double lowPct, double highPct) const noexcept
+    {
+        if (total == 0) return 0.0;
+        double e = 0.0;
+        long long c = 0;
+        for (int b = 0; b < bins; ++b) { e += energy[(std::size_t) b]; c += count[(std::size_t) b]; }
+        const int first = firstBin (lufsOf (e / (double) c) - relativeGateLu);
+        long long n = 0;
+        for (int b = first; b < bins; ++b) n += count[(std::size_t) b];
+        if (n < 2) return 0.0;
+        auto percentile = [&] (double pct) {
+            const auto want = (long long) std::ceil (pct * (double) n);
+            long long seen = 0;
+            for (int b = first; b < bins; ++b)
+            {
+                seen += count[(std::size_t) b];
+                if (seen >= std::max (1LL, want)) return lo + (b + 0.5) * step;
+            }
+            return lo + (bins - 0.5) * step;
+        };
+        return std::max (0.0, percentile (highPct) - percentile (lowPct));
+    }
+
+private:
+    int firstBin (double gate) const noexcept
+    {
+        // a bin is in when its centre is at or above the gate
+        return std::clamp ((int) std::ceil ((gate - lo) / step - 0.5), 0, bins);
+    }
+    std::array<int, bins> count {};
+    std::array<double, bins> energy {};
+    long long total = 0;
+};
+
+// 4× true-peak interpolator for one channel
+class TruePeak
+{
+public:
+    static constexpr int phases = 4, tapsPerPhase = 12;
+    TruePeak()
+    {
+        constexpr double pi = 3.14159265358979323846;
+        constexpr int n = phases * tapsPerPhase;
+        for (int k = 0; k < n; ++k)
+        {
+            const double t = (k - (n - 1) / 2.0) / phases;
+            const double sinc = std::abs (t) < 1e-12 ? 1.0 : std::sin (pi * t) / (pi * t);
+            const double w = 0.5 - 0.5 * std::cos (2.0 * pi * (k + 0.5) / n); // Hann
+            h[(std::size_t) (k % phases)][(std::size_t) (k / phases)] = sinc * w;
+        }
+        for (auto& ph : h) // each phase passes DC at unity
+        {
+            double s = 0.0;
+            for (const auto c : ph) s += c;
+            for (auto& c : ph) c /= s;
+        }
+    }
+    void clear() noexcept { hist.fill (0.0); pos = 0; }
+    // the highest |value| among the 4 interpolated points of this sample period
+    double push (double x) noexcept
+    {
+        hist[(std::size_t) pos] = x;
+        pos = (pos + 1) % tapsPerPhase;
+        double m = 0.0;
+        for (int ph = 0; ph < phases; ++ph)
+        {
+            double s = 0.0;
+            for (int k = 0; k < tapsPerPhase; ++k)
+                s += h[(std::size_t) ph][(std::size_t) k] * hist[(std::size_t) ((pos - 1 - k + tapsPerPhase * 2) % tapsPerPhase)];
+            m = std::max (m, std::abs (s));
+        }
+        return m;
+    }
+
+private:
+    std::array<std::array<double, tapsPerPhase>, phases> h {};
+    std::array<double, tapsPerPhase> hist {};
+    int pos = 0;
+};
+
+// the whole meter (stereo)
+class Meter
+{
+public:
+    void prepare (double sampleRate) noexcept
+    {
+        sr = sampleRate;
+        for (int c = 0; c < 2; ++c) kWeighting (sr, shelf[c], highPass[c]);
+        hop = std::max (1, (int) std::lround (sr * 0.1));
+        reset();
+    }
+    void reset() noexcept
+    {
+        for (int c = 0; c < 2; ++c) { shelf[c].clear(); highPass[c].clear(); tp[c].clear(); }
+        sub.fill (0.0);
+        subCount = 0; subPos = 0; acc = 0.0; accN = 0;
+        integrated.clear(); shortTerm.clear();
+        momentaryLufs = shortTermLufs = silence;
+        truePeakMax = samplePeakMax = 0.0;
+        blockTruePeak = blockSamplePeak = 0.0;
+    }
+
+    void process (const float* l, const float* r, int n) noexcept
+    {
+        for (int i = 0; i < n; ++i)
+        {
+            const double xl = l[i], xr = r[i];
+            const double kl = highPass[0].run (shelf[0].run (xl)), kr = highPass[1].run (shelf[1].run (xr));
+            acc += kl * kl + kr * kr;
+            const double t = std::max (tp[0].push (xl), tp[1].push (xr));
+            blockTruePeak = std::max (blockTruePeak, t);
+            blockSamplePeak = std::max (blockSamplePeak, std::max (std::abs (xl), std::abs (xr)));
+            if (++accN >= hop) endHop();
+        }
+        truePeakMax = std::max (truePeakMax, blockTruePeak);
+        samplePeakMax = std::max (samplePeakMax, blockSamplePeak);
+    }
+
+    double momentary() const noexcept { return momentaryLufs; }
+    double shortTermLoudness() const noexcept { return shortTermLufs; }
+    double integratedLoudness() const noexcept { return integrated.gatedMean (10.0); }
+    double loudnessRange() const noexcept { return shortTerm.range (20.0, 0.10, 0.95); }
+    double truePeakDb() const noexcept { return truePeakMax > 1e-6 ? 20.0 * std::log10 (truePeakMax) : silence; }
+    double samplePeakDb() const noexcept { return samplePeakMax > 1e-6 ? 20.0 * std::log10 (samplePeakMax) : silence; }
+    // the peaks since the last call (for a block meter), then cleared
+    double takeBlockTruePeak() noexcept { const auto v = blockTruePeak; blockTruePeak = 0.0; return v; }
+    double takeBlockSamplePeak() noexcept { const auto v = blockSamplePeak; blockSamplePeak = 0.0; return v; }
+
+private:
+    void endHop() noexcept
+    {
+        sub[(std::size_t) subPos] = acc / (double) accN;
+        subPos = (subPos + 1) % subs;
+        subCount = std::min (subCount + 1, subs);
+        acc = 0.0; accN = 0;
+        auto meanOf = [this] (int k) {
+            double s = 0.0;
+            for (int j = 0; j < k; ++j) s += sub[(std::size_t) ((subPos - 1 - j + subs * 2) % subs)];
+            return s / k;
+        };
+        if (subCount >= 4)
+        {
+            const auto m = meanOf (4);
+            momentaryLufs = lufsOf (m);
+            integrated.add (m);
+        }
+        if (subCount >= 30)
+        {
+            const auto s = meanOf (30);
+            shortTermLufs = lufsOf (s);
+            shortTerm.add (s);
+        }
+    }
+
+    static constexpr int subs = 30; // 100 ms sub-blocks: 3 s
+    double sr = 48000.0;
+    int hop = 4800;
+    Biquad shelf[2], highPass[2];
+    TruePeak tp[2];
+    std::array<double, subs> sub {};
+    int subCount = 0, subPos = 0, accN = 0;
+    double acc = 0.0;
+    Histogram integrated, shortTerm;
+    double momentaryLufs = silence, shortTermLufs = silence;
+    double truePeakMax = 0.0, samplePeakMax = 0.0, blockTruePeak = 0.0, blockSamplePeak = 0.0;
+};
+} // namespace lynx::loudness

+ 16 - 6
src/core/LynxTune.cpp

@@ -121,6 +121,9 @@ const EffectInfo& info()
         e.params.push_back ({ "Onset delay", 1.0f / 3.0f });                    // 500 ms
         e.params.push_back ({ "Onset rate", 1.0f / 3.0f });                     // 500 ms
         e.params.push_back ({ "More scales", 0.0f });
+        // round 135f
+        e.params.push_back ({ "Learn MIDI", 0.0f });
+        e.params.push_back ({ "Classic", 0.0f });
         // round 135w (the real-time corrector's controls)
         e.params.push_back ({ "Speed link", 1.0f });
         e.params.push_back ({ "Speed", speedValue (15.0) });
@@ -161,6 +164,8 @@ std::string paramText (int param, float v)
         case mix: std::snprintf (t, sizeof t, "%.0f%%", 100.0 * v); return t;
         case tracking: std::snprintf (t, sizeof t, "%.0f%%", 100.0 * v); return t;
         case formantPreserve:
+        case learnMidi:
+        case classicMode:
         case lowLatency: return onOff();
         case formantShift: std::snprintf (t, sizeof t, "%+.1f st", formantSemitones (v)); return t;
         case transpose: std::snprintf (t, sizeof t, "%+d st", transposeSemitones (v)); return t;
@@ -224,7 +229,10 @@ public:
     void process (float* l, float* r, int n, const EffectParams& p, double) noexcept override
     {
         const auto rg = rangeIndex (p[range]);
-        const auto low = p[lowLatency] >= 0.5f;
+        // round 135: Classic runs the short-latency path. [EXEC] Auto-Tune Pro hosted black-box: "Use Classic Mode DSP"
+        // keeps the retune trajectory (a 452 Hz tone at 150 ms: the same pitch at every point to 0.1 Hz) and drops the
+        // reported latency from 2670 to 37 samples
+        const auto low = p[lowLatency] >= 0.5f || p[classicMode] >= 0.5f;
         if (rg != curRange || low != curLow)
             configure (rg, low);
 
@@ -261,15 +269,16 @@ public:
 
         // MIDI targets: the pitch classes held on the source channel (none held: the scale)
         const auto ch = midiChannelIndex (p[midiChannel]);
+        std::uint16_t heldMask = 0;
         if (ch >= 0 && held != nullptr && ch < heldCount)
         {
-            std::uint16_t m = 0;
             for (int k = 0; k < 128; ++k)
                 if ((held[ch][(std::size_t) (k >> 6)] >> (k & 63)) & 1u)
-                    m = (std::uint16_t) (m | (1u << (k % 12)));
-            if (m != 0)
-                mask = m;
+                    heldMask = (std::uint16_t) (heldMask | (1u << (k % 12)));
+            if (heldMask != 0 && p[learnMidi] < 0.5f) // learning (round 135): the notes teach the scale instead
+                mask = heldMask;
         }
+        meterHeld.store ((float) heldMask / 4096.0f, std::memory_order_relaxed);
 
         const auto aRef = referenceHz (p[reference]);
         const auto tau = retuneMs (p[retune]) * 0.001;
@@ -474,6 +483,7 @@ public:
             case 2: return std::clamp (0.5f + meterShift.load (std::memory_order_relaxed) / 4.0f, 0.0f, 1.0f);
             case 3: return meterIn.load (std::memory_order_relaxed);  // round 135w: input peak
             case 4: return meterOut.load (std::memory_order_relaxed); // round 135w: output peak
+            case 5: return meterHeld.load (std::memory_order_relaxed); // round 135f: held MIDI pitch classes
             default: return 0.0f;
         }
     }
@@ -509,7 +519,7 @@ private:
     const NoteMask* held = nullptr;
     int heldCount = 0;
     std::atomic<int> latencyNow { 1200 };
-    std::atomic<float> meterSung { -1.0f }, meterTarget { -1.0f }, meterShift { 0.0f };
+    std::atomic<float> meterSung { -1.0f }, meterTarget { -1.0f }, meterShift { 0.0f }, meterHeld { 0.0f };
     std::atomic<float> meterIn { 0.0f }, meterOut { 0.0f };
     double candidateTime = 0.0; // round 135w: Tolerance time
     int candidate = -1;

+ 5 - 0
src/core/LynxTune.h

@@ -54,6 +54,10 @@ enum Param : int
     vibratoDelay,            // onset delay 0…1500 ms after a note starts
     vibratoOnset,            // onset rate (fade-in) 0…1500 ms
     moreScales,              // 0 = the Scale parameter; else whole tone / diminished
+    // round 135f (Auto-Tune Pro parity, appended; off by default)
+    learnMidi,               // on / off: the notes held on the MIDI channel teach the scale (the editor turns them into
+                             // the custom scale's note switches) instead of being the targets
+    classicMode,             // on / off: the classic DSP — the same retune, the short-latency path (as low latency)
     // ---- round 135w: the real-time corrector's controls (the Waves Tune Real-Time role, docs/PARITY.md), appended;
     // every default is the old behaviour
     speedLink,               // on (default) = the in-note deviations follow the retune time, as before; off = Speed
@@ -93,6 +97,7 @@ double vibratoAmountOf (float v) noexcept;  // 0 … 2
 // The scale in effect: the Scale parameter, or one of the extra scales chosen by More scales (round 128)
 int effectiveScale (float scaleValue, float moreScalesValue) noexcept;
 
+// controlOutput (5): the pitch classes held on the MIDI channel, a 12-bit mask / 4096 (round 135, LEARN)
 // Latency (samples) for a sample rate and the range / low-latency parameters
 int latencyFor (double sampleRate, int range, bool lowLatency) noexcept;
 

+ 90 - 4
src/core/MixSuite.cpp

@@ -744,13 +744,34 @@ public:
         gr = 0.0;
         envCh[0] = envCh[1] = grCh[0] = grCh[1] = 0.0;
         fullEnv = 0.0;
+        for (auto& o : os) o.reset();
+        for (auto& o : osBand) o.reset();
+        for (auto& o : osGain) o.reset();
     }
 
-    int latencySamples() const noexcept override { return delay.len; }
+    int latencySamples() const noexcept override { return delay.len + (osFactor > 1 ? Oversampler::latency() : 0); }
     float controlOutput (int k) const noexcept override { return meters.read (k); }
     void setSidechain (const float* l, const float* r) noexcept override { scL = l; scR = r; }
 
-    void process (float* l, float* r, int n, const EffectParams& p, double) noexcept override
+    void process (float* l, float* r, int n, const EffectParams& p, double bpm) noexcept override
+    {
+        if (n > maxBlock) // the oversampled path works on blocks of at most maxBlock samples
+        {
+            const auto* sl = scL;
+            const auto* sr2 = scR;
+            for (int i = 0; i < n; i += maxBlock)
+            {
+                if (sl != nullptr && sr2 != nullptr) { scL = sl + i; scR = sr2 + i; }
+                processBlock (l + i, r + i, std::min (maxBlock, n - i), p, bpm);
+            }
+            scL = scR = nullptr;
+            return;
+        }
+        processBlock (l, r, n, p, bpm);
+    }
+
+private:
+    void processBlock (float* l, float* r, int n, const EffectParams& p, double) noexcept
     {
         // round 128: the look-ahead time is the delay (and the reported latency; the engine re-plans the delay
         // compensation when it moves). The default 2 ms is the old fixed value.
@@ -763,6 +784,15 @@ public:
             for (int i = 0; i < n; ++i) { l[i] *= gIn; r[i] *= gIn; }
         }
         const auto inPeak = Meters::peak (l, r, n);
+        // round 135: oversampling (Hush's own voicing): the gain and the band it acts on are upsampled with the audio
+        const auto factor = classic (p) ? 1 : oversamplingOf (p[oversampling]);
+        if (factor != osFactor)
+        {
+            osFactor = factor;
+            for (auto* bank : { &os, &osBand, &osGain })
+                for (auto& o : *bank) { o.setFactor (std::max (2, factor)); o.reset(); }
+        }
+        const bool over = osFactor > 1;
         if (classic (p))
         {
             // the measured classic de-esser has no look-ahead; the fixed latency Hush reports is kept as a plain delay
@@ -890,6 +920,31 @@ public:
                 b = listenF.process (db, 1);
                 if (lpOn) { a = listenLp.process (a, 0); b = listenLp.process (b, 1); }
             }
+            else if (over)
+            {
+                // output = input + band × (gain − 1): the band (whole signal, above the split, or between the two
+                // handles) and the gain go to the high rate below
+                float ba = da, bb = db;
+                if (! wide)
+                {
+                    const auto la = split.process (da, 0), lb = split.process (db, 1);
+                    ba = da - la;
+                    bb = db - lb;
+                    if (lpOn)
+                    {
+                        ba = bandLp2.process (bandLp.process (ba, 0), 0);
+                        bb = bandLp2.process (bandLp.process (bb, 1), 1);
+                        topHp2.process (topHp.process (da - la, 0), 0); // (kept running: switching back stays smooth)
+                        topHp2.process (topHp.process (db - lb, 1), 1);
+                    }
+                }
+                bandBuf[0][(std::size_t) i] = ba;
+                bandBuf[1][(std::size_t) i] = bb;
+                gainBuf[0][(std::size_t) i] = gA - 1.0f;
+                gainBuf[1][(std::size_t) i] = gB - 1.0f;
+                a = da;
+                b = db;
+            }
             else if (wide)
             {
                 a = da * gA;
@@ -916,11 +971,32 @@ public:
             l[i] = a * out;
             r[i] = b * out;
         }
+        if (over)
+        {
+            const auto m = n * osFactor;
+            for (int c = 0; c < 2; ++c)
+            {
+                auto* x = c == 0 ? l : r;
+                if (listening)
+                {
+                    os[(std::size_t) c].process (x, n, [] (float v) noexcept { return v; });
+                    continue;
+                }
+                auto& ub = upBand[(std::size_t) c];
+                auto& ug = upGain[(std::size_t) c];
+                int k = 0, j = 0, q = 0;
+                osBand[(std::size_t) c].process (bandBuf[(std::size_t) c].data(), n, [&] (float v) noexcept { ub[(std::size_t) std::min (k++, m - 1)] = v; return 0.0f; });
+                osGain[(std::size_t) c].process (gainBuf[(std::size_t) c].data(), n, [&] (float v) noexcept { ug[(std::size_t) std::min (j++, m - 1)] = v; return 0.0f; });
+                os[(std::size_t) c].process (x, n, [&] (float v) noexcept {
+                    const auto at = (std::size_t) std::min (q++, m - 1);
+                    return v + ub[at] * ug[at] * out;
+                });
+            }
+        }
         meters.set ((float) maxGr, 0.0f, inPeak, Meters::peak (l, r, n));
         scL = scR = nullptr;
     }
 
-private:
     void setDelay (double ms) noexcept
     {
         delayMs = ms;
@@ -929,6 +1005,11 @@ private:
         scDelay.setLength (len);
     }
 
+    static constexpr int maxBlock = 1024, maxFactor = 8;
+    int osFactor = 1;
+    std::array<Oversampler, 2> os, osBand, osGain;
+    std::array<std::array<float, maxBlock>, 2> bandBuf {}, gainBuf {};
+    std::array<std::array<float, maxBlock * maxFactor>, 2> upBand {}, upGain {};
     double sr = 44100.0;
     double primedMs = 2.0, delayMs = 2.0;
     Delay2<4096> delay, scDelay;
@@ -1751,7 +1832,8 @@ const EffectInfo& hushInfo()
                                      // round 128 (parity with the reference de-esser)
                                      { "Allround", 0.0f }, { "Low-pass freq.", 1.0f }, { "Lookahead time", 2.0f / 15.0f },
                                      { "Stereo link", 1.0f }, { "Link mid", 0.0f }, { "External SC", 0.0f }, { "Input", 0.5f },
-                                     { "Display", 1.0f } } };
+                                     { "Display", 1.0f },
+                                     { "Oversampling", 0.0f } } }; // round 135
     return info;
 }
 
@@ -1832,6 +1914,7 @@ std::string onOff (float v) { return on (v) ? "on" : "off"; }
 
 namespace glow
 {
+
 std::string classicParamText (int param, float v)
 {
     switch (param)
@@ -1844,6 +1927,8 @@ std::string classicParamText (int param, float v)
 
 namespace hush
 {
+int oversamplingOf (float v) noexcept { return 1 << std::clamp ((int) std::lround (std::clamp (v, 0.0f, 1.0f) * 3.0f), 0, 3); }
+
 std::string classicParamText (int param, float v)
 {
     switch (param)
@@ -1939,6 +2024,7 @@ std::string paramText (EffectKind kind, int param, float v)
             case release: return fmt ("%.0f ms", releaseMs (v));
             case output: return fmt ("%+.1f dB", lin (v, -12.0, 12.0));
             case voicing: return on (v) ? "classic split" : "modern";
+            case oversampling: return oversamplingOf (v) == 1 ? "off" : std::to_string (oversamplingOf (v)) + "x";
             default: return onOff (v);
         }
     }

+ 4 - 1
src/core/MixSuite.h

@@ -162,8 +162,11 @@ namespace hush
 // (detect the slot's side chain), input (±12 dB), display (editor only: show the waveform).
 // round 123 (vmatch123): voicing at 9 — 0 = Hush's own engine, 1 = the measured classic split de-esser
 // (core/VoiceMatch.h); round 128's controls follow it.
+// round 135 (appended): oversampling (off, 2x, 4x, 8x) — Hush's own voicing applies its gain at the high rate (the
+// measured classic voicing is left as it is); latency + the oversampler's.
 enum Param { frequency, threshold, range, mode, detector, listen, lookahead, release, output, voicing,
-             allround, lowPass, lookaheadTime, stereoLink, linkMid, external, input, display, count };
+             allround, lowPass, lookaheadTime, stereoLink, linkMid, external, input, display, oversampling, count };
+int oversamplingOf (float v) noexcept; // 1 (off), 2, 4, 8
 double hz (float v) noexcept;          // 2 .. 16 kHz
 double lowPassHz (float v) noexcept;   // 2 .. 20 kHz (v ≥ 0.999 = off)
 double lookaheadTimeMs (float v) noexcept; // 0 .. 15 ms

+ 36 - 14
src/core/PluginLayout.cpp

@@ -1065,6 +1065,9 @@ Layout lynxTune()
     v.push_back (display (300, 116, 200, 200, "pitchring"));
     v.push_back (knob (574, 224, 60, "Natural vibrato", TR_NOOP ("NATURAL VIBRATO"), 284, bipolar | showValue));
     v.push_back (knob (700, 200, 104, "Humanize", TR_NOOP ("HUMANIZE"), 284, big | showValue));
+    // round 135: CLASSIC (the older correctors' retune) and LEARN (the scale from the notes played on the MIDI channel)
+    v.push_back (toggle (12, 116, 90, 18, "Classic", TR_NOOP ("Classic")));
+    v.push_back (toggle (690, 116, 104, 18, "Learn MIDI", TR_NOOP ("Learn scale")));
     // --- pitch graph / advanced (pages)
     v.push_back (section (0, 336, 800, 142, nullptr, boxed));
     v.push_back (pageTabs (8, 340, 330, 20, TR_NOOP ("Pitch graph|Advanced|Real-time")));
@@ -1694,9 +1697,9 @@ Layout hushDeEsser()
 {
     Layout l;
     l.width = 460;
-    l.height = 286;
+    l.height = 316;
     auto& v = l.items;
-    v.push_back (section (4, 4, 452, 278, TR_NOOP ("De-esser")));
+    v.push_back (section (4, 4, 452, 308, TR_NOOP ("De-esser")));
     v.push_back (display (12, 26, 200, 78, "hushband"));
     v.push_back (meter (12, 110, 200, 12, 0, TR_NOOP ("Reduction")));
     v.push_back (tabs (12, 130, 98, 20, "Wideband", TR_NOOP ("Split|Wide")));
@@ -1719,6 +1722,9 @@ Layout hushDeEsser()
     v.push_back (dial (310, 228, 30, "Lookahead time", TR_NOOP ("Lookahead")));
     v.push_back (dial (370, 228, 30, "Stereo link", TR_NOOP ("Stereo link")));
     v.push_back (dial (430, 228, 30, "Input", TR_NOOP ("Input"), bipolar));
+    // round 135: oversampling (Hush's own voicing)
+    v.push_back (label (12, 286, 90, 20, TR_NOOP ("Oversampling")));
+    v.push_back (tabs (104, 286, 176, 20, "Oversampling", TR_NOOP ("Off|2x|4x|8x")));
     return l;
 }
 
@@ -1913,6 +1919,9 @@ Layout crestCompressor()
     // round 128 (Pro-C 3 parity): dry level and auto threshold; link mode and the display options on their own page
     v.push_back (onPage (dial (572, 546, 28, "Dry", TR_NOOP ("Dry")), 0));
     v.push_back (onPage (toggle (630, 530, 160, 20, "Auto threshold", TR_NOOP ("Auto threshold")), 0));
+    // round 135: the wet and dry paths' balance
+    v.push_back (onPage (dial (680, 566, 20, "Wet pan", TR_NOOP ("Wet pan"), bipolar), 0));
+    v.push_back (onPage (dial (750, 566, 20, "Dry pan", TR_NOOP ("Dry pan"), bipolar), 0));
     v.push_back (onPage (label (20, 530, 70, 22, TR_NOOP ("Link mode")), 2));
     v.push_back (onPage (tabs (92, 530, 360, 22, "Link mode", TR_NOOP ("Stereo|Mid only|Side only|Mid > side|Side > mid")), 2));
     v.push_back (onPage (label (470, 530, 50, 22, TR_NOOP ("Scale")), 2));
@@ -1943,24 +1952,26 @@ Layout prismMultiband()
     Layout l;
     l.width = 900;
     l.height = 560;
-    l.pages = { TR_NOOP ("Band 1"), TR_NOOP ("Band 2"), TR_NOOP ("Band 3"), TR_NOOP ("Band 4") };
+    l.pages = { TR_NOOP ("Band 1"), TR_NOOP ("Band 2"), TR_NOOP ("Band 3"), TR_NOOP ("Band 4"), TR_NOOP ("Band 5"), TR_NOOP ("Band 6") };
     auto& v = l.items;
     // the bands are the display: click one to edit it, drag a crossover line to move it
     v.push_back (display (8, 8, 884, 330, "prismbands"));
     // the selected band's panel
     v.push_back (section (8, 344, 884, 126, nullptr, boxed));
-    v.push_back (pageTabs (16, 352, 232, 22, TR_NOOP ("Band 1|Band 2|Band 3|Band 4")));
-    static const char* names[4][10] {
+    v.push_back (pageTabs (16, 352, 348, 22, TR_NOOP ("Band 1|Band 2|Band 3|Band 4|Band 5|Band 6")));
+    static const char* names[6][10] {
         { "B1 threshold", "B1 ratio", "B1 range", "B1 expand", "B1 knee", "B1 attack", "B1 release", "B1 level", "B1 on", "B1 solo" },
         { "B2 threshold", "B2 ratio", "B2 range", "B2 expand", "B2 knee", "B2 attack", "B2 release", "B2 level", "B2 on", "B2 solo" },
         { "B3 threshold", "B3 ratio", "B3 range", "B3 expand", "B3 knee", "B3 attack", "B3 release", "B3 level", "B3 on", "B3 solo" },
-        { "B4 threshold", "B4 ratio", "B4 range", "B4 expand", "B4 knee", "B4 attack", "B4 release", "B4 level", "B4 on", "B4 solo" } };
-    for (int b = 0; b < 4; ++b)
+        { "B4 threshold", "B4 ratio", "B4 range", "B4 expand", "B4 knee", "B4 attack", "B4 release", "B4 level", "B4 on", "B4 solo" },
+        { "B5 threshold", "B5 ratio", "B5 range", "B5 expand", "B5 knee", "B5 attack", "B5 release", "B5 level", "B5 on", "B5 solo" },
+        { "B6 threshold", "B6 ratio", "B6 range", "B6 expand", "B6 knee", "B6 attack", "B6 release", "B6 level", "B6 on", "B6 solo" } };
+    for (int b = 0; b < 6; ++b) // round 135: up to six bands
     {
         auto add = [&] (LayoutItem i) { i.colour = b; v.push_back (onPage (std::move (i), b)); };
         add (toggle (16, 384, 56, 22, names[b][8], TR_NOOP ("On")));
         add (toggle (78, 384, 60, 22, names[b][9], TR_NOOP ("Solo")));
-        add (tabs (16, 414, 232, 22, names[b][3], TR_NOOP ("Compress|Expand")));
+        add (tabs (16, 414, 160, 22, names[b][3], TR_NOOP ("Compress|Expand")));
         add (dial (312, 398, 46, names[b][0], TR_NOOP ("Threshold"), big));
         add (dial (402, 398, 46, names[b][2], TR_NOOP ("Range"), big | bipolar));
         add (dial (484, 398, 36, names[b][1], TR_NOOP ("Ratio")));
@@ -1968,16 +1979,24 @@ Layout prismMultiband()
         add (dial (628, 398, 36, names[b][5], TR_NOOP ("Attack")));
         add (dial (700, 398, 36, names[b][6], TR_NOOP ("Release")));
         add (dial (788, 398, 40, names[b][7], TR_NOOP ("Level"), bipolar));
-        static const char* las[4] { "B1 lookahead", "B2 lookahead", "B3 lookahead", "B4 lookahead" };
+        static const char* las[6] { "B1 lookahead", "B2 lookahead", "B3 lookahead", "B4 lookahead", "B5 lookahead", "B6 lookahead" };
         add (dial (858, 398, 22, las[b], TR_NOOP ("Lookahead"))); // round 128: the band's own look-ahead
+        static const char* pans[6] { "B1 pan", "B2 pan", "B3 pan", "B4 pan", "B5 pan", "B6 pan" };
+        add (dial (200, 395, 22, pans[b], TR_NOOP ("Pan"), bipolar)); // round 135
     }
     // global bar
     v.push_back (label (8, 482, 50, 22, TR_NOOP ("Slope")));
     v.push_back (tabs (56, 482, 200, 22, "Slope", TR_NOOP ("12 dB/oct|24 dB/oct|48 dB/oct")));
-    v.push_back (dial (300, 504, 24, "Crossover 1", TR_NOOP ("Crossover 1")));
-    v.push_back (dial (380, 504, 24, "Crossover 2", TR_NOOP ("Crossover 2")));
-    v.push_back (dial (460, 504, 24, "Crossover 3", TR_NOOP ("Crossover 3")));
-    v.push_back (dial (580, 504, 24, "Lookahead", TR_NOOP ("Lookahead")));
+    // round 135: the band count, crossovers 4–5, the external side chain
+    v.push_back (label (8, 510, 50, 22, TR_NOOP ("Bands")));
+    v.push_back (tabs (56, 510, 200, 22, "Bands", "1|2|3|4|5|6"));
+    v.push_back (toggle (56, 538, 140, 18, "External SC", TR_NOOP ("External input")));
+    v.push_back (dial (290, 504, 24, "Crossover 1", TR_NOOP ("Crossover 1")));
+    v.push_back (dial (350, 504, 24, "Crossover 2", TR_NOOP ("Crossover 2")));
+    v.push_back (dial (410, 504, 24, "Crossover 3", TR_NOOP ("Crossover 3")));
+    v.push_back (dial (470, 504, 24, "Crossover 4", TR_NOOP ("Crossover 4")));
+    v.push_back (dial (530, 504, 24, "Crossover 5", TR_NOOP ("Crossover 5")));
+    v.push_back (dial (600, 504, 24, "Lookahead", TR_NOOP ("Lookahead")));
     v.push_back (dial (660, 504, 24, "Mix", TR_NOOP ("Mix")));
     v.push_back (dial (740, 504, 24, "Input", TR_NOOP ("Input"), bipolar));
     v.push_back (dial (820, 504, 24, "Output", TR_NOOP ("Output"), bipolar));
@@ -1988,7 +2007,7 @@ Layout sentryGate()
 {
     Layout l;
     l.width = 680;
-    l.height = 480;
+    l.height = 510;
     auto& v = l.items;
     // left: threshold (big) with ratio and range under it
     v.push_back (dial (86, 84, 92, "Threshold", TR_NOOP ("Threshold"), big));
@@ -2026,6 +2045,9 @@ Layout sentryGate()
                                                                  { "Input", TR_NOOP ("Input") } };
     for (int k = 0; k < 7; ++k)
         v.push_back (dial (220.0f + 68.0f * (float) k, 438, 22, expert[k].first, expert[k].second, bipolar));
+    // round 135: oversampling (the reference's bottom bar)
+    v.push_back (label (8, 482, 90, 22, TR_NOOP ("Oversampling")));
+    v.push_back (tabs (96, 482, 176, 22, "Oversampling", TR_NOOP ("Off|2x|4x|8x")));
     return l;
 }
 

+ 21 - 15
src/ui/DynamicsDisplays.cpp

@@ -284,20 +284,26 @@ bool paint (juce::Graphics& g, const juce::String& id, juce::Rectangle<float> r,
         g.setColour (colour::bg0);
         g.fillRoundedRectangle (r, radius::md * s);
         using namespace dyn::prism;
-        const double xo[3] { crossoverHz (p[xover1]), crossoverHz (p[xover2]), crossoverHz (p[xover3]) };
-        const float edges[5] { a.getX(), freqX (xo[0], a), freqX (xo[1], a), freqX (xo[2], a), a.getRight() };
+        // round 135: up to six bands (the band count)
+        const auto nb = bandCount (p);
+        const auto xo = crossovers (p);
+        float edges[bands + 1] {};
+        edges[0] = a.getX();
+        for (int k = 0; k < nb - 1; ++k)
+            edges[k + 1] = freqX (xo[(std::size_t) k], a);
+        edges[nb] = a.getRight();
         double live[bands] {};
-        for (int b = 0; b < bands; ++b)
+        for (int b = 0; b < nb; ++b)
         {
             const auto on = p[(std::size_t) param (b, fEnabled)] >= 0.5f;
-            live[b] = on ? (double) meter (b) * 30.0 + levelDb (p[(std::size_t) param (b, fLevel)]) : 0.0;
+            live[b] = on ? (double) meter (bandMeter (b)) * 30.0 + levelDb (p[(std::size_t) param (b, fLevel)]) : 0.0;
             const auto area = juce::Rectangle<float> (edges[b], a.getY(), juce::jmax (1.0f, edges[b + 1] - edges[b]), a.getHeight());
             const auto c = peqview::bandColour (b);
             g.setColour (c.withAlpha (on && enabled ? 0.10f : 0.03f));
             g.fillRect (area);
             // the live gain change: a bar from the middle line (up = boost, down = reduction), ±18 dB
             const auto mid = a.getCentreY();
-            const auto gainChange = on ? (float) meter (b) * 30.0f : 0.0f;
+            const auto gainChange = on ? (float) meter (bandMeter (b)) * 30.0f : 0.0f;
             const auto hBar = a.getHeight() * 0.5f * juce::jlimit (-1.0f, 1.0f, gainChange / 18.0f);
             const auto bar = juce::Rectangle<float> (area.getCentreX() - 10.0f * s, hBar < 0 ? mid : mid - hBar, 20.0f * s, std::abs (hBar));
             g.setColour (c.withAlpha (enabled ? 0.75f : 0.25f));
@@ -309,7 +315,7 @@ bool paint (juce::Graphics& g, const juce::String& id, juce::Rectangle<float> r,
         }
         freqLabels (g, a, s);
         g.setColour (colour::textSecondary);
-        for (int k = 1; k <= 3; ++k)
+        for (int k = 1; k < nb; ++k)
             g.drawVerticalLine ((int) edges[k], a.getY(), a.getBottom());
         g.setColour (colour::gridBar);
         g.drawHorizontalLine ((int) a.getCentreY(), a.getX(), a.getRight());
@@ -367,13 +373,13 @@ int crossoverParams (const EffectSlot& fx, int* params, double* hz)
     if (fx.kind == EffectKind::prismMultiband)
     {
         using namespace dyn::prism;
-        const int ps[3] { xover1, xover2, xover3 };
-        for (int k = 0; k < 3; ++k)
+        const auto nb = bandCount (fx.params);
+        for (int k = 0; k < nb - 1; ++k)
         {
-            params[k] = ps[k];
-            hz[k] = crossoverHz (fx.params[(std::size_t) ps[k]]);
+            params[k] = crossoverParam (k);
+            hz[k] = crossoverHz (fx.params[(std::size_t) params[k]]);
         }
-        return 3;
+        return nb - 1;
     }
     if (fx.kind == EffectKind::ember)
     {
@@ -394,8 +400,8 @@ int crossoverParams (const EffectSlot& fx, int* params, double* hz)
 int crossoverNear (const EffectSlot& fx, juce::Rectangle<float> r, float x, float tolerance)
 {
     const auto a = r.reduced (6.0f);
-    int params[3];
-    double hz[3];
+    int params[5];
+    double hz[5];
     const auto n = crossoverParams (fx, params, hz);
     int best = -1;
     float bestDist = tolerance;
@@ -411,8 +417,8 @@ int crossoverNear (const EffectSlot& fx, juce::Rectangle<float> r, float x, floa
 int bandAt (const EffectSlot& fx, juce::Rectangle<float> r, float x)
 {
     const auto a = r.reduced (6.0f);
-    int params[3];
-    double hz[3];
+    int params[5];
+    double hz[5];
     const auto n = crossoverParams (fx, params, hz);
     int band = 0;
     for (int k = 0; k < n; ++k)

+ 15 - 2
src/ui/FacetEqEditor.cpp

@@ -37,7 +37,8 @@ juce::Colour bandColour (int band)
 
 // display names of facet::Shape (core names, translated here)
 const char* const shapeNames[] = { TR_NOOP ("Off"), TR_NOOP ("Bell"), TR_NOOP ("Low shelf"), TR_NOOP ("High shelf"), TR_NOOP ("Low cut"),
-                                   TR_NOOP ("High cut"), TR_NOOP ("Notch"), TR_NOOP ("Band pass"), TR_NOOP ("Tilt shelf") };
+                                   TR_NOOP ("High cut"), TR_NOOP ("Notch"), TR_NOOP ("Band pass"), TR_NOOP ("Tilt shelf"),
+                                   TR_NOOP ("Flat tilt"), TR_NOOP ("All pass") }; // round 135: the last two
 const char* const phaseNames[] = { TR_NOOP ("Zero latency"), TR_NOOP ("Natural phase"), TR_NOOP ("Linear phase") };
 const char* const analyzerShort[] = { TR_NOOP ("Off"), TR_NOOP ("Pre"), TR_NOOP ("Post"), TR_NOOP ("Pre + Post") };
 const char* const analyzerNames[] = { TR_NOOP ("Analyzer off"), TR_NOOP ("Analyzer: pre"), TR_NOOP ("Analyzer: post"), TR_NOOP ("Analyzer: pre + post") };
@@ -539,6 +540,12 @@ public:
         for (int k = 0; k < phaseCount; ++k)
             menu.addItem (tr (phaseNames[k]) + (k == 0 ? juce::String() : "  (" + tr ("latency {0} samples", { juce::String (latencyFor ((Phase) k, displayRate())) }) + ")"),
                           true, m == k, [this, k] { set ({ { phaseParam, phaseValue ((Phase) k) } }); });
+        // round 135: the character (the reference's Clean / Subtle / Warm)
+        menu.addSectionHeader (tr ("Character"));
+        static const char* const characters[] { TR_NOOP ("Clean"), TR_NOOP ("Subtle"), TR_NOOP ("Warm") };
+        const auto ch = facet::character (param01 (characterParam));
+        for (int k = 0; k < 3; ++k)
+            menu.addItem (tr (characters[k]), true, ch == k, [this, k] { set ({ { characterParam, (float) k / 2.0f } }); });
         menu.showMenuAsync (juce::PopupMenu::Options().withTargetComponent (this).withMousePosition());
     }
 
@@ -915,7 +922,13 @@ public:
             else if (c.type == Ctl::phase || c.type == Ctl::analyzer || c.type == Ctl::detector)
             {
                 juce::String caption, value;
-                if (c.type == Ctl::phase) { caption = tr ("Processing:"); value = tr (phaseNames[(int) phase (param01 (phaseParam))]); }
+                if (c.type == Ctl::phase)
+                {
+                    caption = tr ("Processing:");
+                    value = tr (phaseNames[(int) phase (param01 (phaseParam))]);
+                    static const char* const characters[] { TR_NOOP ("Clean"), TR_NOOP ("Subtle"), TR_NOOP ("Warm") };
+                    if (const auto ch = facet::character (param01 (characterParam)); ch > 0) value << juce::String::fromUTF8 (" · ") << tr (characters[ch]);
+                }
                 else if (c.type == Ctl::analyzer) { caption = tr ("Analyzer:"); value = tr (analyzerShort[(int) analyzer (param01 (analyzerParam))]); }
                 else
                 {

+ 223 - 127
src/ui/I18nData.h

@@ -9789,132 +9789,228 @@ inline constexpr unsigned char ptBR[] = {
 97, 32, 99, 111, 109, 32, 99, 32, 100, 101, 115, 108, 105, 103, 97, 100, 111, 44, 32, 98, 32, 99, 111, 109,
 32, 99, 32, 108, 105, 103, 97, 100, 111, 34, 10, 34, 97, 108, 108, 32, 97, 98, 111, 118, 101, 34, 32, 61,
 32, 34, 116, 111, 100, 97, 115, 32, 97, 99, 105, 109, 97, 34, 10, 35, 32, 114, 111, 117, 110, 100, 32, 49,
-51, 50, 58, 32, 105, 115, 115, 117, 101, 32, 35, 52, 32, 102, 101, 97, 116, 117, 114, 101, 32, 114, 101, 113,
-117, 101, 115, 116, 115, 32, 40, 97, 117, 100, 105, 111, 32, 101, 100, 105, 116, 111, 114, 32, 105, 110, 32, 86,
-105, 101, 119, 44, 32, 112, 114, 101, 118, 105, 101, 119, 32, 118, 111, 108, 117, 109, 101, 44, 32, 114, 97, 99,
-107, 32, 112, 105, 97, 110, 111, 45, 114, 111, 108, 108, 32, 118, 105, 101, 119, 44, 32, 109, 101, 116, 114, 111,
-110, 111, 109, 101, 32, 118, 111, 108, 117, 109, 101, 44, 32, 116, 101, 109, 112, 111, 32, 116, 97, 112, 112, 101,
-114, 44, 32, 115, 97, 109, 112, 108, 101, 32, 103, 97, 105, 110, 41, 10, 34, 79, 112, 101, 110, 32, 116, 104,
-101, 32, 97, 117, 100, 105, 111, 32, 101, 100, 105, 116, 111, 114, 34, 32, 61, 32, 34, 65, 98, 114, 105, 114,
-32, 111, 32, 101, 100, 105, 116, 111, 114, 32, 100, 101, 32, 195, 161, 117, 100, 105, 111, 34, 10, 34, 84, 101,
-109, 112, 111, 32, 116, 97, 112, 112, 101, 114, 32, 40, 116, 97, 112, 32, 116, 104, 101, 32, 116, 101, 109, 112,
-111, 41, 34, 32, 61, 32, 34, 84, 101, 109, 112, 111, 32, 116, 97, 112, 112, 101, 114, 32, 40, 98, 97, 116,
-101, 114, 32, 111, 32, 97, 110, 100, 97, 109, 101, 110, 116, 111, 41, 34, 10, 34, 80, 105, 97, 110, 111, 45,
-114, 111, 108, 108, 32, 118, 105, 101, 119, 32, 111, 102, 32, 97, 108, 108, 32, 99, 104, 97, 110, 110, 101, 108,
-115, 32, 111, 110, 47, 111, 102, 102, 34, 32, 61, 32, 34, 86, 105, 115, 116, 97, 32, 100, 101, 32, 112, 105,
-97, 110, 111, 32, 114, 111, 108, 108, 32, 100, 101, 32, 116, 111, 100, 111, 115, 32, 111, 115, 32, 99, 97, 110,
-97, 105, 115, 32, 108, 105, 103, 97, 47, 100, 101, 115, 108, 105, 103, 97, 34, 10, 34, 83, 97, 109, 112, 108,
-101, 32, 112, 114, 101, 118, 105, 101, 119, 32, 118, 111, 108, 117, 109, 101, 58, 32, 123, 48, 125, 34, 32, 61,
-32, 34, 86, 111, 108, 117, 109, 101, 32, 100, 97, 32, 112, 114, 195, 169, 45, 101, 115, 99, 117, 116, 97, 32,
-100, 101, 32, 115, 97, 109, 112, 108, 101, 115, 58, 32, 123, 48, 125, 34, 10, 34, 91, 76, 77, 66, 93, 32,
-100, 114, 97, 103, 32, 32, 91, 87, 104, 101, 101, 108, 93, 32, 115, 116, 101, 112, 32, 32, 91, 50, 120, 76,
-77, 66, 93, 32, 49, 48, 48, 37, 32, 32, 91, 82, 77, 66, 93, 32, 116, 121, 112, 101, 32, 97, 32, 118,
-97, 108, 117, 101, 34, 32, 61, 32, 34, 91, 76, 77, 66, 93, 32, 97, 114, 114, 97, 115, 116, 101, 32, 32,
-91, 82, 111, 100, 97, 93, 32, 112, 97, 115, 115, 111, 32, 32, 91, 50, 120, 76, 77, 66, 93, 32, 49, 48,
-48, 37, 32, 32, 91, 82, 77, 66, 93, 32, 100, 105, 103, 105, 116, 97, 114, 32, 117, 109, 32, 118, 97, 108,
-111, 114, 34, 10, 34, 83, 97, 109, 112, 108, 101, 32, 103, 97, 105, 110, 58, 32, 98, 111, 111, 115, 116, 115,
-32, 111, 114, 32, 99, 117, 116, 115, 32, 116, 104, 101, 32, 115, 97, 109, 112, 108, 101, 39, 115, 32, 108, 101,
-118, 101, 108, 32, 98, 101, 102, 111, 114, 101, 32, 116, 104, 101, 32, 99, 104, 97, 110, 110, 101, 108, 32, 118,
-111, 108, 117, 109, 101, 32, 40, 45, 50, 52, 32, 116, 111, 32, 43, 50, 52, 32, 100, 66, 44, 32, 100, 111,
-117, 98, 108, 101, 45, 99, 108, 105, 99, 107, 32, 61, 32, 48, 32, 100, 66, 41, 34, 32, 61, 32, 34, 71,
-97, 110, 104, 111, 32, 100, 111, 32, 115, 97, 109, 112, 108, 101, 58, 32, 97, 117, 109, 101, 110, 116, 97, 32,
-111, 117, 32, 114, 101, 100, 117, 122, 32, 111, 32, 110, 195, 173, 118, 101, 108, 32, 100, 111, 32, 115, 97, 109,
-112, 108, 101, 32, 97, 110, 116, 101, 115, 32, 100, 111, 32, 118, 111, 108, 117, 109, 101, 32, 100, 111, 32, 99,
-97, 110, 97, 108, 32, 40, 45, 50, 52, 32, 97, 32, 43, 50, 52, 32, 100, 66, 44, 32, 100, 117, 112, 108,
-111, 32, 99, 108, 105, 113, 117, 101, 32, 61, 32, 48, 32, 100, 66, 41, 34, 10, 34, 80, 105, 97, 110, 111,
-45, 114, 111, 108, 108, 32, 118, 105, 101, 119, 58, 32, 101, 118, 101, 114, 121, 32, 99, 104, 97, 110, 110, 101,
-108, 32, 115, 104, 111, 119, 115, 32, 105, 116, 115, 32, 110, 111, 116, 101, 115, 32, 97, 115, 32, 97, 32, 109,
-105, 110, 105, 97, 116, 117, 114, 101, 32, 112, 105, 97, 110, 111, 32, 114, 111, 108, 108, 32, 40, 99, 108, 105,
-99, 107, 32, 111, 110, 101, 32, 116, 111, 32, 101, 100, 105, 116, 32, 105, 116, 41, 32, 105, 110, 115, 116, 101,
-97, 100, 32, 111, 102, 32, 116, 104, 101, 32, 115, 116, 101, 112, 32, 98, 117, 116, 116, 111, 110, 115, 59, 32,
-99, 108, 105, 99, 107, 32, 97, 103, 97, 105, 110, 32, 102, 111, 114, 32, 116, 104, 101, 32, 115, 116, 101, 112,
-115, 34, 32, 61, 32, 34, 86, 105, 115, 116, 97, 32, 100, 101, 32, 112, 105, 97, 110, 111, 32, 114, 111, 108,
-108, 58, 32, 99, 97, 100, 97, 32, 99, 97, 110, 97, 108, 32, 109, 111, 115, 116, 114, 97, 32, 115, 117, 97,
-115, 32, 110, 111, 116, 97, 115, 32, 110, 117, 109, 32, 112, 105, 97, 110, 111, 32, 114, 111, 108, 108, 32, 101,
-109, 32, 109, 105, 110, 105, 97, 116, 117, 114, 97, 32, 40, 99, 108, 105, 113, 117, 101, 32, 110, 117, 109, 32,
-112, 97, 114, 97, 32, 101, 100, 105, 116, 195, 161, 45, 108, 111, 41, 32, 101, 109, 32, 118, 101, 122, 32, 100,
-111, 115, 32, 98, 111, 116, 195, 181, 101, 115, 32, 100, 101, 32, 112, 97, 115, 115, 111, 59, 32, 99, 108, 105,
-113, 117, 101, 32, 100, 101, 32, 110, 111, 118, 111, 32, 112, 97, 114, 97, 32, 111, 115, 32, 112, 97, 115, 115,
-111, 115, 34, 10, 34, 80, 105, 97, 110, 111, 45, 114, 111, 108, 108, 32, 118, 105, 101, 119, 32, 111, 102, 32,
-97, 108, 108, 32, 99, 104, 97, 110, 110, 101, 108, 115, 34, 32, 61, 32, 34, 86, 105, 115, 116, 97, 32, 100,
-101, 32, 112, 105, 97, 110, 111, 32, 114, 111, 108, 108, 32, 100, 101, 32, 116, 111, 100, 111, 115, 32, 111, 115,
-32, 99, 97, 110, 97, 105, 115, 34, 10, 34, 86, 111, 108, 117, 109, 101, 58, 32, 123, 48, 125, 46, 46, 46,
-34, 32, 61, 32, 34, 86, 111, 108, 117, 109, 101, 58, 32, 123, 48, 125, 46, 46, 46, 34, 10, 34, 67, 111,
-117, 110, 116, 45, 105, 110, 32, 98, 101, 102, 111, 114, 101, 32, 114, 101, 99, 111, 114, 100, 105, 110, 103, 34,
-32, 61, 32, 34, 67, 111, 110, 116, 97, 103, 101, 109, 32, 97, 110, 116, 101, 115, 32, 100, 101, 32, 103, 114,
-97, 118, 97, 114, 34, 10, 34, 77, 101, 116, 114, 111, 110, 111, 109, 101, 32, 118, 111, 108, 117, 109, 101, 34,
-32, 61, 32, 34, 86, 111, 108, 117, 109, 101, 32, 100, 111, 32, 109, 101, 116, 114, 195, 180, 110, 111, 109, 111,
-34, 10, 34, 77, 101, 116, 114, 111, 110, 111, 109, 101, 32, 118, 111, 108, 117, 109, 101, 58, 32, 49, 48, 48,
-37, 32, 105, 115, 32, 116, 104, 101, 32, 100, 101, 102, 97, 117, 108, 116, 32, 99, 108, 105, 99, 107, 32, 108,
-101, 118, 101, 108, 44, 32, 117, 112, 32, 116, 111, 32, 49, 50, 53, 37, 32, 32, 91, 50, 120, 76, 77, 66,
-93, 32, 49, 48, 48, 37, 34, 32, 61, 32, 34, 86, 111, 108, 117, 109, 101, 32, 100, 111, 32, 109, 101, 116,
-114, 195, 180, 110, 111, 109, 111, 58, 32, 49, 48, 48, 37, 32, 195, 169, 32, 111, 32, 110, 195, 173, 118, 101,
-108, 32, 112, 97, 100, 114, 195, 163, 111, 32, 100, 111, 32, 99, 108, 105, 113, 117, 101, 44, 32, 97, 116, 195,
-169, 32, 49, 50, 53, 37, 32, 32, 91, 50, 120, 76, 77, 66, 93, 32, 49, 48, 48, 37, 34, 10, 34, 84,
-101, 109, 112, 111, 32, 116, 97, 112, 112, 101, 114, 46, 46, 46, 34, 32, 61, 32, 34, 84, 101, 109, 112, 111,
-32, 116, 97, 112, 112, 101, 114, 46, 46, 46, 34, 10, 34, 77, 101, 116, 114, 111, 110, 111, 109, 101, 58, 32,
-99, 108, 105, 99, 107, 115, 32, 111, 110, 32, 101, 118, 101, 114, 121, 32, 98, 101, 97, 116, 32, 119, 104, 105,
-108, 101, 32, 112, 108, 97, 121, 105, 110, 103, 32, 32, 91, 82, 77, 66, 93, 32, 118, 111, 108, 117, 109, 101,
-32, 97, 110, 100, 32, 111, 112, 116, 105, 111, 110, 115, 34, 32, 61, 32, 34, 77, 101, 116, 114, 195, 180, 110,
-111, 109, 111, 58, 32, 99, 108, 105, 99, 97, 32, 101, 109, 32, 99, 97, 100, 97, 32, 116, 101, 109, 112, 111,
-32, 100, 117, 114, 97, 110, 116, 101, 32, 97, 32, 114, 101, 112, 114, 111, 100, 117, 195, 167, 195, 163, 111, 32,
-32, 91, 82, 77, 66, 93, 32, 118, 111, 108, 117, 109, 101, 32, 101, 32, 111, 112, 195, 167, 195, 181, 101, 115,
-34, 10, 34, 80, 105, 97, 110, 111, 45, 114, 111, 108, 108, 32, 118, 105, 101, 119, 34, 32, 61, 32, 34, 86,
-105, 115, 116, 97, 32, 100, 101, 32, 112, 105, 97, 110, 111, 32, 114, 111, 108, 108, 34, 10, 34, 84, 101, 109,
-112, 111, 32, 116, 97, 112, 112, 101, 114, 34, 32, 61, 32, 34, 84, 101, 109, 112, 111, 32, 116, 97, 112, 112,
-101, 114, 34, 10, 34, 77, 101, 116, 114, 111, 110, 111, 109, 101, 32, 118, 111, 108, 117, 109, 101, 32, 40, 123,
-48, 125, 41, 46, 46, 46, 34, 32, 61, 32, 34, 86, 111, 108, 117, 109, 101, 32, 100, 111, 32, 109, 101, 116,
-114, 195, 180, 110, 111, 109, 111, 32, 40, 123, 48, 125, 41, 46, 46, 46, 34, 10, 34, 65, 112, 112, 108, 121,
-32, 116, 101, 109, 112, 111, 34, 32, 61, 32, 34, 65, 112, 108, 105, 99, 97, 114, 32, 97, 110, 100, 97, 109,
-101, 110, 116, 111, 34, 10, 34, 45, 32, 110, 117, 100, 103, 101, 34, 32, 61, 32, 34, 45, 32, 101, 109, 112,
-117, 114, 114, 97, 114, 34, 10, 34, 110, 117, 100, 103, 101, 32, 43, 34, 32, 61, 32, 34, 101, 109, 112, 117,
-114, 114, 97, 114, 32, 43, 34, 10, 34, 84, 65, 80, 34, 32, 61, 32, 34, 84, 65, 80, 34, 10, 34, 67,
-108, 105, 99, 107, 32, 116, 104, 101, 32, 112, 97, 100, 32, 111, 114, 32, 112, 114, 101, 115, 115, 32, 97, 110,
-121, 32, 107, 101, 121, 32, 111, 110, 32, 101, 97, 99, 104, 32, 98, 101, 97, 116, 34, 32, 61, 32, 34, 67,
-108, 105, 113, 117, 101, 32, 110, 111, 32, 112, 97, 100, 32, 111, 117, 32, 97, 112, 101, 114, 116, 101, 32, 113,
-117, 97, 108, 113, 117, 101, 114, 32, 116, 101, 99, 108, 97, 32, 101, 109, 32, 99, 97, 100, 97, 32, 116, 101,
-109, 112, 111, 34, 10, 34, 87, 97, 105, 116, 105, 110, 103, 32, 102, 111, 114, 32, 109, 111, 114, 101, 32, 116,
-97, 112, 115, 46, 46, 46, 34, 32, 61, 32, 34, 69, 115, 112, 101, 114, 97, 110, 100, 111, 32, 109, 97, 105,
-115, 32, 98, 97, 116, 105, 100, 97, 115, 46, 46, 46, 34, 10, 34, 84, 97, 112, 112, 105, 110, 103, 46, 46,
-46, 32, 40, 123, 48, 125, 32, 116, 97, 112, 115, 41, 34, 32, 61, 32, 34, 66, 97, 116, 101, 110, 100, 111,
-46, 46, 46, 32, 40, 123, 48, 125, 32, 98, 97, 116, 105, 100, 97, 115, 41, 34, 10, 34, 83, 116, 97, 98,
-108, 101, 32, 40, 123, 48, 125, 32, 116, 97, 112, 115, 41, 34, 32, 61, 32, 34, 69, 115, 116, 195, 161, 118,
-101, 108, 32, 40, 123, 48, 125, 32, 98, 97, 116, 105, 100, 97, 115, 41, 34, 10, 34, 65, 112, 112, 108, 121,
-32, 116, 101, 109, 112, 111, 58, 32, 116, 104, 101, 32, 115, 111, 110, 103, 39, 115, 32, 116, 101, 109, 112, 111,
-32, 102, 111, 108, 108, 111, 119, 115, 32, 116, 104, 101, 32, 116, 97, 112, 115, 32, 40, 111, 102, 102, 58, 32,
-116, 104, 101, 32, 116, 97, 112, 112, 101, 114, 32, 111, 110, 108, 121, 32, 109, 101, 97, 115, 117, 114, 101, 115,
-41, 34, 32, 61, 32, 34, 65, 112, 108, 105, 99, 97, 114, 32, 97, 110, 100, 97, 109, 101, 110, 116, 111, 58,
-32, 111, 32, 97, 110, 100, 97, 109, 101, 110, 116, 111, 32, 100, 97, 32, 109, 195, 186, 115, 105, 99, 97, 32,
-115, 101, 103, 117, 101, 32, 97, 115, 32, 98, 97, 116, 105, 100, 97, 115, 32, 40, 100, 101, 115, 108, 105, 103,
-97, 100, 111, 58, 32, 111, 32, 116, 97, 112, 112, 101, 114, 32, 115, 195, 179, 32, 109, 101, 100, 101, 41, 34,
-10, 34, 83, 121, 110, 99, 58, 32, 100, 117, 114, 105, 110, 103, 32, 112, 108, 97, 121, 98, 97, 99, 107, 32,
-101, 97, 99, 104, 32, 116, 97, 112, 32, 112, 117, 116, 115, 32, 116, 104, 101, 32, 112, 108, 97, 121, 104, 101,
-97, 100, 32, 111, 110, 32, 116, 104, 101, 32, 110, 101, 97, 114, 101, 115, 116, 32, 98, 101, 97, 116, 34, 32,
-61, 32, 34, 83, 121, 110, 99, 58, 32, 100, 117, 114, 97, 110, 116, 101, 32, 97, 32, 114, 101, 112, 114, 111,
-100, 117, 195, 167, 195, 163, 111, 32, 99, 97, 100, 97, 32, 98, 97, 116, 105, 100, 97, 32, 112, 195, 181, 101,
-32, 111, 32, 99, 117, 114, 115, 111, 114, 32, 110, 111, 32, 116, 101, 109, 112, 111, 32, 109, 97, 105, 115, 32,
-112, 114, 195, 179, 120, 105, 109, 111, 34, 10, 34, 72, 111, 108, 100, 32, 116, 111, 32, 114, 117, 110, 32, 116,
-104, 101, 32, 115, 111, 110, 103, 32, 52, 37, 32, 115, 108, 111, 119, 101, 114, 32, 97, 110, 100, 32, 100, 114,
-105, 102, 116, 32, 116, 104, 101, 32, 98, 101, 97, 116, 32, 98, 97, 99, 107, 32, 40, 91, 76, 101, 102, 116,
-93, 32, 107, 101, 121, 41, 34, 32, 61, 32, 34, 83, 101, 103, 117, 114, 101, 32, 112, 97, 114, 97, 32, 97,
-32, 109, 195, 186, 115, 105, 99, 97, 32, 97, 110, 100, 97, 114, 32, 52, 37, 32, 109, 97, 105, 115, 32, 100,
-101, 118, 97, 103, 97, 114, 32, 101, 32, 97, 116, 114, 97, 115, 97, 114, 32, 111, 32, 116, 101, 109, 112, 111,
-32, 40, 116, 101, 99, 108, 97, 32, 91, 69, 115, 113, 117, 101, 114, 100, 97, 93, 41, 34, 10, 34, 72, 111,
-108, 100, 32, 116, 111, 32, 114, 117, 110, 32, 116, 104, 101, 32, 115, 111, 110, 103, 32, 52, 37, 32, 102, 97,
-115, 116, 101, 114, 32, 97, 110, 100, 32, 100, 114, 105, 102, 116, 32, 116, 104, 101, 32, 98, 101, 97, 116, 32,
-102, 111, 114, 119, 97, 114, 100, 32, 40, 91, 82, 105, 103, 104, 116, 93, 32, 107, 101, 121, 41, 34, 32, 61,
-32, 34, 83, 101, 103, 117, 114, 101, 32, 112, 97, 114, 97, 32, 97, 32, 109, 195, 186, 115, 105, 99, 97, 32,
-97, 110, 100, 97, 114, 32, 52, 37, 32, 109, 97, 105, 115, 32, 114, 195, 161, 112, 105, 100, 111, 32, 101, 32,
-97, 100, 105, 97, 110, 116, 97, 114, 32, 111, 32, 116, 101, 109, 112, 111, 32, 40, 116, 101, 99, 108, 97, 32,
-91, 68, 105, 114, 101, 105, 116, 97, 93, 41, 34, 10, 34, 84, 101, 109, 112, 111, 32, 116, 97, 112, 112, 101,
-114, 58, 32, 99, 108, 105, 99, 107, 32, 116, 104, 101, 32, 112, 97, 100, 32, 111, 114, 32, 112, 114, 101, 115,
-115, 32, 97, 110, 121, 32, 107, 101, 121, 32, 111, 110, 32, 101, 97, 99, 104, 32, 98, 101, 97, 116, 59, 32,
-116, 104, 101, 32, 116, 101, 109, 112, 111, 32, 102, 111, 108, 108, 111, 119, 115, 32, 102, 114, 111, 109, 32, 116,
-104, 101, 32, 115, 101, 99, 111, 110, 100, 32, 116, 97, 112, 34, 32, 61, 32, 34, 84, 101, 109, 112, 111, 32,
-116, 97, 112, 112, 101, 114, 58, 32, 99, 108, 105, 113, 117, 101, 32, 110, 111, 32, 112, 97, 100, 32, 111, 117,
-32, 97, 112, 101, 114, 116, 101, 32, 113, 117, 97, 108, 113, 117, 101, 114, 32, 116, 101, 99, 108, 97, 32, 101,
-109, 32, 99, 97, 100, 97, 32, 116, 101, 109, 112, 111, 59, 32, 111, 32, 97, 110, 100, 97, 109, 101, 110, 116,
-111, 32, 115, 101, 103, 117, 101, 32, 97, 32, 112, 97, 114, 116, 105, 114, 32, 100, 97, 32, 115, 101, 103, 117,
-110, 100, 97, 32, 98, 97, 116, 105, 100, 97, 34, 10,
+51, 53, 102, 58, 32, 70, 97, 98, 70, 105, 108, 116, 101, 114, 45, 114, 111, 108, 101, 32, 112, 97, 114, 105,
+116, 121, 32, 40, 65, 112, 101, 120, 32, 108, 111, 117, 100, 110, 101, 115, 115, 32, 47, 32, 100, 105, 115, 112,
+108, 97, 121, 32, 47, 32, 111, 118, 101, 114, 115, 97, 109, 112, 108, 105, 110, 103, 44, 32, 80, 114, 105, 115,
+109, 32, 115, 105, 120, 32, 98, 97, 110, 100, 115, 44, 32, 70, 97, 99, 101, 116, 32, 115, 104, 97, 112, 101,
+115, 44, 32, 76, 89, 78, 88, 32, 84, 117, 110, 101, 32, 108, 101, 97, 114, 110, 41, 10, 34, 76, 101, 97,
+114, 110, 32, 115, 99, 97, 108, 101, 34, 32, 61, 32, 34, 65, 112, 114, 101, 110, 100, 101, 114, 32, 101, 115,
+99, 97, 108, 97, 34, 10, 34, 70, 108, 97, 116, 32, 116, 105, 108, 116, 34, 32, 61, 32, 34, 73, 110, 99,
+108, 105, 110, 97, 195, 167, 195, 163, 111, 32, 112, 108, 97, 110, 97, 34, 10, 34, 65, 108, 108, 32, 112, 97,
+115, 115, 34, 32, 61, 32, 34, 80, 97, 115, 115, 97, 45, 116, 117, 100, 111, 34, 10, 34, 83, 117, 98, 116,
+108, 101, 34, 32, 61, 32, 34, 83, 117, 116, 105, 108, 34, 10, 34, 83, 108, 111, 119, 32, 100, 111, 119, 110,
+34, 32, 61, 32, 34, 68, 101, 115, 97, 99, 101, 108, 101, 114, 97, 114, 34, 10, 34, 73, 110, 102, 105, 110,
+105, 116, 101, 34, 32, 61, 32, 34, 73, 110, 102, 105, 110, 105, 116, 111, 34, 10, 34, 83, 97, 109, 112, 108,
+101, 32, 112, 101, 97, 107, 34, 32, 61, 32, 34, 80, 105, 99, 111, 32, 100, 101, 32, 97, 109, 111, 115, 116,
+114, 97, 34, 10, 34, 76, 111, 117, 100, 110, 101, 115, 115, 32, 109, 101, 116, 101, 114, 58, 32, 109, 111, 109,
+101, 110, 116, 97, 114, 121, 44, 32, 115, 104, 111, 114, 116, 32, 116, 101, 114, 109, 32, 97, 110, 100, 32, 105,
+110, 116, 101, 103, 114, 97, 116, 101, 100, 32, 76, 85, 70, 83, 44, 32, 108, 111, 117, 100, 110, 101, 115, 115,
+32, 114, 97, 110, 103, 101, 44, 32, 112, 101, 97, 107, 34, 32, 61, 32, 34, 77, 101, 100, 105, 100, 111, 114,
+32, 100, 101, 32, 108, 111, 117, 100, 110, 101, 115, 115, 58, 32, 76, 85, 70, 83, 32, 109, 111, 109, 101, 110,
+116, 195, 162, 110, 101, 111, 44, 32, 100, 101, 32, 99, 117, 114, 116, 111, 32, 112, 114, 97, 122, 111, 32, 101,
+32, 105, 110, 116, 101, 103, 114, 97, 100, 111, 44, 32, 102, 97, 105, 120, 97, 32, 100, 101, 32, 108, 111, 117,
+100, 110, 101, 115, 115, 44, 32, 112, 105, 99, 111, 34, 10, 34, 68, 105, 115, 112, 108, 97, 121, 32, 115, 112,
+101, 101, 100, 58, 32, 70, 97, 115, 116, 44, 32, 83, 108, 111, 119, 44, 32, 83, 108, 111, 119, 32, 100, 111,
+119, 110, 32, 40, 116, 104, 101, 32, 112, 97, 115, 116, 32, 99, 111, 109, 112, 114, 101, 115, 115, 101, 100, 41,
+44, 32, 73, 110, 102, 105, 110, 105, 116, 101, 32, 40, 116, 104, 101, 32, 119, 104, 111, 108, 101, 32, 116, 97,
+107, 101, 41, 44, 32, 79, 102, 102, 32, 40, 109, 101, 116, 101, 114, 115, 32, 111, 110, 108, 121, 41, 34, 32,
+61, 32, 34, 86, 101, 108, 111, 99, 105, 100, 97, 100, 101, 32, 100, 111, 32, 100, 105, 115, 112, 108, 97, 121,
+58, 32, 82, 195, 161, 112, 105, 100, 111, 44, 32, 76, 101, 110, 116, 111, 44, 32, 68, 101, 115, 97, 99, 101,
+108, 101, 114, 97, 114, 32, 40, 111, 32, 112, 97, 115, 115, 97, 100, 111, 32, 99, 111, 109, 112, 114, 105, 109,
+105, 100, 111, 41, 44, 32, 73, 110, 102, 105, 110, 105, 116, 111, 32, 40, 111, 32, 116, 97, 107, 101, 32, 105,
+110, 116, 101, 105, 114, 111, 41, 44, 32, 68, 101, 115, 108, 105, 103, 97, 100, 111, 32, 40, 115, 195, 179, 32,
+109, 101, 100, 105, 100, 111, 114, 101, 115, 41, 34, 10, 34, 76, 111, 117, 100, 110, 101, 115, 115, 32, 116, 97,
+114, 103, 101, 116, 58, 32, 116, 104, 101, 32, 108, 105, 110, 101, 32, 111, 110, 32, 116, 104, 101, 32, 108, 111,
+117, 100, 110, 101, 115, 115, 32, 98, 97, 114, 115, 34, 32, 61, 32, 34, 65, 108, 118, 111, 32, 100, 101, 32,
+108, 111, 117, 100, 110, 101, 115, 115, 58, 32, 97, 32, 108, 105, 110, 104, 97, 32, 110, 97, 115, 32, 98, 97,
+114, 114, 97, 115, 32, 100, 101, 32, 108, 111, 117, 100, 110, 101, 115, 115, 34, 10, 34, 82, 101, 115, 101, 116,
+32, 116, 104, 101, 32, 105, 110, 116, 101, 103, 114, 97, 116, 101, 100, 32, 108, 111, 117, 100, 110, 101, 115, 115,
+44, 32, 116, 104, 101, 32, 114, 97, 110, 103, 101, 32, 97, 110, 100, 32, 116, 104, 101, 32, 112, 101, 97, 107,
+32, 104, 111, 108, 100, 34, 32, 61, 32, 34, 90, 101, 114, 97, 32, 111, 32, 108, 111, 117, 100, 110, 101, 115,
+115, 32, 105, 110, 116, 101, 103, 114, 97, 100, 111, 44, 32, 97, 32, 102, 97, 105, 120, 97, 32, 101, 32, 111,
+32, 112, 105, 99, 111, 32, 114, 101, 116, 105, 100, 111, 34, 10, 34, 65, 100, 118, 97, 110, 99, 101, 100, 58,
+32, 68, 67, 32, 111, 102, 102, 115, 101, 116, 32, 102, 105, 108, 116, 101, 114, 44, 32, 117, 110, 105, 116, 121,
+32, 103, 97, 105, 110, 44, 32, 97, 117, 100, 105, 116, 105, 111, 110, 32, 108, 105, 109, 105, 116, 105, 110, 103,
+44, 32, 115, 105, 100, 101, 45, 99, 104, 97, 105, 110, 32, 116, 114, 105, 103, 103, 101, 114, 105, 110, 103, 34,
+32, 61, 32, 34, 65, 118, 97, 110, 195, 167, 97, 100, 111, 58, 32, 102, 105, 108, 116, 114, 111, 32, 100, 101,
+32, 111, 102, 102, 115, 101, 116, 32, 68, 67, 44, 32, 103, 97, 110, 104, 111, 32, 117, 110, 105, 116, 195, 161,
+114, 105, 111, 44, 32, 111, 117, 118, 105, 114, 32, 97, 32, 108, 105, 109, 105, 116, 97, 195, 167, 195, 163, 111,
+44, 32, 100, 105, 115, 112, 97, 114, 111, 32, 112, 111, 114, 32, 115, 105, 100, 101, 32, 99, 104, 97, 105, 110,
+34, 10, 34, 83, 105, 100, 101, 45, 99, 104, 97, 105, 110, 32, 116, 114, 105, 103, 103, 101, 114, 105, 110, 103,
+34, 32, 61, 32, 34, 68, 105, 115, 112, 97, 114, 111, 32, 112, 111, 114, 32, 115, 105, 100, 101, 32, 99, 104,
+97, 105, 110, 34, 10, 34, 84, 104, 101, 32, 108, 105, 109, 105, 116, 101, 114, 32, 114, 101, 97, 99, 116, 115,
+32, 116, 111, 32, 116, 104, 101, 32, 115, 108, 111, 116, 39, 115, 32, 115, 105, 100, 101, 45, 99, 104, 97, 105,
+110, 32, 105, 110, 112, 117, 116, 32, 40, 109, 105, 120, 101, 114, 58, 32, 114, 105, 103, 104, 116, 45, 99, 108,
+105, 99, 107, 32, 116, 104, 101, 32, 115, 108, 111, 116, 32, 45, 32, 83, 105, 100, 101, 32, 99, 104, 97, 105,
+110, 41, 34, 32, 61, 32, 34, 79, 32, 108, 105, 109, 105, 116, 97, 100, 111, 114, 32, 114, 101, 97, 103, 101,
+32, 195, 160, 32, 101, 110, 116, 114, 97, 100, 97, 32, 100, 101, 32, 115, 105, 100, 101, 32, 99, 104, 97, 105,
+110, 32, 100, 111, 32, 115, 108, 111, 116, 32, 40, 109, 105, 120, 101, 114, 58, 32, 99, 108, 105, 113, 117, 101,
+32, 100, 105, 114, 101, 105, 116, 111, 32, 110, 111, 32, 115, 108, 111, 116, 32, 45, 32, 83, 105, 100, 101, 32,
+99, 104, 97, 105, 110, 41, 34, 10, 34, 68, 105, 115, 112, 108, 97, 121, 32, 111, 102, 102, 34, 32, 61, 32,
+34, 68, 105, 115, 112, 108, 97, 121, 32, 100, 101, 115, 108, 105, 103, 97, 100, 111, 34, 10, 34, 73, 110, 116,
+101, 103, 114, 97, 116, 101, 100, 34, 32, 61, 32, 34, 73, 110, 116, 101, 103, 114, 97, 100, 111, 34, 10, 34,
+83, 104, 111, 114, 116, 32, 116, 101, 114, 109, 34, 32, 61, 32, 34, 67, 117, 114, 116, 111, 32, 112, 114, 97,
+122, 111, 34, 10, 34, 77, 111, 109, 101, 110, 116, 97, 114, 121, 34, 32, 61, 32, 34, 77, 111, 109, 101, 110,
+116, 195, 162, 110, 101, 111, 34, 10, 34, 84, 114, 117, 101, 32, 112, 101, 97, 107, 34, 32, 61, 32, 34, 84,
+114, 117, 101, 32, 112, 101, 97, 107, 34, 10, 34, 68, 114, 97, 103, 32, 97, 32, 110, 111, 100, 101, 58, 32,
+114, 97, 110, 103, 101, 32, 40, 117, 112, 32, 47, 32, 100, 111, 119, 110, 41, 44, 32, 98, 97, 110, 100, 32,
+40, 108, 101, 102, 116, 32, 47, 32, 114, 105, 103, 104, 116, 41, 32, 32, 45, 32, 32, 100, 114, 97, 103, 32,
+97, 110, 32, 101, 100, 103, 101, 58, 32, 99, 114, 111, 115, 115, 111, 118, 101, 114, 32, 32, 45, 32, 32, 100,
+111, 117, 98, 108, 101, 45, 99, 108, 105, 99, 107, 58, 32, 110, 101, 119, 32, 98, 97, 110, 100, 32, 32, 45,
+32, 32, 119, 104, 101, 101, 108, 58, 32, 116, 104, 114, 101, 115, 104, 111, 108, 100, 34, 32, 61, 32, 34, 65,
+114, 114, 97, 115, 116, 101, 32, 117, 109, 32, 110, 195, 179, 58, 32, 102, 97, 105, 120, 97, 32, 40, 99, 105,
+109, 97, 32, 47, 32, 98, 97, 105, 120, 111, 41, 44, 32, 98, 97, 110, 100, 97, 32, 40, 101, 115, 113, 117,
+101, 114, 100, 97, 32, 47, 32, 100, 105, 114, 101, 105, 116, 97, 41, 32, 32, 45, 32, 32, 97, 114, 114, 97,
+115, 116, 101, 32, 117, 109, 97, 32, 98, 111, 114, 100, 97, 58, 32, 99, 114, 111, 115, 115, 111, 118, 101, 114,
+32, 32, 45, 32, 32, 99, 108, 105, 113, 117, 101, 32, 100, 117, 112, 108, 111, 58, 32, 110, 111, 118, 97, 32,
+98, 97, 110, 100, 97, 32, 32, 45, 32, 32, 114, 111, 100, 97, 58, 32, 116, 104, 114, 101, 115, 104, 111, 108,
+100, 34, 10, 34, 83, 112, 108, 105, 116, 32, 116, 104, 101, 32, 98, 97, 110, 100, 34, 32, 61, 32, 34, 68,
+105, 118, 105, 100, 105, 114, 32, 97, 32, 98, 97, 110, 100, 97, 34, 10, 34, 82, 101, 109, 111, 118, 101, 32,
+116, 104, 101, 32, 98, 97, 110, 100, 34, 32, 61, 32, 34, 82, 101, 109, 111, 118, 101, 114, 32, 97, 32, 98,
+97, 110, 100, 97, 34, 10, 34, 67, 108, 105, 99, 107, 32, 97, 32, 98, 97, 110, 100, 32, 116, 111, 32, 111,
+112, 101, 110, 32, 105, 116, 115, 32, 112, 97, 110, 101, 108, 59, 32, 100, 111, 117, 98, 108, 101, 45, 99, 108,
+105, 99, 107, 32, 61, 32, 97, 32, 110, 101, 119, 32, 98, 97, 110, 100, 32, 104, 101, 114, 101, 32, 40, 117,
+112, 32, 116, 111, 32, 115, 105, 120, 41, 59, 32, 114, 105, 103, 104, 116, 45, 99, 108, 105, 99, 107, 32, 61,
+32, 98, 97, 110, 100, 32, 109, 101, 110, 117, 34, 32, 61, 32, 34, 67, 108, 105, 113, 117, 101, 32, 110, 117,
+109, 97, 32, 98, 97, 110, 100, 97, 32, 112, 97, 114, 97, 32, 97, 98, 114, 105, 114, 32, 111, 32, 112, 97,
+105, 110, 101, 108, 59, 32, 99, 108, 105, 113, 117, 101, 32, 100, 117, 112, 108, 111, 32, 61, 32, 117, 109, 97,
+32, 110, 111, 118, 97, 32, 98, 97, 110, 100, 97, 32, 97, 113, 117, 105, 32, 40, 97, 116, 195, 169, 32, 115,
+101, 105, 115, 41, 59, 32, 99, 108, 105, 113, 117, 101, 32, 100, 105, 114, 101, 105, 116, 111, 32, 61, 32, 109,
+101, 110, 117, 32, 100, 97, 32, 98, 97, 110, 100, 97, 34, 10, 34, 66, 97, 110, 100, 32, 53, 34, 32, 61,
+32, 34, 66, 97, 110, 100, 97, 32, 53, 34, 10, 34, 66, 97, 110, 100, 32, 54, 34, 32, 61, 32, 34, 66,
+97, 110, 100, 97, 32, 54, 34, 10, 34, 66, 97, 110, 100, 32, 49, 124, 66, 97, 110, 100, 32, 50, 124, 66,
+97, 110, 100, 32, 51, 124, 66, 97, 110, 100, 32, 52, 124, 66, 97, 110, 100, 32, 53, 124, 66, 97, 110, 100,
+32, 54, 34, 32, 61, 32, 34, 66, 97, 110, 100, 97, 32, 49, 124, 66, 97, 110, 100, 97, 32, 50, 124, 66,
+97, 110, 100, 97, 32, 51, 124, 66, 97, 110, 100, 97, 32, 52, 124, 66, 97, 110, 100, 97, 32, 53, 124, 66,
+97, 110, 100, 97, 32, 54, 34, 10, 34, 67, 114, 111, 115, 115, 111, 118, 101, 114, 32, 52, 34, 32, 61, 32,
+34, 67, 114, 111, 115, 115, 111, 118, 101, 114, 32, 52, 34, 10, 34, 67, 114, 111, 115, 115, 111, 118, 101, 114,
+32, 53, 34, 32, 61, 32, 34, 67, 114, 111, 115, 115, 111, 118, 101, 114, 32, 53, 34, 10, 35, 32, 114, 111,
+117, 110, 100, 32, 49, 51, 50, 58, 32, 105, 115, 115, 117, 101, 32, 35, 52, 32, 102, 101, 97, 116, 117, 114,
+101, 32, 114, 101, 113, 117, 101, 115, 116, 115, 32, 40, 97, 117, 100, 105, 111, 32, 101, 100, 105, 116, 111, 114,
+32, 105, 110, 32, 86, 105, 101, 119, 44, 32, 112, 114, 101, 118, 105, 101, 119, 32, 118, 111, 108, 117, 109, 101,
+44, 32, 114, 97, 99, 107, 32, 112, 105, 97, 110, 111, 45, 114, 111, 108, 108, 32, 118, 105, 101, 119, 44, 32,
+109, 101, 116, 114, 111, 110, 111, 109, 101, 32, 118, 111, 108, 117, 109, 101, 44, 32, 116, 101, 109, 112, 111, 32,
+116, 97, 112, 112, 101, 114, 44, 32, 115, 97, 109, 112, 108, 101, 32, 103, 97, 105, 110, 41, 10, 34, 79, 112,
+101, 110, 32, 116, 104, 101, 32, 97, 117, 100, 105, 111, 32, 101, 100, 105, 116, 111, 114, 34, 32, 61, 32, 34,
+65, 98, 114, 105, 114, 32, 111, 32, 101, 100, 105, 116, 111, 114, 32, 100, 101, 32, 195, 161, 117, 100, 105, 111,
+34, 10, 34, 84, 101, 109, 112, 111, 32, 116, 97, 112, 112, 101, 114, 32, 40, 116, 97, 112, 32, 116, 104, 101,
+32, 116, 101, 109, 112, 111, 41, 34, 32, 61, 32, 34, 84, 101, 109, 112, 111, 32, 116, 97, 112, 112, 101, 114,
+32, 40, 98, 97, 116, 101, 114, 32, 111, 32, 97, 110, 100, 97, 109, 101, 110, 116, 111, 41, 34, 10, 34, 80,
+105, 97, 110, 111, 45, 114, 111, 108, 108, 32, 118, 105, 101, 119, 32, 111, 102, 32, 97, 108, 108, 32, 99, 104,
+97, 110, 110, 101, 108, 115, 32, 111, 110, 47, 111, 102, 102, 34, 32, 61, 32, 34, 86, 105, 115, 116, 97, 32,
+100, 101, 32, 112, 105, 97, 110, 111, 32, 114, 111, 108, 108, 32, 100, 101, 32, 116, 111, 100, 111, 115, 32, 111,
+115, 32, 99, 97, 110, 97, 105, 115, 32, 108, 105, 103, 97, 47, 100, 101, 115, 108, 105, 103, 97, 34, 10, 34,
+83, 97, 109, 112, 108, 101, 32, 112, 114, 101, 118, 105, 101, 119, 32, 118, 111, 108, 117, 109, 101, 58, 32, 123,
+48, 125, 34, 32, 61, 32, 34, 86, 111, 108, 117, 109, 101, 32, 100, 97, 32, 112, 114, 195, 169, 45, 101, 115,
+99, 117, 116, 97, 32, 100, 101, 32, 115, 97, 109, 112, 108, 101, 115, 58, 32, 123, 48, 125, 34, 10, 34, 91,
+76, 77, 66, 93, 32, 100, 114, 97, 103, 32, 32, 91, 87, 104, 101, 101, 108, 93, 32, 115, 116, 101, 112, 32,
+32, 91, 50, 120, 76, 77, 66, 93, 32, 49, 48, 48, 37, 32, 32, 91, 82, 77, 66, 93, 32, 116, 121, 112,
+101, 32, 97, 32, 118, 97, 108, 117, 101, 34, 32, 61, 32, 34, 91, 76, 77, 66, 93, 32, 97, 114, 114, 97,
+115, 116, 101, 32, 32, 91, 82, 111, 100, 97, 93, 32, 112, 97, 115, 115, 111, 32, 32, 91, 50, 120, 76, 77,
+66, 93, 32, 49, 48, 48, 37, 32, 32, 91, 82, 77, 66, 93, 32, 100, 105, 103, 105, 116, 97, 114, 32, 117,
+109, 32, 118, 97, 108, 111, 114, 34, 10, 34, 83, 97, 109, 112, 108, 101, 32, 103, 97, 105, 110, 58, 32, 98,
+111, 111, 115, 116, 115, 32, 111, 114, 32, 99, 117, 116, 115, 32, 116, 104, 101, 32, 115, 97, 109, 112, 108, 101,
+39, 115, 32, 108, 101, 118, 101, 108, 32, 98, 101, 102, 111, 114, 101, 32, 116, 104, 101, 32, 99, 104, 97, 110,
+110, 101, 108, 32, 118, 111, 108, 117, 109, 101, 32, 40, 45, 50, 52, 32, 116, 111, 32, 43, 50, 52, 32, 100,
+66, 44, 32, 100, 111, 117, 98, 108, 101, 45, 99, 108, 105, 99, 107, 32, 61, 32, 48, 32, 100, 66, 41, 34,
+32, 61, 32, 34, 71, 97, 110, 104, 111, 32, 100, 111, 32, 115, 97, 109, 112, 108, 101, 58, 32, 97, 117, 109,
+101, 110, 116, 97, 32, 111, 117, 32, 114, 101, 100, 117, 122, 32, 111, 32, 110, 195, 173, 118, 101, 108, 32, 100,
+111, 32, 115, 97, 109, 112, 108, 101, 32, 97, 110, 116, 101, 115, 32, 100, 111, 32, 118, 111, 108, 117, 109, 101,
+32, 100, 111, 32, 99, 97, 110, 97, 108, 32, 40, 45, 50, 52, 32, 97, 32, 43, 50, 52, 32, 100, 66, 44,
+32, 100, 117, 112, 108, 111, 32, 99, 108, 105, 113, 117, 101, 32, 61, 32, 48, 32, 100, 66, 41, 34, 10, 34,
+80, 105, 97, 110, 111, 45, 114, 111, 108, 108, 32, 118, 105, 101, 119, 58, 32, 101, 118, 101, 114, 121, 32, 99,
+104, 97, 110, 110, 101, 108, 32, 115, 104, 111, 119, 115, 32, 105, 116, 115, 32, 110, 111, 116, 101, 115, 32, 97,
+115, 32, 97, 32, 109, 105, 110, 105, 97, 116, 117, 114, 101, 32, 112, 105, 97, 110, 111, 32, 114, 111, 108, 108,
+32, 40, 99, 108, 105, 99, 107, 32, 111, 110, 101, 32, 116, 111, 32, 101, 100, 105, 116, 32, 105, 116, 41, 32,
+105, 110, 115, 116, 101, 97, 100, 32, 111, 102, 32, 116, 104, 101, 32, 115, 116, 101, 112, 32, 98, 117, 116, 116,
+111, 110, 115, 59, 32, 99, 108, 105, 99, 107, 32, 97, 103, 97, 105, 110, 32, 102, 111, 114, 32, 116, 104, 101,
+32, 115, 116, 101, 112, 115, 34, 32, 61, 32, 34, 86, 105, 115, 116, 97, 32, 100, 101, 32, 112, 105, 97, 110,
+111, 32, 114, 111, 108, 108, 58, 32, 99, 97, 100, 97, 32, 99, 97, 110, 97, 108, 32, 109, 111, 115, 116, 114,
+97, 32, 115, 117, 97, 115, 32, 110, 111, 116, 97, 115, 32, 110, 117, 109, 32, 112, 105, 97, 110, 111, 32, 114,
+111, 108, 108, 32, 101, 109, 32, 109, 105, 110, 105, 97, 116, 117, 114, 97, 32, 40, 99, 108, 105, 113, 117, 101,
+32, 110, 117, 109, 32, 112, 97, 114, 97, 32, 101, 100, 105, 116, 195, 161, 45, 108, 111, 41, 32, 101, 109, 32,
+118, 101, 122, 32, 100, 111, 115, 32, 98, 111, 116, 195, 181, 101, 115, 32, 100, 101, 32, 112, 97, 115, 115, 111,
+59, 32, 99, 108, 105, 113, 117, 101, 32, 100, 101, 32, 110, 111, 118, 111, 32, 112, 97, 114, 97, 32, 111, 115,
+32, 112, 97, 115, 115, 111, 115, 34, 10, 34, 80, 105, 97, 110, 111, 45, 114, 111, 108, 108, 32, 118, 105, 101,
+119, 32, 111, 102, 32, 97, 108, 108, 32, 99, 104, 97, 110, 110, 101, 108, 115, 34, 32, 61, 32, 34, 86, 105,
+115, 116, 97, 32, 100, 101, 32, 112, 105, 97, 110, 111, 32, 114, 111, 108, 108, 32, 100, 101, 32, 116, 111, 100,
+111, 115, 32, 111, 115, 32, 99, 97, 110, 97, 105, 115, 34, 10, 34, 86, 111, 108, 117, 109, 101, 58, 32, 123,
+48, 125, 46, 46, 46, 34, 32, 61, 32, 34, 86, 111, 108, 117, 109, 101, 58, 32, 123, 48, 125, 46, 46, 46,
+34, 10, 34, 67, 111, 117, 110, 116, 45, 105, 110, 32, 98, 101, 102, 111, 114, 101, 32, 114, 101, 99, 111, 114,
+100, 105, 110, 103, 34, 32, 61, 32, 34, 67, 111, 110, 116, 97, 103, 101, 109, 32, 97, 110, 116, 101, 115, 32,
+100, 101, 32, 103, 114, 97, 118, 97, 114, 34, 10, 34, 77, 101, 116, 114, 111, 110, 111, 109, 101, 32, 118, 111,
+108, 117, 109, 101, 34, 32, 61, 32, 34, 86, 111, 108, 117, 109, 101, 32, 100, 111, 32, 109, 101, 116, 114, 195,
+180, 110, 111, 109, 111, 34, 10, 34, 77, 101, 116, 114, 111, 110, 111, 109, 101, 32, 118, 111, 108, 117, 109, 101,
+58, 32, 49, 48, 48, 37, 32, 105, 115, 32, 116, 104, 101, 32, 100, 101, 102, 97, 117, 108, 116, 32, 99, 108,
+105, 99, 107, 32, 108, 101, 118, 101, 108, 44, 32, 117, 112, 32, 116, 111, 32, 49, 50, 53, 37, 32, 32, 91,
+50, 120, 76, 77, 66, 93, 32, 49, 48, 48, 37, 34, 32, 61, 32, 34, 86, 111, 108, 117, 109, 101, 32, 100,
+111, 32, 109, 101, 116, 114, 195, 180, 110, 111, 109, 111, 58, 32, 49, 48, 48, 37, 32, 195, 169, 32, 111, 32,
+110, 195, 173, 118, 101, 108, 32, 112, 97, 100, 114, 195, 163, 111, 32, 100, 111, 32, 99, 108, 105, 113, 117, 101,
+44, 32, 97, 116, 195, 169, 32, 49, 50, 53, 37, 32, 32, 91, 50, 120, 76, 77, 66, 93, 32, 49, 48, 48,
+37, 34, 10, 34, 84, 101, 109, 112, 111, 32, 116, 97, 112, 112, 101, 114, 46, 46, 46, 34, 32, 61, 32, 34,
+84, 101, 109, 112, 111, 32, 116, 97, 112, 112, 101, 114, 46, 46, 46, 34, 10, 34, 77, 101, 116, 114, 111, 110,
+111, 109, 101, 58, 32, 99, 108, 105, 99, 107, 115, 32, 111, 110, 32, 101, 118, 101, 114, 121, 32, 98, 101, 97,
+116, 32, 119, 104, 105, 108, 101, 32, 112, 108, 97, 121, 105, 110, 103, 32, 32, 91, 82, 77, 66, 93, 32, 118,
+111, 108, 117, 109, 101, 32, 97, 110, 100, 32, 111, 112, 116, 105, 111, 110, 115, 34, 32, 61, 32, 34, 77, 101,
+116, 114, 195, 180, 110, 111, 109, 111, 58, 32, 99, 108, 105, 99, 97, 32, 101, 109, 32, 99, 97, 100, 97, 32,
+116, 101, 109, 112, 111, 32, 100, 117, 114, 97, 110, 116, 101, 32, 97, 32, 114, 101, 112, 114, 111, 100, 117, 195,
+167, 195, 163, 111, 32, 32, 91, 82, 77, 66, 93, 32, 118, 111, 108, 117, 109, 101, 32, 101, 32, 111, 112, 195,
+167, 195, 181, 101, 115, 34, 10, 34, 80, 105, 97, 110, 111, 45, 114, 111, 108, 108, 32, 118, 105, 101, 119, 34,
+32, 61, 32, 34, 86, 105, 115, 116, 97, 32, 100, 101, 32, 112, 105, 97, 110, 111, 32, 114, 111, 108, 108, 34,
+10, 34, 84, 101, 109, 112, 111, 32, 116, 97, 112, 112, 101, 114, 34, 32, 61, 32, 34, 84, 101, 109, 112, 111,
+32, 116, 97, 112, 112, 101, 114, 34, 10, 34, 77, 101, 116, 114, 111, 110, 111, 109, 101, 32, 118, 111, 108, 117,
+109, 101, 32, 40, 123, 48, 125, 41, 46, 46, 46, 34, 32, 61, 32, 34, 86, 111, 108, 117, 109, 101, 32, 100,
+111, 32, 109, 101, 116, 114, 195, 180, 110, 111, 109, 111, 32, 40, 123, 48, 125, 41, 46, 46, 46, 34, 10, 34,
+65, 112, 112, 108, 121, 32, 116, 101, 109, 112, 111, 34, 32, 61, 32, 34, 65, 112, 108, 105, 99, 97, 114, 32,
+97, 110, 100, 97, 109, 101, 110, 116, 111, 34, 10, 34, 45, 32, 110, 117, 100, 103, 101, 34, 32, 61, 32, 34,
+45, 32, 101, 109, 112, 117, 114, 114, 97, 114, 34, 10, 34, 110, 117, 100, 103, 101, 32, 43, 34, 32, 61, 32,
+34, 101, 109, 112, 117, 114, 114, 97, 114, 32, 43, 34, 10, 34, 84, 65, 80, 34, 32, 61, 32, 34, 84, 65,
+80, 34, 10, 34, 67, 108, 105, 99, 107, 32, 116, 104, 101, 32, 112, 97, 100, 32, 111, 114, 32, 112, 114, 101,
+115, 115, 32, 97, 110, 121, 32, 107, 101, 121, 32, 111, 110, 32, 101, 97, 99, 104, 32, 98, 101, 97, 116, 34,
+32, 61, 32, 34, 67, 108, 105, 113, 117, 101, 32, 110, 111, 32, 112, 97, 100, 32, 111, 117, 32, 97, 112, 101,
+114, 116, 101, 32, 113, 117, 97, 108, 113, 117, 101, 114, 32, 116, 101, 99, 108, 97, 32, 101, 109, 32, 99, 97,
+100, 97, 32, 116, 101, 109, 112, 111, 34, 10, 34, 87, 97, 105, 116, 105, 110, 103, 32, 102, 111, 114, 32, 109,
+111, 114, 101, 32, 116, 97, 112, 115, 46, 46, 46, 34, 32, 61, 32, 34, 69, 115, 112, 101, 114, 97, 110, 100,
+111, 32, 109, 97, 105, 115, 32, 98, 97, 116, 105, 100, 97, 115, 46, 46, 46, 34, 10, 34, 84, 97, 112, 112,
+105, 110, 103, 46, 46, 46, 32, 40, 123, 48, 125, 32, 116, 97, 112, 115, 41, 34, 32, 61, 32, 34, 66, 97,
+116, 101, 110, 100, 111, 46, 46, 46, 32, 40, 123, 48, 125, 32, 98, 97, 116, 105, 100, 97, 115, 41, 34, 10,
+34, 83, 116, 97, 98, 108, 101, 32, 40, 123, 48, 125, 32, 116, 97, 112, 115, 41, 34, 32, 61, 32, 34, 69,
+115, 116, 195, 161, 118, 101, 108, 32, 40, 123, 48, 125, 32, 98, 97, 116, 105, 100, 97, 115, 41, 34, 10, 34,
+65, 112, 112, 108, 121, 32, 116, 101, 109, 112, 111, 58, 32, 116, 104, 101, 32, 115, 111, 110, 103, 39, 115, 32,
+116, 101, 109, 112, 111, 32, 102, 111, 108, 108, 111, 119, 115, 32, 116, 104, 101, 32, 116, 97, 112, 115, 32, 40,
+111, 102, 102, 58, 32, 116, 104, 101, 32, 116, 97, 112, 112, 101, 114, 32, 111, 110, 108, 121, 32, 109, 101, 97,
+115, 117, 114, 101, 115, 41, 34, 32, 61, 32, 34, 65, 112, 108, 105, 99, 97, 114, 32, 97, 110, 100, 97, 109,
+101, 110, 116, 111, 58, 32, 111, 32, 97, 110, 100, 97, 109, 101, 110, 116, 111, 32, 100, 97, 32, 109, 195, 186,
+115, 105, 99, 97, 32, 115, 101, 103, 117, 101, 32, 97, 115, 32, 98, 97, 116, 105, 100, 97, 115, 32, 40, 100,
+101, 115, 108, 105, 103, 97, 100, 111, 58, 32, 111, 32, 116, 97, 112, 112, 101, 114, 32, 115, 195, 179, 32, 109,
+101, 100, 101, 41, 34, 10, 34, 83, 121, 110, 99, 58, 32, 100, 117, 114, 105, 110, 103, 32, 112, 108, 97, 121,
+98, 97, 99, 107, 32, 101, 97, 99, 104, 32, 116, 97, 112, 32, 112, 117, 116, 115, 32, 116, 104, 101, 32, 112,
+108, 97, 121, 104, 101, 97, 100, 32, 111, 110, 32, 116, 104, 101, 32, 110, 101, 97, 114, 101, 115, 116, 32, 98,
+101, 97, 116, 34, 32, 61, 32, 34, 83, 121, 110, 99, 58, 32, 100, 117, 114, 97, 110, 116, 101, 32, 97, 32,
+114, 101, 112, 114, 111, 100, 117, 195, 167, 195, 163, 111, 32, 99, 97, 100, 97, 32, 98, 97, 116, 105, 100, 97,
+32, 112, 195, 181, 101, 32, 111, 32, 99, 117, 114, 115, 111, 114, 32, 110, 111, 32, 116, 101, 109, 112, 111, 32,
+109, 97, 105, 115, 32, 112, 114, 195, 179, 120, 105, 109, 111, 34, 10, 34, 72, 111, 108, 100, 32, 116, 111, 32,
+114, 117, 110, 32, 116, 104, 101, 32, 115, 111, 110, 103, 32, 52, 37, 32, 115, 108, 111, 119, 101, 114, 32, 97,
+110, 100, 32, 100, 114, 105, 102, 116, 32, 116, 104, 101, 32, 98, 101, 97, 116, 32, 98, 97, 99, 107, 32, 40,
+91, 76, 101, 102, 116, 93, 32, 107, 101, 121, 41, 34, 32, 61, 32, 34, 83, 101, 103, 117, 114, 101, 32, 112,
+97, 114, 97, 32, 97, 32, 109, 195, 186, 115, 105, 99, 97, 32, 97, 110, 100, 97, 114, 32, 52, 37, 32, 109,
+97, 105, 115, 32, 100, 101, 118, 97, 103, 97, 114, 32, 101, 32, 97, 116, 114, 97, 115, 97, 114, 32, 111, 32,
+116, 101, 109, 112, 111, 32, 40, 116, 101, 99, 108, 97, 32, 91, 69, 115, 113, 117, 101, 114, 100, 97, 93, 41,
+34, 10, 34, 72, 111, 108, 100, 32, 116, 111, 32, 114, 117, 110, 32, 116, 104, 101, 32, 115, 111, 110, 103, 32,
+52, 37, 32, 102, 97, 115, 116, 101, 114, 32, 97, 110, 100, 32, 100, 114, 105, 102, 116, 32, 116, 104, 101, 32,
+98, 101, 97, 116, 32, 102, 111, 114, 119, 97, 114, 100, 32, 40, 91, 82, 105, 103, 104, 116, 93, 32, 107, 101,
+121, 41, 34, 32, 61, 32, 34, 83, 101, 103, 117, 114, 101, 32, 112, 97, 114, 97, 32, 97, 32, 109, 195, 186,
+115, 105, 99, 97, 32, 97, 110, 100, 97, 114, 32, 52, 37, 32, 109, 97, 105, 115, 32, 114, 195, 161, 112, 105,
+100, 111, 32, 101, 32, 97, 100, 105, 97, 110, 116, 97, 114, 32, 111, 32, 116, 101, 109, 112, 111, 32, 40, 116,
+101, 99, 108, 97, 32, 91, 68, 105, 114, 101, 105, 116, 97, 93, 41, 34, 10, 34, 84, 101, 109, 112, 111, 32,
+116, 97, 112, 112, 101, 114, 58, 32, 99, 108, 105, 99, 107, 32, 116, 104, 101, 32, 112, 97, 100, 32, 111, 114,
+32, 112, 114, 101, 115, 115, 32, 97, 110, 121, 32, 107, 101, 121, 32, 111, 110, 32, 101, 97, 99, 104, 32, 98,
+101, 97, 116, 59, 32, 116, 104, 101, 32, 116, 101, 109, 112, 111, 32, 102, 111, 108, 108, 111, 119, 115, 32, 102,
+114, 111, 109, 32, 116, 104, 101, 32, 115, 101, 99, 111, 110, 100, 32, 116, 97, 112, 34, 32, 61, 32, 34, 84,
+101, 109, 112, 111, 32, 116, 97, 112, 112, 101, 114, 58, 32, 99, 108, 105, 113, 117, 101, 32, 110, 111, 32, 112,
+97, 100, 32, 111, 117, 32, 97, 112, 101, 114, 116, 101, 32, 113, 117, 97, 108, 113, 117, 101, 114, 32, 116, 101,
+99, 108, 97, 32, 101, 109, 32, 99, 97, 100, 97, 32, 116, 101, 109, 112, 111, 59, 32, 111, 32, 97, 110, 100,
+97, 109, 101, 110, 116, 111, 32, 115, 101, 103, 117, 101, 32, 97, 32, 112, 97, 114, 116, 105, 114, 32, 100, 97,
+32, 115, 101, 103, 117, 110, 100, 97, 32, 98, 97, 116, 105, 100, 97, 34, 10,
 };
 } // namespace lynx::i18n::data

+ 35 - 0
src/ui/PluginEditors.cpp

@@ -1284,6 +1284,40 @@ public:
         g.setFont (font (juce::jmax (8.0f, 10.0f * s), true));
         g.drawText (tr ("Auto Key"), r, juce::Justification::centred);
     }
+    // LEARN (round 135): while LYNX Tune's "Learn scale" is on, every pitch class held on its MIDI channel joins the
+    // custom scale (switching learning on starts a new scale)
+    void learnScaleFromMidi()
+    {
+        const auto* fx = current();
+        if (fx == nullptr || fx->kind != EffectKind::lynxTune)
+            return;
+        const bool on = fx->params[(std::size_t) lynxtune::learnMidi] >= 0.5f;
+        if (! on)
+        {
+            learning = false;
+            return;
+        }
+        if (! learning)
+        {
+            learning = true;
+            learned = 0;
+        }
+        const auto held = (unsigned) std::lround (liveMeter (5) * 4096.0f) & 0xfffu;
+        if ((held & ~learned) == 0)
+            return;
+        learned |= held;
+        std::vector<std::pair<int, float>> changes { { lynxtune::scale, (float) (int) vocal::Scale::custom / (float) (vocal::scaleCount - 1) },
+                                                     { lynxtune::moreScales, 0.0f } };
+        for (int pc = 0; pc < 12; ++pc)
+        {
+            changes.push_back ({ lynxtune::noteC + pc, ((learned >> pc) & 1u) != 0 ? 1.0f : 0.0f });
+            changes.push_back ({ lynxtune::bypassC + pc, 0.0f });
+        }
+        setParams (changes);
+    }
+    bool learning = false;
+    unsigned learned = 0;
+
     // AUTO KEY: the key and major / minor scale of what was sung while the editor was open (time per pitch class)
     void autoKey (juce::Rectangle<float> r)
     {
@@ -3139,6 +3173,7 @@ private:
     void timerCallback() override
     {
         if (! isShowing()) return; // a hidden editor costs nothing
+        learnScaleFromMidi();
         // an idle display (silent track: meters unchanged for longer than the longest history) is not redrawn
         float meters = 0.0f;
         for (int k = 0; k < 6; ++k) meters += liveMeter (k) * (float) (k + 1);

+ 279 - 57
src/ui/ProEditors.cpp

@@ -83,7 +83,7 @@ public:
     ApexEditor (AudioEngine& e, int t, int s, bool d) : ProEditor (e, t, s, EffectKind::apexLimiter, d, 950, 600) { fillDemo(); }
 
 private:
-    enum { idPanel = 1, idGain, idCeiling, idTp, idAdvanced };
+    enum { idPanel = 1, idGain, idCeiling, idTp, idAdvanced, idLoudness, idLoudReset };
     bool panelOpen = true, advancedOpen = false;
     static constexpr const char* styles = "Clean|Glue|Punch|Dynamic|Dense|Loud|Bus|Safe";
 
@@ -105,6 +105,57 @@ private:
     float outHold = -120.0f, grHold = 0.0f;
     int holdAge = 0;
 
+    // round 135: the display modes (Fast = 10 ms a pixel, Slow = 30 ms, Slow down = recent fast and the past
+    // compressed, Infinite = 0.5 s a pixel from a long history, Off = meters only) and the loudness panel
+    int displayMode() const { return apex::displayMode (v (apex::pDisplayMode)); }
+    bool loudnessShown() const { return v (apex::pLoudnessShown) >= 0.5f; }
+    bool truePeakMeter() const { return v (apex::pPeakMeter) >= 0.5f; }
+    static constexpr int longSpan = 50; // history columns (10 ms) per column of the infinite history
+    std::vector<Column> longHistory = std::vector<Column> ((std::size_t) historyLength);
+    int longPos = 0, longCount = 0, seenPos = 0;
+    Column longAcc;
+    static void merge (Column& into, const Column& c)
+    {
+        into.in = juce::jmax (into.in, c.in);
+        into.out = juce::jmax (into.out, c.out);
+        into.gr = juce::jmax (into.gr, c.gr);
+    }
+    // the columns drawn, newest first (one per pixel)
+    std::vector<Column> view (int n) const
+    {
+        std::vector<Column> out ((std::size_t) juce::jmax (0, n));
+        const auto mode = displayMode();
+        if (mode == 0)
+        {
+            for (int k = 0; k < n; ++k) out[(std::size_t) k] = columnBack (k);
+            return out;
+        }
+        if (mode == 3 && ! demo)
+        {
+            for (int k = 0; k < n; ++k)
+            {
+                auto c = longHistory[(std::size_t) ((longPos - 1 - k + historyLength * 4) % historyLength)];
+                if (k == 0) merge (c, longAcc);
+                out[(std::size_t) k] = c;
+            }
+            return out;
+        }
+        // Slow: 3 columns a pixel; Slow down: 1 column a pixel at the right edge, the span growing to the left
+        // (demo snapshots show the infinite mode as Slow)
+        double start = 0.0;
+        for (int k = 0; k < n; ++k)
+        {
+            const double span = mode == 2 ? 1.0 + 3.0 * ((double) k / juce::jmax (1, n)) * ((double) k / juce::jmax (1, n)) : 3.0;
+            const auto a = (int) start, b = juce::jmax (a + 1, (int) (start + span));
+            Column c { -120.0f, -120.0f, 0.0f };
+            for (int j = a; j < b && j < historyLength; ++j) merge (c, columnBack (j));
+            out[(std::size_t) k] = c;
+            start += span;
+        }
+        return out;
+    }
+    juce::Rectangle<float> loudnessArea() const { return bodyArea().withTrimmedLeft (bodyArea().getWidth() - 196.0f).reduced (6.0f, 8.0f); }
+
     juce::String title() const override { return "Apex Limiter"; }
     juce::String gestures() const override { return tr ("Drag GAIN on the left  -  drag the red ceiling line  -  wheel on the display: gain"); }
     bool usesHistory() const override { return true; }
@@ -113,7 +164,7 @@ private:
     double gainDb() const { return apex::gainDb (v (0)); }
     double ceilingDb() const { return apex::ceilingDb (v (1)); }
 
-    juce::Rectangle<float> display() const { return bodyArea().withTrimmedRight (104.0f); }
+    juce::Rectangle<float> display() const { return bodyArea().withTrimmedRight (104.0f + (loudnessShown() ? 196.0f : 0.0f)); }
     juce::Rectangle<float> plot() const { return display().withTrimmedTop (14.0f).withTrimmedBottom (6.0f); }
     juce::Rectangle<float> gainTrack() const
     {
@@ -150,6 +201,23 @@ private:
                                tr ("Output ceiling: drag up or down (the bottom bar's Out does the same)")));
         out.push_back (button ({ d.getRight() - 46.0f, d.getBottom() - 26.0f, 40.0f, 20.0f }, idTp, "TP", v (5) >= 0.5f,
                                tr ("True peak: the ceiling also holds between the samples (4x interpolation)")));
+        out.push_back (button ({ d.getRight() - 232.0f, d.getY() + 18.0f, 84.0f, 20.0f }, idLoudness, tr ("Loudness"), loudnessShown(),
+                               tr ("Loudness meter: momentary, short term and integrated LUFS, loudness range, peak")));
+        {
+            auto dm = menu ({ d.getRight() - 210.0f, d.getBottom() - 26.0f, 86.0f, 20.0f }, apex::pDisplayMode, {}, "Fast|Slow|Slow down|Infinite|Off");
+            dm.hint = tr ("Display speed: Fast, Slow, Slow down (the past compressed), Infinite (the whole take), Off (meters only)");
+            out.push_back (dm);
+        }
+        if (loudnessShown())
+        {
+            const auto la = loudnessArea();
+            auto tgt = menu ({ la.getRight() - 84.0f, la.getY() + 4.0f, 80.0f, 20.0f }, apex::pLoudnessTarget, {}, "-23 LUFS|-18 LUFS|-16 LUFS|-14 LUFS|-11 LUFS|-9 LUFS");
+            tgt.hint = tr ("Loudness target: the line on the loudness bars");
+            out.push_back (tgt);
+            out.push_back (tabs ({ la.getX() + 4.0f, la.getBottom() - 54.0f, la.getWidth() - 8.0f, 22.0f }, apex::pPeakMeter, "Sample peak|True peak"));
+            out.push_back (button ({ la.getX() + 4.0f, la.getBottom() - 26.0f, la.getWidth() - 8.0f, 22.0f }, idLoudReset, tr ("Reset"), false,
+                                   tr ("Reset the integrated loudness, the range and the peak hold")));
+        }
         if (panelOpen)
         {
             const auto p = panel();
@@ -162,13 +230,16 @@ private:
             out.push_back (knob ({ p.getX() + 428.0f, p.getY() + 22.0f, 80.0f, 72.0f }, apex::pLinkRelease, tr ("Release")));
             out.push_back (button ({ p.getRight() - 30.0f, p.getY() + 4.0f, 26.0f, p.getHeight() - 8.0f }, idAdvanced,
                                    juce::String::fromUTF8 (advancedOpen ? "\xc2\xab" : "\xc2\xbb"), advancedOpen,
-                                   tr ("Advanced: DC offset filter, unity gain, audition limiting")));
+                                   tr ("Advanced: DC offset filter, unity gain, audition limiting, side-chain triggering")));
             if (advancedOpen)
             {
                 const auto ad = advanced();
-                out.push_back (toggle ({ ad.getX() + 10.0f, ad.getY() + 24.0f, ad.getWidth() - 20.0f, 20.0f }, apex::pDcFilter, tr ("DC offset filter")));
-                out.push_back (toggle ({ ad.getX() + 10.0f, ad.getY() + 48.0f, ad.getWidth() - 20.0f, 20.0f }, apex::pUnity, tr ("Unity gain")));
-                out.push_back (toggle ({ ad.getX() + 10.0f, ad.getY() + 72.0f, ad.getWidth() - 20.0f, 20.0f }, apex::pAudition, tr ("Audition limiting")));
+                out.push_back (toggle ({ ad.getX() + 10.0f, ad.getY() + 22.0f, ad.getWidth() - 20.0f, 17.0f }, apex::pDcFilter, tr ("DC offset filter")));
+                out.push_back (toggle ({ ad.getX() + 10.0f, ad.getY() + 40.0f, ad.getWidth() - 20.0f, 17.0f }, apex::pUnity, tr ("Unity gain")));
+                out.push_back (toggle ({ ad.getX() + 10.0f, ad.getY() + 58.0f, ad.getWidth() - 20.0f, 17.0f }, apex::pAudition, tr ("Audition limiting")));
+                auto sc = toggle ({ ad.getX() + 10.0f, ad.getY() + 76.0f, ad.getWidth() - 20.0f, 17.0f }, apex::pSidechain, tr ("Side-chain triggering"));
+                sc.hint = tr ("The limiter reacts to the slot's side-chain input (mixer: right-click the slot - Side chain)");
+                out.push_back (sc);
             }
         }
         else
@@ -182,9 +253,10 @@ private:
         }
         const auto b = barArea();
         const auto cy = b.getCentreY();
-        out.push_back (barMenu ({ 10.0f, cy - 11.0f, 190.0f, 22.0f }, apex::pTruePeak, tr ("True peak limiting"), "Off|On"));
-        out.push_back (barMenu ({ 206.0f, cy - 11.0f, 140.0f, 22.0f }, apex::pDither, tr ("Dither"), "Off|16 bits|18 bits|20 bits|22 bits|24 bits"));
-        out.push_back (barMenu ({ 352.0f, cy - 11.0f, 180.0f, 22.0f }, apex::pShaping, tr ("Noise shaping"), "None|Basic|Optimized|Weighted"));
+        out.push_back (barMenu ({ 10.0f, cy - 11.0f, 160.0f, 22.0f }, apex::pTruePeak, tr ("True peak limiting"), "Off|On"));
+        out.push_back (barMenu ({ 176.0f, cy - 11.0f, 130.0f, 22.0f }, apex::pDither, tr ("Dither"), "Off|16 bits|18 bits|20 bits|22 bits|24 bits"));
+        out.push_back (barMenu ({ 312.0f, cy - 11.0f, 160.0f, 22.0f }, apex::pShaping, tr ("Noise shaping"), "None|Basic|Optimized|Weighted"));
+        out.push_back (barMenu ({ 478.0f, cy - 11.0f, 150.0f, 22.0f }, apex::pOversampling, tr ("Oversampling"), "Off|2x|4x|8x"));
         out.push_back (barValue ({ b.getRight() - 150.0f, cy - 11.0f, 140.0f, 22.0f }, 1, tr ("Out")));
         out.push_back (barValue ({ b.getRight() - 300.0f, cy - 11.0f, 140.0f, 22.0f }, 0, tr ("Gain")));
     }
@@ -200,6 +272,8 @@ private:
         if (c.id == idPanel) panelOpen = ! panelOpen;
         if (c.id == idAdvanced) advancedOpen = ! advancedOpen;
         if (c.id == idTp) set ({ { 5, v (5) >= 0.5f ? 0.0f : 1.0f } });
+        if (c.id == idLoudness) set ({ { apex::pLoudnessShown, loudnessShown() ? 0.0f : 1.0f } });
+        if (c.id == idLoudReset) set ({ { apex::pLoudnessReset, v (apex::pLoudnessReset) >= 0.5f ? 0.0f : 1.0f } }, false);
         repaint();
     }
 
@@ -260,8 +334,21 @@ private:
     {
         const auto& c = columnBack (0);
         if (++holdAge > 60) { outHold = -120.0f; grHold = 0.0f; holdAge = 0; }
-        outHold = juce::jmax (outHold, c.out);
+        outHold = juce::jmax (outHold, truePeakMeter() && ! demo ? dbOf (liveMeter (3)) : c.out);
         grHold = juce::jmax (grHold, c.gr);
+        // the infinite history: one column per 0.5 s (the loudest of its 50 columns)
+        for (int guard = 0; seenPos != historyPos && guard < historyLength; ++guard)
+        {
+            merge (longAcc, history[(std::size_t) seenPos]);
+            seenPos = (seenPos + 1) % historyLength;
+            if (++longCount >= longSpan)
+            {
+                longHistory[(std::size_t) longPos] = longAcc;
+                longPos = (longPos + 1) % historyLength;
+                longAcc = { -120.0f, -120.0f, 0.0f };
+                longCount = 0;
+            }
+        }
     }
 
     void paintBody (juce::Graphics& g, const EffectSlot& fx) override
@@ -270,7 +357,8 @@ private:
         const auto p = plot();
         displayBackground (g, bodyArea());
         // the history, newest at the right edge
-        const auto n = (int) p.getWidth();
+        const auto n = displayMode() == 4 ? 0 : (int) p.getWidth();
+        const auto cols = view (n);
         const auto gain = (float) gainDb();
         juce::Path inPath, outPath, grPath, outLine;
         inPath.startNewSubPath (p.getRight(), p.getBottom());
@@ -278,7 +366,7 @@ private:
         grPath.startNewSubPath (p.getRight(), p.getY());
         for (int k = 0; k < n; ++k)
         {
-            const auto& c = columnBack (k);
+            const auto& c = cols[(std::size_t) k];
             const auto x = p.getRight() - (float) k;
             inPath.lineTo (x, scaleNow().y (c.in + gain, p));
             outPath.lineTo (x, scaleNow().y (c.out, p));
@@ -296,6 +384,12 @@ private:
         g.strokePath (outLine, juce::PathStrokeType (1.0f)); // (no glow on the 100-column-a-second history: it is redrawn at 30 Hz)
         fillLevel (g, grPath, colour::accent, p, fx.enabled ? 0.8f : 0.25f, fx.enabled ? 0.35f : 0.1f);
         drawScale (g, p, d.getRight() + 6.0f);
+        if (n == 0)
+        {
+            g.setColour (colour::textDisabled);
+            g.setFont (font (type::small));
+            g.drawText (tr ("Display off"), p.withTrimmedBottom (p.getHeight() * 0.5f), juce::Justification::centred, false);
+        }
 
         // the biggest reductions, tagged (one tag per 1.5 s at most)
         g.setFont (font (type::caption, true));
@@ -304,7 +398,7 @@ private:
             int best = -1;
             float bestGr = 1.0f;
             for (int k = k0; k < k0 + 150; ++k)
-                if (columnBack (k).gr > bestGr) { bestGr = columnBack (k).gr; best = k; }
+                if (cols[(std::size_t) k].gr > bestGr) { bestGr = cols[(std::size_t) k].gr; best = k; }
             if (best < 0) continue;
             const auto x = p.getRight() - (float) best;
             const auto r = juce::Rectangle<float> (46.0f, 16.0f).withCentre ({ x, scaleNow().y (-bestGr, p) + 12.0f });
@@ -347,7 +441,7 @@ private:
         const auto outR = m.withWidth (22.0f);
         const auto grR = m.withTrimmedLeft (28.0f);
         const auto newest = columnBack (0);
-        const auto outY = scaleNow().y (newest.out, p);
+        const auto outY = scaleNow().y (truePeakMeter() && ! demo ? dbOf (liveMeter (3)) : newest.out, p);
         skin::meterSolid (g, outR, (outR.getBottom() - outY) / outR.getHeight(), outColour(), false);
         skin::meterSolid (g, grR, (scaleNow().y (-newest.gr, p) - grR.getY()) / grR.getHeight(), colour::accent, true);
         g.setColour (colour::bg0.withAlpha (0.5f));
@@ -376,11 +470,63 @@ private:
                 caption (g, { ad.getX(), ad.getY() + 6.0f, ad.getWidth(), 14.0f }, tr ("Advanced"));
             }
         }
-        // latency (constant: the maximum look-ahead)
-        g.setColour (colour::textDisabled);
+        // latency (constant: the maximum look-ahead, + the oversampler)
+        {
+            // on a dark plate at the top left of the display, right of the GAIN slider
+            const auto lr = juce::Rectangle<float> (p.getX() + 64.0f, p.getY() + 2.0f, 132.0f, 15.0f);
+            g.setColour (colour::bg0.withAlpha (0.7f));
+            g.fillRoundedRectangle (lr, 3.0f);
+            g.setColour (colour::textSecondary);
+            g.setFont (font (type::caption));
+            g.drawText (tr ("latency {0} samples", { juce::String (apex::latencyFor (48000.0, apex::oversamplingFactor (v (apex::pOversampling)))) }),
+                        lr.reduced (5.0f, 0.0f), juce::Justification::centredLeft, true);
+        }
+        if (loudnessShown()) paintLoudness (g);
+    }
+
+    // the loudness panel (round 135): short-term and momentary bars with the target line, integrated / range / peak
+    void paintLoudness (juce::Graphics& g)
+    {
+        const auto la = loudnessArea();
+        drawPanel (g, la);
+        caption (g, { la.getX() + 6.0f, la.getY() + 7.0f, 90.0f, 14.0f }, tr ("Loudness"), juce::Justification::centredLeft);
+        auto lufs = [this] (int k, float demoValue) { return demo ? demoValue : liveMeter (k); };
+        const auto momentary = lufs (1, -11.8f), shortTerm = lufs (4, -12.6f), integrated = lufs (5, -13.1f), range = lufs (6, 5.4f), peak = lufs (7, -0.3f);
+        const auto target = (float) apex::loudnessTarget (v (apex::pLoudnessTarget));
+        // the bars: −48 … 0 LUFS
+        const auto bars = juce::Rectangle<float> (la.getX() + 10.0f, la.getY() + 34.0f, 64.0f, la.getHeight() - 34.0f - 64.0f);
+        auto bar = [&] (juce::Rectangle<float> r, float l, const juce::String& name) {
+            const auto f = juce::jlimit (0.0f, 1.0f, (l + 48.0f) / 48.0f);
+            skin::meterSolid (g, r.withTrimmedBottom (14.0f), f, l > target + 1.0f ? colour::accent : outColour(), false);
+            caption (g, r.withTop (r.getBottom() - 13.0f), name);
+        };
+        bar (bars.withWidth (26.0f), shortTerm, "S");
+        bar (bars.withTrimmedLeft (34.0f).withWidth (26.0f), momentary, "M");
+        const auto meterH = bars.getHeight() - 14.0f;
+        const auto ty = bars.getY() + meterH * (1.0f - juce::jlimit (0.0f, 1.0f, (target + 48.0f) / 48.0f));
+        g.setColour (colour::textPrimary.withAlpha (0.8f));
+        g.drawHorizontalLine ((int) ty, bars.getX() - 3.0f, bars.getRight() + 3.0f);
         g.setFont (font (type::caption));
-        g.drawText (tr ("latency {0} samples", { juce::String (apex::latencyAt (48000.0)) }), juce::Rectangle<float> (540.0f, barArea().getY(), 108.0f, barH),
-                    juce::Justification::centredLeft, true);
+        g.setColour (colour::textDisabled);
+        for (int m = 0; m >= -48; m -= 12)
+            g.drawText (juce::String (m), juce::Rectangle<float> (bars.getRight() + 2.0f, bars.getY() + meterH * (float) -m / 48.0f - 6.0f, 22.0f, 12.0f), juce::Justification::centredLeft, false);
+        // the read-outs
+        auto readout = [&] (float y, const juce::String& name, float value, const juce::String& unit, bool big) {
+            const auto x = bars.getRight() + 26.0f, w = la.getRight() - x - 6.0f;
+            g.setColour (colour::textDisabled);
+            g.setFont (font (type::caption));
+            g.drawText (name, juce::Rectangle<float> (x, y, w, 12.0f), juce::Justification::centredLeft, false);
+            g.setColour (colour::textPrimary);
+            g.setFont (font (big ? type::title : type::small, true));
+            g.drawText (value <= -100.0f ? juce::String ("-inf") : juce::String (value, 1) + " " + unit, juce::Rectangle<float> (x, y + 12.0f, w, big ? 22.0f : 16.0f),
+                        juce::Justification::centredLeft, false);
+        };
+        auto y = bars.getY();
+        readout (y, tr ("Integrated"), integrated, "LUFS", true); y += 40.0f;
+        readout (y, tr ("Short term"), shortTerm, "LUFS", false); y += 32.0f;
+        readout (y, tr ("Momentary"), momentary, "LUFS", false); y += 32.0f;
+        readout (y, tr ("Range"), range, "LU", false); y += 32.0f;
+        readout (y, truePeakMeter() ? tr ("True peak") : tr ("Peak"), peak, truePeakMeter() ? "dBTP" : "dB", false);
     }
 
     void paintCustom (juce::Graphics&, const Ctl&) override {}
@@ -523,8 +669,10 @@ private:
         out.push_back (custom (outMeter().expanded (4.0f, 28.0f), idOutMeter, -1, tr ("Output level (peak, dBFS): the lamp lights when the output clips, the number holds the highest peak; click to reset")));
         const auto b = barArea();
         const auto cy = b.getCentreY();
-        out.push_back (barMenu ({ 10.0f, cy - 11.0f, 180.0f, 22.0f }, P ("Band detector"), tr ("Detection"), "High-pass|Band", { 0.0f, 1.0f }));
-        out.push_back (barValue ({ 200.0f, cy - 11.0f, 150.0f, 22.0f }, P ("Release"), tr ("Release")));
+        out.push_back (barMenu ({ 10.0f, cy - 11.0f, 150.0f, 22.0f }, P ("Band detector"), tr ("Detection"), "High-pass|Band", { 0.0f, 1.0f }));
+        out.push_back (barValue ({ 166.0f, cy - 11.0f, 130.0f, 22.0f }, P ("Release"), tr ("Release")));
+        // round 135: oversampling (the reference's bottom bar; Hush's own voicing)
+        out.push_back (barMenu ({ 302.0f, cy - 11.0f, 124.0f, 22.0f }, P ("Oversampling"), tr ("Oversampling"), "Off|2x|4x|8x"));
         out.push_back (barValue ({ b.getRight() - 290.0f, cy - 11.0f, 130.0f, 22.0f }, P ("Input"), tr ("In")));
         out.push_back (barValue ({ b.getRight() - 150.0f, cy - 11.0f, 140.0f, 22.0f }, P ("Output"), tr ("Out")));
     }
@@ -863,6 +1011,9 @@ private:
                 out.push_back (menu ({ 216.0f, s.getY() + 16.0f + 46.0f * (float) b, 92.0f, 22.0f }, scParam (b, 0), {},
                                      "Off|Bell|Low shelf|High shelf|Low cut|High cut|Notch|Band pass|Tilt shelf"));
             out.push_back (custom (scEqArea(), idScNode0, -1, tr ("Detector EQ: drag a node (frequency / gain), wheel = Q")));
+            // round 135: the wet (compressed) and dry paths' stereo balance, at the panel's right end
+            out.push_back (knob ({ s.getRight() - 136.0f, s.getY() + 14.0f, 62.0f, 82.0f }, wetPan, tr ("Wet pan"), 0, true));
+            out.push_back (knob ({ s.getRight() - 70.0f, s.getY() + 14.0f, 62.0f, 82.0f }, dryPan, tr ("Dry pan"), 0, true));
         }
         const auto b = barArea();
         const auto cy = b.getCentreY();
@@ -877,7 +1028,7 @@ private:
     juce::Rectangle<float> scEqArea() const
     {
         const auto s = scPanel();
-        return { 320.0f, s.getY() + 10.0f, s.getWidth() - 334.0f, s.getHeight() - 20.0f };
+        return { 320.0f, s.getY() + 10.0f, s.getWidth() - 334.0f - 140.0f, s.getHeight() - 20.0f };
     }
     float scX (double hz) const
     {
@@ -1144,7 +1295,8 @@ private:
         }
         const auto b = barArea();
         const auto cy = b.getCentreY();
-        out.push_back (barMenu ({ 10.0f, cy - 11.0f, 140.0f, 22.0f }, lookaheadOn, tr ("Lookahead"), "Off|On"));
+        // round 135: the oversampling menu (Pro-G's bottom bar); the look-ahead switch stays under its knob
+        out.push_back (barMenu ({ 10.0f, cy - 11.0f, 140.0f, 22.0f }, oversampling, tr ("Oversampling"), "Off|2x|4x|8x"));
         out.push_back (barMenu ({ 155.0f, cy - 11.0f, 145.0f, 22.0f }, scExternal, tr ("Side chain"), "Internal|External"));
         out.push_back (barMenu ({ 305.0f, cy - 11.0f, 150.0f, 22.0f }, channelMode, tr ("Channel mode"), "Left/Right|Mid/Side"));
         out.push_back (barValue ({ b.getRight() - 275.0f, cy - 11.0f, 128.0f, 22.0f }, input, tr ("In")));
@@ -1326,10 +1478,10 @@ private:
     double rangeView = 12.0;
     int analyzer = 3; // 0 off, 1 pre, 2 post, 3 pre + post (view only)
     juce::Point<float> dragStart;
-    float dragX0[3] {};
+    float dragX0[dyn::prism::bands - 1] {};
 
     juce::String title() const override { return "Prism Multiband"; }
-    juce::String gestures() const override { return tr ("Drag a node: range (up / down), band (left / right)  -  drag an edge: crossover  -  wheel: threshold"); }
+    juce::String gestures() const override { return tr ("Drag a node: range (up / down), band (left / right)  -  drag an edge: crossover  -  double-click: new band  -  wheel: threshold"); }
     bool usesSpectrum() const override { return analyzer > 0; }
 
     juce::Rectangle<float> plot() const { return bodyArea().withTrimmedRight (74.0f).withTrimmedTop (8.0f).withTrimmedBottom (24.0f); }
@@ -1341,14 +1493,71 @@ private:
 
     static int bp (int b, int f) { return dyn::prism::param (b, f); }
     bool bandOn (int b) const { return v (bp (b, dyn::prism::fEnabled)) >= 0.5f; }
-    double xoHz (int i) const { return dyn::prism::crossoverHz (v (dyn::prism::xover1 + i)); }
-    float edgeX (int i) const // 0 … 4
+    // round 135: up to six bands (the band count); a double-click splits a band, the band menu removes one
+    int nb() const
+    {
+        const auto* fx = current();
+        return fx != nullptr ? dyn::prism::bandCount (fx->params) : dyn::prism::legacyBands;
+    }
+    double xoHz (int i) const
+    {
+        const auto* fx = current();
+        return fx != nullptr ? dyn::prism::crossovers (fx->params)[(std::size_t) i] : dyn::prism::crossoverHz (v (dyn::prism::crossoverParam (i)));
+    }
+    float edgeX (int i) const // 0 … band count
     {
         const auto p = plot();
         if (i <= 0) return p.getX();
-        if (i >= 4) return p.getRight();
+        if (i >= nb()) return p.getRight();
         return xForHz (xoHz (i - 1), p);
     }
+    // every per-band parameter of band b (fields, look-ahead, pan)
+    static std::vector<int> bandParams (int b)
+    {
+        std::vector<int> out;
+        for (int f = 0; f < dyn::prism::fieldsPerBand; ++f) out.push_back (bp (b, f));
+        out.push_back (dyn::prism::bandLookaheadParam (b));
+        out.push_back (dyn::prism::bandPanParam (b));
+        return out;
+    }
+    // split band b at `hz`: the bands above move up one, the new band (b + 1) starts as a copy of b
+    void splitBand (int b, double hz)
+    {
+        using namespace dyn::prism;
+        const auto n = nb();
+        if (n >= bands || b < 0 || b >= n) return;
+        const auto lo = b > 0 ? xoHz (b - 1) * 1.08 : 30.0, hi = b < n - 1 ? xoHz (b) / 1.08 : 18000.0;
+        if (lo >= hi) return;
+        std::vector<std::pair<int, float>> c;
+        for (int k = n - 1; k >= b; --k)
+        {
+            const auto from = bandParams (k), to = bandParams (k + 1);
+            for (std::size_t j = 0; j < from.size(); ++j) c.push_back ({ to[j], v (from[j]) });
+        }
+        for (int k = n - 2; k >= b; --k) c.push_back ({ crossoverParam (k + 1), v (crossoverParam (k)) });
+        c.push_back ({ crossoverParam (b), crossoverValue (juce::jlimit (lo, hi, hz)) });
+        c.push_back ({ bandCountParam, bandCountValue (n + 1) });
+        set (c);
+        selected = b + 1;
+    }
+    // remove band b: the bands above move down one, its neighbour takes its range
+    void removeBand (int b)
+    {
+        using namespace dyn::prism;
+        const auto n = nb();
+        if (n <= 1 || b < 0 || b >= n) return;
+        std::vector<std::pair<int, float>> c;
+        for (int k = b; k < n - 1; ++k)
+        {
+            const auto from = bandParams (k + 1), to = bandParams (k);
+            for (std::size_t j = 0; j < from.size(); ++j) c.push_back ({ to[j], v (from[j]) });
+        }
+        const auto gone = b < n - 1 ? b : b - 1; // the crossover that disappears
+        for (int k = gone; k < n - 2; ++k) c.push_back ({ crossoverParam (k), v (crossoverParam (k + 1)) });
+        c.push_back ({ bandCountParam, bandCountValue (n - 1) });
+        set (c);
+        selected = juce::jmin (b, n - 2);
+    }
     float gainY (double db) const
     {
         const auto p = plot();
@@ -1370,35 +1579,35 @@ private:
     }
     int nodeAt (juce::Point<float> p) const
     {
-        for (int b = 0; b < dyn::prism::bands; ++b)
+        for (int b = 0; b < nb(); ++b)
             if (node (b).getDistanceFrom (p) < 11.0f) return b;
         return -1;
     }
     int edgeAt (juce::Point<float> p) const
     {
         if (! plot().contains (p)) return -1;
-        for (int i = 1; i <= 3; ++i)
+        for (int i = 1; i < nb(); ++i)
             if (std::abs (edgeX (i) - p.x) < 5.0f) return i;
         return -1;
     }
     int bandAtX (float x) const
     {
-        for (int b = 0; b < dyn::prism::bands; ++b)
+        for (int b = 0; b < nb(); ++b)
             if (x < edgeX (b + 1)) return b;
-        return dyn::prism::bands - 1;
+        return nb() - 1;
     }
 
     double liveDb (int b) const
     {
         if (demo) return b == 1 ? -4.5 : b == 2 ? -2.0 : b == 3 ? 1.5 : -1.0;
-        return bandOn (b) ? (double) liveMeter (b) * 30.0 : 0.0;
+        return bandOn (b) ? (double) liveMeter (dyn::prism::bandMeter (b)) * 30.0 : 0.0;
     }
 
     void layoutControls (std::vector<Ctl>& out) const override
     {
         using namespace dyn::prism;
         const auto p = plot();
-        for (int b = 0; b < bands; ++b)
+        for (int b = 0; b < nb(); ++b)
         {
             const auto x = edgeX (b) + 4.0f;
             if (edgeX (b + 1) - edgeX (b) < 40.0f) continue;
@@ -1422,7 +1631,8 @@ private:
             add (tabs ({ a.getX() + 86.0f, a.getY() + 128.0f, 184.0f, 26.0f }, bp (b, fMode), "Compress|Expand"));
             add (knob ({ a.getX() + 290.0f, a.getY() + 112.0f, 66.0f, 54.0f }, bp (b, fRatio), tr ("Ratio"), 0));
             add (knob ({ a.getX() + 366.0f, a.getY() + 112.0f, 66.0f, 54.0f }, bp (b, fKnee), tr ("Knee"), 0));
-            add (knob ({ a.getX() + 446.0f, a.getY() + 112.0f, 66.0f, 54.0f }, bandLookahead0 + b, tr ("Lookahead"), 0));
+            add (knob ({ a.getX() + 446.0f, a.getY() + 112.0f, 66.0f, 54.0f }, bandLookaheadParam (b), tr ("Lookahead"), 0));
+            add (knob ({ a.getX() + 522.0f, a.getY() + 112.0f, 66.0f, 54.0f }, bandPanParam (b), tr ("Pan"), 0, true)); // round 135: the band's output balance
             out.push_back (button ({ a.getRight() - 72.0f, a.getY() + 8.0f, 20.0f, 20.0f }, idPrev, "<", false, tr ("Previous / next band")));
             out.push_back (button ({ a.getRight() - 50.0f, a.getY() + 8.0f, 20.0f, 20.0f }, idNext, ">", false, tr ("Previous / next band")));
             out.push_back (button ({ a.getRight() - 26.0f, a.getY() + 8.0f, 20.0f, 20.0f }, idClose, "x", false, tr ("Close the band panel (click on the empty display does the same)")));
@@ -1430,20 +1640,22 @@ private:
         const auto bar = barArea();
         const auto cy = bar.getCentreY();
         static const char* const analyzerNames[] { TR_NOOP ("Off"), TR_NOOP ("Pre"), TR_NOOP ("Post"), TR_NOOP ("Pre + Post") };
-        out.push_back (barMenu ({ 10.0f, cy - 11.0f, 170.0f, 22.0f }, slope, tr ("Crossover"), "12 dB/oct|24 dB/oct|48 dB/oct"));
-        out.push_back (barValue ({ 190.0f, cy - 11.0f, 150.0f, 22.0f }, lookahead, tr ("Lookahead")));
-        out.push_back (button ({ 350.0f, cy - 11.0f, 160.0f, 22.0f }, idAnalyzer, tr ("Analyzer:") + " " + tr (analyzerNames[analyzer]) + (specFrozen ? " *" : ""), false,
+        out.push_back (barMenu ({ 10.0f, cy - 11.0f, 150.0f, 22.0f }, slope, tr ("Crossover"), "12 dB/oct|24 dB/oct|48 dB/oct"));
+        out.push_back (barValue ({ 166.0f, cy - 11.0f, 130.0f, 22.0f }, lookahead, tr ("Lookahead")));
+        out.push_back (button ({ 302.0f, cy - 11.0f, 150.0f, 22.0f }, idAnalyzer, tr ("Analyzer:") + " " + tr (analyzerNames[analyzer]) + (specFrozen ? " *" : ""), false,
                                tr ("Spectrum analyzer: off, pre, post or pre + post; speed; freeze")));
-        out.push_back (barValue ({ bar.getRight() - 390.0f, cy - 11.0f, 110.0f, 22.0f }, mix, tr ("Mix")));
-        out.push_back (barValue ({ bar.getRight() - 270.0f, cy - 11.0f, 120.0f, 22.0f }, input, tr ("In")));
-        out.push_back (barValue ({ bar.getRight() - 140.0f, cy - 11.0f, 130.0f, 22.0f }, output, tr ("Out")));
+        // round 135: the detectors on the slot's side chain (mixer: right-click the slot - Side chain)
+        out.push_back (barMenu ({ 458.0f, cy - 11.0f, 116.0f, 22.0f }, scExternal, tr ("Side chain"), "Int|Ext"));
+        out.push_back (barValue ({ bar.getRight() - 340.0f, cy - 11.0f, 96.0f, 22.0f }, mix, tr ("Mix")));
+        out.push_back (barValue ({ bar.getRight() - 238.0f, cy - 11.0f, 110.0f, 22.0f }, input, tr ("In")));
+        out.push_back (barValue ({ bar.getRight() - 122.0f, cy - 11.0f, 112.0f, 22.0f }, output, tr ("Out")));
     }
 
     void buttonPressed (const Ctl& c, const juce::MouseEvent&) override
     {
         using namespace dyn::prism;
-        if (c.id == idPrev) selected = (selected + bands - 1) % bands;
-        else if (c.id == idNext) selected = (selected + 1) % bands;
+        if (c.id == idPrev) selected = (selected + nb() - 1) % nb();
+        else if (c.id == idNext) selected = (selected + 1) % nb();
         else if (c.id == idClose) selected = -1;
         else if (c.id == idRange) rangeView = rangeView >= 30.0 ? 3.0 : rangeView >= 12.0 ? 30.0 : rangeView >= 6.0 ? 12.0 : 6.0;
         else if (c.id == idAnalyzer) { showAnalyzerMenu(); return; }
@@ -1483,10 +1695,12 @@ private:
         m.addItem (tr ("Reset the band"), [this, b] {
             std::vector<std::pair<int, float>> c;
             const auto& in = effectInfo (kind);
-            for (int f = 0; f < fieldsPerBand; ++f) c.push_back ({ bp (b, f), in.params[(std::size_t) bp (b, f)].defaultValue });
-            c.push_back ({ bandLookahead0 + b, in.params[(std::size_t) (bandLookahead0 + b)].defaultValue });
+            for (const auto k : bandParams (b)) c.push_back ({ k, in.params[(std::size_t) k].defaultValue });
             set (c);
         });
+        m.addSeparator();
+        m.addItem (tr ("Split the band"), nb() < bands, false, [this, b] { splitBand (b, std::sqrt ((b > 0 ? xoHz (b - 1) : 30.0) * (b < nb() - 1 ? xoHz (b) : 18000.0))); });
+        m.addItem (tr ("Remove the band"), nb() > 1, false, [this, b] { removeBand (b); });
         m.showMenuAsync (juce::PopupMenu::Options().withTargetComponent (this));
     }
 
@@ -1504,7 +1718,7 @@ private:
             if (e.mods.isAltDown()) { set ({ { bp (b, fEnabled), 0.0f } }); return false; }
             dragBand = b;
             dragStart = p;
-            for (int i = 0; i < 3; ++i) dragX0[i] = edgeX (i + 1);
+            for (int i = 0; i < nb() - 1; ++i) dragX0[i] = edgeX (i + 1);
             return true;
         }
         if (const auto i = edgeAt (p); i > 0 && ! e.mods.isPopupMenu())
@@ -1523,9 +1737,9 @@ private:
     {
         using namespace dyn::prism;
         const auto lo = i > 1 ? edgeX (i - 1) + 12.0f : plot().getX() + 4.0f;
-        const auto hi = i < 3 ? edgeX (i + 1) - 12.0f : plot().getRight() - 4.0f;
+        const auto hi = i < nb() - 1 ? edgeX (i + 1) - 12.0f : plot().getRight() - 4.0f;
         const auto hz = hzForX (juce::jlimit (lo, hi, x), plot());
-        c.push_back ({ xover1 + i - 1, crossoverValue (juce::jlimit (30.0, 18000.0, hz)) });
+        c.push_back ({ crossoverParam (i - 1), crossoverValue (juce::jlimit (30.0, 18000.0, hz)) });
     }
 
     void bodyDrag (const juce::MouseEvent& e) override
@@ -1536,7 +1750,7 @@ private:
         {
             moveEdge (dragEdge, e.position.x, c);
             set (c);
-            ui::showValueTip (*this, juce::Rectangle<int> (16, 16).withCentre (e.position.toInt()), tr ("Crossover") + " " + text (xover1 + dragEdge - 1));
+            ui::showValueTip (*this, juce::Rectangle<int> (16, 16).withCentre (e.position.toInt()), tr ("Crossover") + " " + text (crossoverParam (dragEdge - 1)));
             return;
         }
         if (dragBand < 0) return;
@@ -1548,8 +1762,8 @@ private:
         if (std::abs (d.x) > 3.0f && ! (e.mods.isShiftDown() && std::abs (d.y) > std::abs (d.x)))
         {
             // move the band: its edges follow the mouse (the outer bands move one edge)
-            if (b > 0) c.push_back ({ xover1 + b - 1, crossoverValue (juce::jlimit (30.0, 18000.0, hzForX (dragX0[b - 1] + d.x * fine, plot()))) });
-            if (b < bands - 1) c.push_back ({ xover1 + b, crossoverValue (juce::jlimit (30.0, 18000.0, hzForX (dragX0[b] + d.x * fine, plot()))) });
+            if (b > 0) c.push_back ({ crossoverParam (b - 1), crossoverValue (juce::jlimit (30.0, 18000.0, hzForX (dragX0[b - 1] + d.x * fine, plot()))) });
+            if (b < nb() - 1) c.push_back ({ crossoverParam (b), crossoverValue (juce::jlimit (30.0, 18000.0, hzForX (dragX0[b] + d.x * fine, plot()))) });
         }
         set (c);
         ui::showValueTip (*this, juce::Rectangle<int> (16, 16).withCentre (node (b).toInt()), tr ("Band {0}", { juce::String (b + 1) }) + "  " + tr ("Range") + " " + text (bp (b, fRange)));
@@ -1559,9 +1773,16 @@ private:
     {
         using namespace dyn::prism;
         if (! plot().contains (e.position)) return false;
-        const auto b = nodeAt (e.position) >= 0 ? nodeAt (e.position) : bandAtX (e.position.x);
-        set ({ { bp (b, fEnabled), bandOn (b) ? 0.0f : 1.0f } });
-        selected = b;
+        // round 135: double-click on a node = on / off; on the empty display = a new band there (the band under the
+        // mouse splits at that frequency), as the reference creates bands anywhere
+        if (const auto nodeB = nodeAt (e.position); nodeB >= 0 || nb() >= bands)
+        {
+            const auto b = nodeB >= 0 ? nodeB : bandAtX (e.position.x);
+            set ({ { bp (b, fEnabled), bandOn (b) ? 0.0f : 1.0f } });
+            selected = b;
+            return true;
+        }
+        splitBand (bandAtX (e.position.x), hzForX (e.position.x, plot()));
         return true;
     }
 
@@ -1592,7 +1813,7 @@ private:
         else if (edgeAt (p) > 0)
             h.text = tr ("Crossover: drag left or right");
         else
-            h.text = tr ("Click a band to open its panel; double-click = band on / off");
+            h.text = tr ("Click a band to open its panel; double-click = a new band here (up to six); right-click = band menu");
         h.hasMenu = true;
         return h;
     }
@@ -1600,6 +1821,7 @@ private:
     void paintBody (juce::Graphics& g, const EffectSlot& fx) override
     {
         using namespace dyn::prism;
+        if (selected >= nb()) selected = nb() - 1; // a band removed (or a smaller preset): keep the panel on a band
         const auto p = plot();
         displayBackground (g, bodyArea());
         frequencyLabels (g, p, p.getBottom() + 12.0f);
@@ -1626,7 +1848,7 @@ private:
         }
         // the bands
         double gains[bands] {};
-        for (int b = 0; b < bands; ++b)
+        for (int b = 0; b < nb(); ++b)
         {
             const auto c = peqview::bandColour (b);
             const auto region = juce::Rectangle<float> (edgeX (b), p.getY(), edgeX (b + 1) - edgeX (b), p.getHeight());
@@ -1646,7 +1868,7 @@ private:
                 g.fillRect (region.withTop (juce::jmin (ly, gainY (0.0))).withBottom (juce::jmax (ly, gainY (0.0))));
             }
         }
-        for (int i = 1; i <= 3; ++i)
+        for (int i = 1; i < nb(); ++i)
         {
             g.setColour (std::abs (mouse.x - edgeX (i)) < 5.0f && p.contains (mouse) ? colour::textPrimary : colour::textSecondary.withAlpha (0.5f));
             const auto dashes = std::array<float, 2> { 3.0f, 3.0f };
@@ -1663,7 +1885,7 @@ private:
         }
         skin::glowStroke (g, resp, fx.enabled ? colour::warning : colour::textDisabled, 2.0f, fx.enabled ? 1.0f : 0.0f);
         // the nodes
-        for (int b = 0; b < bands; ++b)
+        for (int b = 0; b < nb(); ++b)
         {
             const auto n = node (b);
             const auto c = peqview::bandColour (b);

+ 1 - 1
tests/LookTests114.inc

@@ -29,7 +29,7 @@ TEST (look114_apex_limiter_publishes_its_meters)
     CHECK (grDb > 5.0f && grDb < 7.5f);
     CHECK (std::abs (lastIn - 0.5f) < 0.01f);
     CHECK (lastOut > 0.9f && lastOut <= std::pow (10.0f, -0.1f / 20.0f) + 1e-4f);
-    CHECK (fx->controlOutput (5) == 0.0f);
+    CHECK (fx->controlOutput (5) < 0.0f); // round 135: output 5 is the integrated loudness (LUFS)
 }
 
 TEST (look114_reverb_panels_write_captions_above_their_knobs)

+ 1 - 1
tests/Parity128Tests.inc

@@ -54,7 +54,7 @@ TEST (facet_round128_parameters_default_to_the_old_behaviour)
 {
     using namespace lynx::facet;
     const auto p = facet103::defaults();
-    CHECK (info().params.size() == 88 && paramCount == 88 && paramCount <= lynx::maxEffectParams);
+    CHECK (info().params.size() == (std::size_t) paramCount && paramCount >= 88 && characterParam == 88 && paramCount <= lynx::maxEffectParams); // round 135 appended Character
     for (int b = 0; b < bands; ++b)
     {
         CHECK (bandPower (p, b));

+ 2 - 2
tests/Parity128aTests.inc

@@ -43,7 +43,7 @@ TEST (parity128a_apex_new_controls)
     using namespace parity128a;
     const double sr = 48000.0;
     // 8 styles; the old 4-step values keep their style
-    CHECK (styleCount == 8 && info().params.size() == (std::size_t) paramCount && paramCount == 15);
+    CHECK (styleCount == 8 && info().params.size() == (std::size_t) paramCount && pMeterScale == 14 && paramCount >= 15); // round 135 appended more
     CHECK (std::string (styleName (style (0.0f))) == "Clean" && std::string (styleName (style (0.3333f))) == "Punch");
     CHECK (std::string (styleName (style (0.6667f))) == "Loud" && std::string (styleName (style (1.0f))) == "Safe");
     CHECK (paramText (pAttack, 0.0f) == "0 ms" && paramText (pAttack, 0.5f) == "625 ms" && paramText (pAttack, 1.0f) == "10.00 s");
@@ -149,7 +149,7 @@ TEST (parity128a_hush_new_controls)
     using lynx::EffectKind;
     const double sr = 44100.0;
     const int n = 44100;
-    CHECK (lynx::mixsuite::hushInfo().params.size() == (std::size_t) count && count == 18);
+    CHECK (lynx::mixsuite::hushInfo().params.size() == (std::size_t) count && display == 17 && count >= 18); // round 135 appended Oversampling
     auto p = defaults (EffectKind::hushDeEsser);
     CHECK (p[allround] == 0.0f && p[lowPass] == 1.0f && std::abs (lookaheadTimeMs (p[lookaheadTime]) - 2.0) < 1e-6 && p[stereoLink] == 1.0f && p[input] == 0.5f);
     p[threshold] = (float) (20.0 / 60.0); // −40 dBFS

+ 458 - 0
tests/Parity135fTests.inc

@@ -0,0 +1,458 @@
+// --- round 135 (parity135f): FabFilter-role parity — Apex Limiter's loudness meter, true-peak metering, oversampling and
+// side-chain triggering (docs/PARITY.md). Every new parameter is appended; its default leaves the sound unchanged.
+
+#include "core/ApexLimiter.h"
+#include "core/Loudness.h"
+#include "core/MixSuite.h"
+
+namespace parity135f
+{
+inline lynx::EffectParams defaults (lynx::EffectKind kind) { return lynx::makeEffectSlot (kind).params; }
+
+inline void sine (std::vector<float>& x, int n, double sr, double hz, double amp, double phase = 0.0)
+{
+    x.resize ((std::size_t) n);
+    for (int i = 0; i < n; ++i) x[(std::size_t) i] = (float) (amp * std::sin (2.0 * M_PI * hz * i / sr + phase));
+}
+
+inline void run (lynx::loudness::Meter& m, std::vector<float>& l, std::vector<float>& r, int block = 512)
+{
+    for (int i = 0; i < (int) l.size(); i += block)
+        m.process (l.data() + i, r.data() + i, std::min (block, (int) l.size() - i));
+}
+
+inline double db (double x) { return 20.0 * std::log10 (x); }
+} // namespace parity135f
+
+TEST (parity135f_kweighting_48k_matches_bs1770)
+{
+    lynx::loudness::Biquad a, b;
+    lynx::loudness::kWeighting (48000.0, a, b);
+    CHECK (std::abs (a.b0 - 1.53512485958697) < 1e-9 && std::abs (a.b1 + 2.69169618940638) < 1e-9 && std::abs (a.b2 - 1.19839281085285) < 1e-9);
+    CHECK (std::abs (a.a1 + 1.69065929318241) < 1e-9 && std::abs (a.a2 - 0.73248077421585) < 1e-9);
+    CHECK (std::abs (b.a1 + 1.99004745483398) < 1e-9 && std::abs (b.a2 - 0.99007225036621) < 1e-9);
+}
+
+TEST (parity135f_loudness_ebu_cases)
+{
+    using namespace parity135f;
+    for (const double sr : { 44100.0, 48000.0, 96000.0 })
+    {
+        // EBU Tech 3341 case 1: a stereo 1 kHz sine at −23 dBFS = −23.0 LUFS (M, S, I)
+        lynx::loudness::Meter m;
+        m.prepare (sr);
+        std::vector<float> l, r;
+        sine (l, (int) (20 * sr), sr, 1000.0, std::pow (10.0, -23.0 / 20.0));
+        r = l;
+        run (m, l, r);
+        std::printf ("  loudness %.0f Hz: M %.2f S %.2f I %.2f LRA %.2f\n", sr, m.momentary(), m.shortTermLoudness(), m.integratedLoudness(), m.loudnessRange());
+        CHECK (std::abs (m.momentary() + 23.0) < 0.1 && std::abs (m.shortTermLoudness() + 23.0) < 0.1 && std::abs (m.integratedLoudness() + 23.0) < 0.1);
+        CHECK (m.loudnessRange() < 0.3);
+    }
+    {
+        // case 3: −36 / −23 / −36 dBFS for 10 / 20 / 10 s → I = −23 (the relative gate drops the quiet parts)
+        const double sr = 48000.0;
+        lynx::loudness::Meter m;
+        m.prepare (sr);
+        for (const auto [secs, level] : { std::pair { 10, -36.0 }, std::pair { 20, -23.0 }, std::pair { 10, -36.0 } })
+        {
+            std::vector<float> l, r;
+            sine (l, (int) (secs * sr), sr, 1000.0, std::pow (10.0, level / 20.0));
+            r = l;
+            run (m, l, r);
+        }
+        std::printf ("  loudness gated: I %.2f\n", m.integratedLoudness());
+        CHECK (std::abs (m.integratedLoudness() + 23.0) < 0.1);
+    }
+    {
+        // EBU Tech 3342 case 1: 20 s at −20 then 20 s at −30 LUFS → LRA 10 LU (±1)
+        const double sr = 48000.0;
+        lynx::loudness::Meter m;
+        m.prepare (sr);
+        for (const double level : { -20.0, -30.0 })
+        {
+            std::vector<float> l, r;
+            sine (l, (int) (20 * sr), sr, 1000.0, std::pow (10.0, level / 20.0));
+            r = l;
+            run (m, l, r);
+        }
+        std::printf ("  loudness range: %.2f LU\n", m.loudnessRange());
+        CHECK (std::abs (m.loudnessRange() - 10.0) < 1.0);
+    }
+}
+
+TEST (parity135f_true_peak)
+{
+    using namespace parity135f;
+    // a sine at a quarter of the rate, 45° off the samples: sample peak −3 dB, true peak 0 dB
+    lynx::loudness::Meter m;
+    m.prepare (48000.0);
+    std::vector<float> l, r;
+    sine (l, 48000, 48000.0, 12000.0, 1.0, M_PI / 4.0);
+    r = l;
+    run (m, l, r);
+    std::printf ("  true peak %.2f dBTP, sample peak %.2f dB\n", m.truePeakDb(), m.samplePeakDb());
+    CHECK (std::abs (m.samplePeakDb() + 3.01) < 0.05);
+    CHECK (std::abs (m.truePeakDb()) < 0.3);
+}
+
+TEST (parity135f_apex_new_params)
+{
+    using namespace lynx::apex;
+    const auto& inf = info();
+    CHECK ((int) inf.params.size() == paramCount && paramCount == 22);
+    auto p = parity135f::defaults (lynx::EffectKind::apexLimiter);
+    CHECK (oversamplingFactor (p[pOversampling]) == 1 && p[pSidechain] < 0.5f && displayMode (p[pDisplayMode]) == 0);
+    CHECK (std::abs (loudnessTarget (p[pLoudnessTarget]) + 14.0) < 1e-9);
+    CHECK (paramText (pOversampling, 1.0f) == "8x" && paramText (pPeakMeter, 1.0f) == "True peak" && paramText (pDisplayMode, 0.75f) == "Infinite");
+    CHECK (lynx::formatEffectParam (lynx::EffectKind::apexLimiter, pLoudnessTarget, 0.0f, 120.0) == "-23 LUFS");
+}
+
+TEST (parity135f_apex_oversampling)
+{
+    using namespace lynx::apex;
+    const double sr = 48000.0;
+    for (const float os : { 0.0f, 1.0f / 3.0f, 2.0f / 3.0f, 1.0f })
+    {
+        auto p = parity135f::defaults (lynx::EffectKind::apexLimiter);
+        p[pOversampling] = os;
+        p[pGain] = 12.0f / 30.0f;
+        auto slot = lynx::makeEffectSlot (lynx::EffectKind::apexLimiter);
+        slot.params = p;
+        auto fx = lynx::makeEffect (slot);
+        CHECK (fx->latencySamples() == latencyFor (sr, oversamplingFactor (os)));
+        fx->prepare (sr);
+        const auto lat = fx->latencySamples();
+        CHECK (lat == latencyFor (sr, oversamplingFactor (os)));
+        // a hot two-tone signal: never above the ceiling (−0.1 dB)
+        std::vector<float> l, r;
+        parity135f::sine (l, 24000, sr, 997.0, 0.6);
+        parity135f::sine (r, 24000, sr, 3001.0, 0.6);
+        for (int i = 0; i < 24000; ++i) l[(std::size_t) i] += r[(std::size_t) i];
+        r = l;
+        for (int i = 0; i < 24000; i += 300) fx->process (l.data() + i, r.data() + i, 300, p, 120.0);
+        float peak = 0.0f;
+        for (int i = 4800; i < 24000; ++i) peak = std::max (peak, std::abs (l[(std::size_t) i]));
+        std::printf ("  apex oversampling %dx: latency %d, peak %.4f dB\n", oversamplingFactor (os), lat, parity135f::db (peak));
+        CHECK (peak <= std::pow (10.0, -0.1 / 20.0) * 1.0001);
+        // alignment: a quiet click comes out after exactly the reported latency
+        auto q = p;
+        q[pGain] = 0.0f;
+        fx->reset();
+        std::vector<float> a (4096, 0.0f), b (4096, 0.0f);
+        a[100] = b[100] = 0.25f;
+        fx->process (a.data(), b.data(), 4096, q, 120.0);
+        int at = 0;
+        for (int i = 1; i < 4096; ++i) if (std::abs (a[(std::size_t) i]) > std::abs (a[(std::size_t) at])) at = i;
+        CHECK (at == 100 + lat);
+    }
+}
+
+TEST (parity135f_apex_sidechain_and_meters)
+{
+    using namespace lynx::apex;
+    const double sr = 48000.0;
+    auto p = parity135f::defaults (lynx::EffectKind::apexLimiter);
+    p[pSidechain] = 1.0f;
+    auto fx = make();
+    fx->prepare (sr);
+    std::vector<float> l, r, sl, sr2;
+    parity135f::sine (l, 9600, sr, 440.0, 0.1);
+    r = l;
+    parity135f::sine (sl, 9600, sr, 440.0, 2.0); // a side chain 26 dB louder: 6 dB over the ceiling
+    sr2 = sl;
+    for (int i = 0; i < 9600; i += 480)
+    {
+        fx->setSidechain (sl.data() + i, sr2.data() + i);
+        fx->process (l.data() + i, r.data() + i, 480, p, 120.0);
+    }
+    float peak = 0.0f;
+    for (int i = 4800; i < 9600; ++i) peak = std::max (peak, std::abs (l[(std::size_t) i]));
+    std::printf ("  apex side chain: quiet programme %.2f dB, gain reduction meter %.1f dB\n", parity135f::db (peak), fx->controlOutput (0) * 30.0);
+    CHECK (peak < 0.1f * 0.6f && fx->controlOutput (0) * 30.0f > 5.0f);
+    // without a side-chain block the programme is left alone (no limiting at −20 dB)
+    for (int k = 0; k < 400; ++k) fx->process (l.data(), r.data(), 480, p, 120.0);
+    CHECK (fx->controlOutput (0) < 0.01f);
+
+    // the loudness meter on the output: a −23 dBFS 1 kHz sine, no limiting → I ≈ −23 LUFS; the reset button clears it
+    auto q = parity135f::defaults (lynx::EffectKind::apexLimiter);
+    auto g = make();
+    g->prepare (sr);
+    std::vector<float> a, b;
+    parity135f::sine (a, (int) (5 * sr), sr, 1000.0, std::pow (10.0, -23.0 / 20.0));
+    b = a;
+    for (int i = 0; i < (int) a.size(); i += 512) g->process (a.data() + i, b.data() + i, std::min (512, (int) a.size() - i), q, 120.0);
+    std::printf ("  apex loudness: M %.2f S %.2f I %.2f LRA %.2f peak %.2f\n", g->controlOutput (1), g->controlOutput (4), g->controlOutput (5), g->controlOutput (6), g->controlOutput (7));
+    CHECK (std::abs (g->controlOutput (5) + 23.0f) < 0.15f && std::abs (g->controlOutput (1) + 23.0f) < 0.15f);
+    CHECK (std::abs (g->controlOutput (7) + 23.0f) < 0.2f);
+    q[pLoudnessReset] = 1.0f;
+    std::vector<float> z (512, 0.0f), z2 (512, 0.0f);
+    g->process (z.data(), z2.data(), 512, q, 120.0);
+    CHECK (g->controlOutput (5) < -100.0f);
+}
+
+TEST (parity135f_sentry_and_hush_oversampling)
+{
+    // with oversampling on, the latency grows by the oversampler's and the result matches the base-rate one (delayed)
+    const double sr = 48000.0;
+    struct Case { lynx::EffectKind kind; int param; };
+    for (const auto c : { Case { lynx::EffectKind::sentryGate, lynx::dyn::sentry::oversampling },
+                          Case { lynx::EffectKind::hushDeEsser, lynx::mixsuite::hush::oversampling } })
+    {
+        auto slot = lynx::makeEffectSlot (c.kind);
+        CHECK (slot.params[(std::size_t) c.param] == 0.0f);
+        CHECK (lynx::formatEffectParam (c.kind, c.param, 2.0f / 3.0f, 120.0) == "4x");
+        auto base = lynx::makeEffect (slot);
+        auto q = slot;
+        q.params[(std::size_t) c.param] = 2.0f / 3.0f;
+        auto over = lynx::makeEffect (q);
+        base->prepare (sr);
+        over->prepare (sr);
+        // a bursty test signal: 3 kHz + 7 kHz bursts over a quiet floor (opens / closes the gate, triggers the de-esser)
+        const int n = 48000;
+        std::vector<float> l ((std::size_t) n), r;
+        for (int i = 0; i < n; ++i)
+        {
+            const double a = (i / 4800) % 2 == 0 ? 0.5 : 0.003;
+            l[(std::size_t) i] = (float) (a * (std::sin (2.0 * M_PI * 3000.0 * i / sr) + 0.6 * std::sin (2.0 * M_PI * 7000.0 * i / sr)));
+        }
+        r = l;
+        auto l2 = l, r2 = r;
+        for (int i = 0; i < n; i += 2000) // blocks bigger than the oversampled path's 1024 too
+        {
+            base->process (l.data() + i, r.data() + i, std::min (2000, n - i), slot.params, 120.0);
+            over->process (l2.data() + i, r2.data() + i, std::min (2000, n - i), q.params, 120.0);
+        }
+        const int extra = over->latencySamples() - base->latencySamples();
+        CHECK (extra == lynx::mixsuite::Oversampler::latency());
+        double e = 0.0, s = 0.0;
+        for (int i = 9600; i < n - extra; ++i)
+        {
+            const double d = (double) l2[(std::size_t) (i + extra)] - l[(std::size_t) i];
+            e += d * d;
+            s += (double) l[(std::size_t) i] * l[(std::size_t) i];
+        }
+        std::printf ("  %s oversampling 4x: latency +%d, difference %.1f dB\n", lynx::effectInfo (c.kind).name, extra, 10.0 * std::log10 (e / s));
+        CHECK (10.0 * std::log10 (e / s) < -20.0);
+    }
+}
+
+TEST (parity135f_prism_six_bands)
+{
+    using namespace dyn108;
+    namespace m = lynx::dyn::prism;
+    // the old parameter block keeps its indices; the new ones are appended
+    CHECK (m::bandLookahead0 == 48 && m::band5 == 52 && m::xover4 == 72 && m::bandCountParam == 76 && m::scExternal == 83 && m::count == 84);
+    CHECK ((int) lynx::effectInfo (EffectKind::prismMultiband).params.size() == m::count);
+    auto p = defaults (EffectKind::prismMultiband);
+    CHECK (m::bandCount (p) == 4 && m::param (4, m::fEnabled) == 60 && m::param (5, m::fSolo) == 71);
+    CHECK (lynx::dyn::paramText (EffectKind::prismMultiband, m::param (4, m::fThreshold), m::thresholdValue (-18.0)) == "-18.0 dB");
+    CHECK (lynx::dyn::paramText (EffectKind::prismMultiband, m::bandPanParam (2), 0.25f) == "50% L");
+    // six bands, every range at 0: the output is the input exactly (transparent at rest)
+    p[m::bandCountParam] = m::bandCountValue (6);
+    for (int b = 0; b < m::bands; ++b) p[(std::size_t) m::param (b, m::fRange)] = 0.5f;
+    std::vector<float> noise ((std::size_t) sr / 2);
+    std::uint32_t seed = 7;
+    for (auto& v : noise) { seed = seed * 1664525u + 1013904223u; v = (float) ((double) (seed >> 8) / 16777216.0 - 0.5); }
+    auto y = run (EffectKind::prismMultiband, p, noise);
+    double err = 0.0;
+    for (std::size_t i = 0; i < noise.size(); ++i) err = std::max (err, (double) std::abs (y[i] - noise[i]));
+    CHECK (err == 0.0);
+    // band 6 (above 4 kHz here) compresses a 16 kHz tone; a 1 kHz tone is left alone (tones away from the crossovers:
+    // near one, the band's phase-shifted part adds instead of cutting — the transparent structure's known limit)
+    p = defaults (EffectKind::prismMultiband);
+    p[m::bandCountParam] = m::bandCountValue (6);
+    p[m::xover1] = m::crossoverValue (100.0);
+    p[m::xover2] = m::crossoverValue (200.0);
+    p[m::xover3] = m::crossoverValue (2000.0);
+    p[m::xover4] = m::crossoverValue (3000.0);
+    p[m::xover5] = m::crossoverValue (4000.0);
+    for (int b = 0; b < m::bands; ++b) p[(std::size_t) m::param (b, m::fEnabled)] = b == 5 ? 1.0f : 0.0f;
+    p[(std::size_t) m::param (5, m::fThreshold)] = m::thresholdValue (-40.0);
+    p[(std::size_t) m::param (5, m::fRange)] = 0.0f; // −30 dB
+    auto tone = [] (double hz) {
+        std::vector<float> x ((std::size_t) sr);
+        for (std::size_t i = 0; i < x.size(); ++i) x[i] = (float) (0.3 * std::sin (2.0 * pi * hz * (double) i / sr));
+        return x;
+    };
+    auto level = [] (const std::vector<float>& x) {
+        double s = 0.0;
+        for (std::size_t i = x.size() / 2; i < x.size(); ++i) s += (double) x[i] * x[i];
+        return 10.0 * std::log10 (s / (double) (x.size() / 2) + 1e-30);
+    };
+    // (the output level of a tone this far up also depends on the crossover tree's phase there: the band's own gain
+    // meter is the check)
+    auto bandGain = [&] (double hz) {
+        auto slot = lynx::makeEffectSlot (EffectKind::prismMultiband);
+        slot.params = p;
+        auto fx = lynx::makeEffect (slot);
+        fx->prepare (sr);
+        auto x = tone (hz), r = x;
+        for (std::size_t off = 0; off < x.size(); off += 512)
+            fx->process (x.data() + off, r.data() + off, (int) std::min<std::size_t> (512, x.size() - off), p, 120.0);
+        return fx->controlOutput (m::bandMeter (5)) * 30.0f;
+    };
+    const auto hi = bandGain (16000.0), lo = bandGain (1000.0);
+    const auto loLevel = level (run (EffectKind::prismMultiband, p, tone (1000.0))) - level (tone (1000.0));
+    std::printf ("  prism 6 bands: band 6 gain change at 16 kHz %.1f dB, at 1 kHz %.2f dB (1 kHz level %.2f dB)\n", hi, lo, loLevel);
+    CHECK (hi < -6.0f && std::abs (lo) < 0.1f && std::abs (loLevel) < 0.1);
+    // the same band in a 4-band setting does not exist: band 6's settings are ignored
+    p[m::bandCountParam] = m::bandCountValue (4);
+    CHECK (std::abs (level (run (EffectKind::prismMultiband, p, tone (16000.0))) - level (tone (16000.0))) < 0.1);
+}
+
+TEST (parity135f_prism_pan_and_sidechain)
+{
+    using namespace dyn108;
+    namespace m = lynx::dyn::prism;
+    auto p = defaults (EffectKind::prismMultiband);
+    // band 2 (120 Hz … 1 kHz) with a +6 dB level and no dynamics, panned hard left: the right channel loses the band
+    for (int b = 0; b < m::legacyBands; ++b) p[(std::size_t) m::param (b, m::fEnabled)] = b == 1 ? 1.0f : 0.0f;
+    p[(std::size_t) m::param (1, m::fRange)] = 0.5f;
+    p[(std::size_t) m::bandPanParam (1)] = 0.0f;
+    auto slot = lynx::makeEffectSlot (EffectKind::prismMultiband);
+    slot.params = p;
+    auto fx = lynx::makeEffect (slot);
+    fx->prepare (sr);
+    std::vector<float> l ((std::size_t) sr / 2), r;
+    for (std::size_t i = 0; i < l.size(); ++i) l[i] = (float) (0.2 * std::sin (2.0 * pi * 400.0 * (double) i / sr));
+    r = l;
+    const auto x = l;
+    for (std::size_t off = 0; off < l.size(); off += 512)
+        fx->process (l.data() + off, r.data() + off, (int) std::min<std::size_t> (512, l.size() - off), p, 120.0);
+    float pl = 0.0f, pr = 0.0f, px = 0.0f;
+    for (std::size_t i = l.size() / 2; i < l.size(); ++i) { pl = std::max (pl, std::abs (l[i])); pr = std::max (pr, std::abs (r[i])); px = std::max (px, std::abs (x[i])); }
+    std::printf ("  prism pan: left %.3f right %.3f (input %.3f)\n", pl, pr, px);
+    CHECK (std::abs (pl - px) < 0.01f * px && pr < 0.4f * px);
+    // external side chain: a quiet programme is compressed when the side chain is loud
+    p = defaults (EffectKind::prismMultiband);
+    p[m::scExternal] = 1.0f;
+    for (int b = 0; b < m::legacyBands; ++b) p[(std::size_t) m::param (b, m::fThreshold)] = m::thresholdValue (-30.0);
+    std::vector<float> quiet ((std::size_t) sr), loud ((std::size_t) sr);
+    for (std::size_t i = 0; i < quiet.size(); ++i)
+    {
+        quiet[i] = (float) (0.01 * std::sin (2.0 * pi * 400.0 * (double) i / sr));
+        loud[i] = (float) (0.9 * std::sin (2.0 * pi * 400.0 * (double) i / sr));
+    }
+    const auto with = run (EffectKind::prismMultiband, p, quiet, nullptr, &loud);
+    const auto without = run (EffectKind::prismMultiband, p, quiet);
+    float a = 0.0f, b = 0.0f;
+    for (std::size_t i = quiet.size() / 2; i < quiet.size() - 2000; ++i) { a = std::max (a, std::abs (with[i])); b = std::max (b, std::abs (without[i])); }
+    std::printf ("  prism external side chain: %.4f (loud key) vs %.4f (none)\n", a, b);
+    CHECK (a < 0.5f * b && std::abs (b - 0.01f) < 0.002f);
+}
+
+TEST (parity135f_crest_wet_dry_pan)
+{
+    using namespace dyn108;
+    namespace c = lynx::dyn::crest;
+    auto p = defaults (EffectKind::crestCompressor);
+    CHECK (p[c::wetPan] == 0.5f && p[c::dryPan] == 0.5f && c::count == c::dryPan + 1);
+    CHECK (lynx::dyn::paramText (EffectKind::crestCompressor, c::wetPan, 1.0f) == "100% R");
+    // all wet, the wet path panned hard right: the left channel is silent, the right one is the compressed signal
+    auto run2 = [] (const EffectParams& q, std::vector<float>& l, std::vector<float>& r) {
+        auto slot = lynx::makeEffectSlot (EffectKind::crestCompressor);
+        slot.params = q;
+        auto fx = lynx::makeEffect (slot);
+        fx->prepare (sr);
+        for (std::size_t off = 0; off < l.size(); off += 512)
+            fx->process (l.data() + off, r.data() + off, (int) std::min<std::size_t> (512, l.size() - off), q, 120.0);
+    };
+    std::vector<float> l ((std::size_t) sr / 2), r;
+    for (std::size_t i = 0; i < l.size(); ++i) l[i] = (float) (0.3 * std::sin (2.0 * pi * 300.0 * (double) i / sr));
+    r = l;
+    auto l0 = l, r0 = r;
+    run2 (p, l0, r0);
+    p[c::wetPan] = 1.0f;
+    run2 (p, l, r);
+    float pl = 0.0f, dr = 0.0f;
+    for (std::size_t i = 0; i < l.size(); ++i) { pl = std::max (pl, std::abs (l[i])); dr = std::max (dr, std::abs (r[i] - r0[i])); }
+    std::printf ("  crest wet pan right: left peak %.5f, right vs centred %.6f\n", pl, dr);
+    CHECK (pl < 1e-6f && dr < 1e-5f);
+}
+
+TEST (parity135f_facet_new_shapes_and_character)
+{
+    using namespace lynx::facet;
+    // the nine original shapes keep their values; the new ones sit between them and round-trip
+    for (int k = 0; k <= 8; ++k) CHECK (shape ((float) k / 8.0f) == (Shape) k && shapeValue ((Shape) k) == (float) k / 8.0f);
+    CHECK (shape (shapeValue (Shape::flatTilt)) == Shape::flatTilt && shape (shapeValue (Shape::allPass)) == Shape::allPass);
+    CHECK (paramText (param (0, 0), shapeValue (Shape::allPass)) == "All Pass" && paramText (characterParam, 1.0f) == "Warm");
+    CHECK ((int) info().params.size() == paramCount && info().params[(std::size_t) characterParam].defaultValue == 0.0f);
+    auto p = parity135f::defaults (lynx::EffectKind::facetEq);
+    // all pass at 1 kHz: flat magnitude (digital and analog)
+    p[(std::size_t) param (0, 0)] = shapeValue (Shape::allPass);
+    p[(std::size_t) param (0, 1)] = hzValue (1000.0);
+    double worst = 0.0;
+    for (const double f : { 50.0, 300.0, 1000.0, 3000.0, 12000.0 }) worst = std::max (worst, std::abs (responseDb (p, 48000.0, f)));
+    CHECK (worst < 0.01);
+    // ... but it does move the phase: a 1 kHz sine comes out shifted (not equal to the input)
+    {
+        auto fx = make (&p);
+        fx->prepare (48000.0);
+        std::vector<float> l, r;
+        parity135f::sine (l, 4800, 48000.0, 1000.0, 0.5);
+        r = l;
+        const auto x = l;
+        fx->process (l.data(), r.data(), 4800, p, 120.0);
+        double d = 0.0;
+        for (int i = 2400; i < 4800; ++i) d = std::max (d, (double) std::abs (l[(std::size_t) i] - x[(std::size_t) i]));
+        CHECK (d > 0.3);
+    }
+    // flat tilt +6 dB: 0 dB at the band frequency, about +6 dB five octaves above, −6 dB five below, a steady slope
+    p[(std::size_t) param (0, 0)] = shapeValue (Shape::flatTilt);
+    p[(std::size_t) param (0, 2)] = gainValue (6.0);
+    const auto at = [&] (double f) { return responseDb (p, 96000.0, f); };
+    std::printf ("  facet flat tilt +6: %.2f / %.2f / %.2f / %.2f / %.2f dB at 31 Hz / 250 Hz / 1 kHz / 4 kHz / 32 kHz\n", at (31.25), at (250.0), at (1000.0), at (4000.0), at (32000.0));
+    CHECK (std::abs (at (1000.0)) < 0.2 && std::abs (at (32000.0) - 6.0) < 1.0 && std::abs (at (31.25) + 6.0) < 1.0);
+    CHECK (std::abs (at (4000.0) - 2.4) < 0.6 && std::abs (at (250.0) + 2.4) < 0.6);
+    // character: Clean leaves the signal alone; Subtle bends a 0 dBFS peak, not a −30 dBFS one
+    CHECK (characterSample (0, 0.9f) == 0.9f);
+    CHECK (std::abs (characterSample (1, 0.0316f) - 0.0316f) < 0.0316f * 0.001f && characterSample (1, 1.0f) < 0.97f);
+    CHECK (std::abs (characterSample (2, 0.0316f) - 0.0316f) < 0.0316f * 0.002f && characterSample (2, 1.0f) < characterSample (1, 1.0f));
+}
+
+TEST (parity135f_lynxtune_learn_and_classic)
+{
+    using namespace lynx::lynxtune;
+    CHECK (learnMidi == moreScales + 1 && classicMode == learnMidi + 1 && count == classicMode + 1);
+    CHECK ((int) lynx::effectInfo (lynx::EffectKind::lynxTune).params.size() == count);
+    CHECK (paramText (classicMode, 1.0f) == "On");
+    auto p = parity135f::defaults (lynx::EffectKind::lynxTune);
+    p[midiChannel] = 1.0f / 128.0f; // channel 1
+    auto fx = make();
+    fx->prepare (48000.0);
+    lynx::NoteMask held[2] {};
+    held[0][0] = 1ull << 60; // C4
+    held[0][1] = 1ull << (64 - 64); // E4
+    fx->setHeldNotes (held, 2);
+    std::vector<float> l (2048, 0.0f), r (2048, 0.0f);
+    fx->process (l.data(), r.data(), 2048, p, 120.0);
+    const auto mask = (unsigned) std::lround (fx->controlOutput (5) * 4096.0f);
+    CHECK (mask == ((1u << 0) | (1u << 4)));
+    // classic ([EXEC] Auto-Tune Pro: the same retune, the short-latency DSP): the same pull to A (440 Hz), less latency
+    auto run = [] (bool classic, int* latency) {
+        auto q = parity135f::defaults (lynx::EffectKind::lynxTune);
+        q[scale] = 0.0f; // chromatic
+        q[retune] = std::sqrt (150.0f / 400.0f);
+        q[classicMode] = classic ? 1.0f : 0.0f;
+        auto t = make();
+        t->prepare (48000.0);
+        std::vector<float> a, b;
+        parity135f::sine (a, 96000, 48000.0, 452.0, 0.3);
+        b = a;
+        for (int i = 0; i < 96000; i += 512) t->process (a.data() + i, b.data() + i, std::min (512, 96000 - i), q, 120.0);
+        *latency = t->latencySamples();
+        return a;
+    };
+    int latNormal = 0, latClassic = 0;
+    const auto normal = run (false, &latNormal), classic = run (true, &latClassic);
+    auto freq = [] (const std::vector<float>& x, int from, int to) {
+        int crossings = 0;
+        for (int i = from + 1; i < to; ++i) if (x[(std::size_t) i - 1] < 0.0f && x[(std::size_t) i] >= 0.0f) ++crossings;
+        return crossings * 48000.0 / (to - from);
+    };
+    const auto fn = freq (normal, 72000, 96000), fc = freq (classic, 72000, 96000);
+    std::printf ("  lynx tune classic: end %.1f Hz (default %.1f Hz), latency %d (default %d)\n", fc, fn, latClassic, latNormal);
+    CHECK (std::abs (fc - 440.0) < 3.0 && std::abs (fn - 440.0) < 3.0 && latClassic < latNormal);
+}

+ 1 - 0
tests/tests.cpp

@@ -15776,4 +15776,5 @@ TEST (plugin_layout_options_match_the_engine_values)
 #include "Bugs131Tests.inc"
 #include "Parity135wTests.inc"
 #include "Feat133Tests.inc"
+#include "Parity135fTests.inc"
 #include "Feat132Tests.inc"