Kaynağa Gözat

Merge origin/main into feature/rea165

Ka1-S 1 ay önce
ebeveyn
işleme
f19d3f44b7

+ 5 - 0
.github/workflows/tests.yml

@@ -5,6 +5,11 @@ on:
     branches: [main, 'wip/**']
   pull_request:
 
+# A newer push to the same branch cancels the older run (work branches are pushed often); main keeps every run.
+concurrency:
+  group: tests-${{ github.ref }}
+  cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
+
 env:
   JUCE_VERSION: 8.0.4
   JUCE_SHA256: 0effe9823a6fd8a4f98e5c08be7d308350e417b2d15dcf34011e778fefbbf005

+ 4 - 0
CMakeLists.txt

@@ -88,6 +88,7 @@ add_library(lynx_core STATIC
     src/core/FreqShifterFl.cpp
     src/core/LowLifterFl.cpp
     src/core/VisualFx.cpp
+    src/core/FruityDance.cpp
     src/core/Reeverb2.cpp
     src/core/LuxeVerb.cpp
     src/core/IldspMath.cpp
@@ -316,6 +317,8 @@ if(LYNX_BUILD_APP)
         src/ui/AutomationUi.cpp
         src/ui/ControllerEditors.cpp
         src/ui/VisualEditors.cpp
+        src/ui/VisualGl.cpp
+        src/ui/DanceView.cpp
         src/ui/NewtoneEditor.cpp
         src/ui/ChannelSettings.cpp
         src/ui/LayerEditor.cpp
@@ -405,6 +408,7 @@ if(LYNX_BUILD_APP)
             juce::juce_audio_utils
             juce::juce_audio_processors
             juce::juce_dsp
+            juce::juce_opengl
         PUBLIC
             juce::juce_recommended_config_flags
             juce::juce_recommended_lto_flags)

+ 9 - 3
docs/STATUS.md

@@ -242,6 +242,9 @@ accordingly. Highlights of what is **confirmed and applied**:
   CPU: AVX bank kernel (8 partials per pass), running sine pairs across frequency changes (steps by complex rotation
   along the harmonic series), fast per-partial exp/log, cached k^m, idle records/channels skipped; "Square a Saw —
   Oxygen" (23 Harmor channels, 260 s) exports in 50 s, "JuiceBass — Menagerie" (8, 474 s) in 78 s.
+  **REA round 165g (flbeta165s):** the 88 old (version 11…15) factory presets, Default.fst included, are upgraded
+  the way FL's loader does (byte-identical to the DLL's own re-save; a new Harmor starts from Default.fst), filter
+  shapes 8, 10…13, 15 and 16, images of any size (Labyrinth's 16 × 12), portamento time following the velocity.
   **REA round 75:** image synthesis (the part's gain and frequency planes from the project: time position with speed,
   offset and smoothing, one-shot / loop / ping-pong / crossfade, the seven interpolation curves, gain pixel scale and
   mix, frequency modes Oct / Hz / Wide Hz / Unison with the local mask, formant shift with FL's per-column pitch track
@@ -610,9 +613,12 @@ accordingly. Highlights of what is **confirmed and applied**:
   MIDI; the hidden parameter 8 (time offset, 65536 in every state) is ignored; curve type 10 (spline) runs as a line
   (in no selected slot); FL's "playing" and position-jump messages are inferred from LYNX's transport.
 - Harmor (`harmorFallbacks()` lists what a state uses): resynthesis-mode images (a sample analysed at load time) and
-  images with a per-column gain table are ignored (the part plays its timbres; none in the demos), filter shapes
-  8/10–13/15/16 and unknown resonance/phaser types switch that stage off, clip modes > 4 switch the clip off, blend
-  modes > 5 play as mode 0. At precision "Average" FL computes `exp`/`expm1`/division with IPP's 11-bit routines
+  images with a per-column gain table are ignored (the part plays its timbres; none in the demos), unknown
+  resonance/phaser types switch that stage off, clip modes > 4 switch the clip off, blend modes > 5 play as mode 0;
+  the part's note start delay (parameter 2: Rotochip, Resynthesis/Harmony) and the part filter set by its misc
+  field +4 (Morning) are not modelled (REA_rodada165g-flbeta165s §3). Against the DLL on all 325 installation
+  presets: 264 null below −60 dB, 304 with the same spectrum (STFT magnitude below −40 dB); the frequency phaser
+  (type 209) at a high mix drifts in phase at precision "Average" for the IPP reason below. At precision "Average" FL computes `exp`/`expm1`/division with IPP's 11-bit routines
   (`*_A11`); LYNX computes them exactly — demos 74 and 78 (per-partial unison curve) stay at −57/−55 dB for that reason
   (−77.5/−84.5 dB at precision 1, REA_rodada75 §5). In the
   rack, the distortion's shapers are exact functions where FL uses IPP's 11-bit `Tanh/Exp/Ln/Sqrt/Cbrt` at precision 0

+ 1 - 1
docs/analise/REA_rodada142.md

@@ -41,7 +41,7 @@ the same contract as an imported project.
 | Engine | New instance on this PC | Sound of a note / signal | Notes |
 |---|---|---|---|
 | 3x Osc, Sytrus, Harmless, PoiZone, SimSynth, Fruity DX10, Plucked!, Fruit Kick, Drumpad | Default.fst | ✅ | |
-| Harmor (beta), Ogun | first preset the engine reads | ✅ | Default.fst not readable by the engine |
+| Harmor (beta), Ogun | Harmor: Default.fst (old states upgraded, REA_rodada165g-flbeta165s); Ogun: first preset the engine reads | ✅ | |
 | GMS, Morphine | first `.gmsynth` / `.mrp` | ✅ | no Default preset in FL |
 | Toxic Biohazard | `Default.tbio` + the DLL's spectra | ✅ | |
 | Kepler (beta), Transistor Bass, Sawer, MiniSynth, FL Slayer, BassDrum, BooBass | Default + the FL data file | ✅ | |

+ 119 - 0
docs/analise/REA_rodada165e.md

@@ -0,0 +1,119 @@
+# Round 165e (zge165) — a ZGameEditor-style GPU path for the Visualizer + LYNX Dance (Fruity Dance)
+
+Brief (tmp/round165-brief.md "r165e"): an OpenGL path for the Visualizer (own component, falls back to the 2D
+renderer), GLSL shader layers in the spirit of ZGE's categories (Postprocess, Feedback, Canvas, Terrain/3D, blend
+modes, HUD layers), audio-reactive uniforms, presets, full screen, 1080p video export, ZGE preset mapping on import;
+the GPU path must not raise audio CPU and must never stress the GPU/driver. A Fruity Dance equivalent with original
+art (procedural dancer, moves picked by notes), FL's Fruity Dance channels imported.
+
+## Where I stopped
+
+- 2026-10-27 15:26: the PC blue-screened (kernel driver fault) while this round was running; resumed at 16:00 from the
+  checkpoint commit, paused 16:20 for machine load, resumed again.
+- Done: everything below, verified (§5). Landed on main after build-local with FL Data (1762614 checks, 0 failures).
+
+## GPU safety (after the BSOD)
+
+- No continuous repainting: frames only when the message thread hands one over (30/s editor, 60/s full screen,
+  a third in silence), vsync on; live picture at most 1280 x 720 (scaled up on screen); fixed small loop counts in the shaders.
+- Session note "visualizer GPU: start/stop": a crash with the GPU view drawing turns the GPU path off at the next
+  start (Main.cpp) with a message.
+- Checks: shaders compiled and rendered on Linux (Xvfb + Mesa llvmpipe, software); real Windows GPU at most a few
+  seconds per check, tiny windows, under ~/.cache/lynx-wingui.lock.
+
+## 1. Scope (measured before building)
+
+- ZGameEditor Visualizer (REA_rodada164c §1): 230 presets, 119 effects in 15 categories; most are GLSL programs run
+  by ZGameEditor scripts. LYNX does not run ZGE scripts or copy its shaders: it has its own small set of shader
+  effects per category and maps each ZGE effect to the closest one on import (§4). Kept out: Physics (2 uses),
+  "Scenes" as full 3D worlds (mapped to a 3D object / terrain / canvas look-alike), HUD meters beyond what the 2D
+  layers already draw.
+- Fruity Dance: FL's character and its moves are FL artwork — not copied. LYNX draws its own character (a lynx, the
+  app's mascot) procedurally; only the behaviour (keys, state) follows FL.
+
+## 2. The Visualizer's GPU path [CODE]
+
+- `ui/VisualGl.{h,cpp}`, `ui/VisualGlShaders.inc`: a JUCE `OpenGLContext` on its own child component
+  (`GlSceneView`); the 2D layers draw into frame buffers through JUCE's OpenGL renderer, the shader layers are
+  full-screen passes; layers are composed in two ping-pong buffers with per-layer blend modes (Normal, Add, Screen,
+  Multiply, Overlay, Difference, Lighten, Darken).
+- Shader layer types (after the 9 2D types): Canvas (Plasma, Tunnel, Cells, Kaleidoscope, Clouds, Warp stars,
+  Electric, Sun rays), Terrain 3D (Spectrum mountains from a 64 x 128 spectrum-history texture, Shaded hills,
+  Retro road), 3D object (ray-marched Reactive sphere, Torus, Cube grid, Ring tunnel), Feedback (Zoom trails, Spin
+  tunnel, Kaleido feedback, Warp, Echo, Smoke drift — each keeps its own previous picture), Post-process (Bloom,
+  Blur — downsampled two-pass Gaussian —, RGB shift, Pixelate, Dot matrix, Scan lines, Vignette, Colour
+  correction, Kaleidoscope, Mirror, Edge detect, Shake, Glitch, Film grain, Invert on beat).
+- Audio-reactive uniforms: level, bass, mid, high, beat, the layer's band × React, the 64-band spectrum texture and
+  its history; Size / Amount / Speed / Count / X / Y / the two colours drive each effect (hint per effect).
+- 8 new built-in GPU scenes (Retro road, Spectrum mountains, Reactive sphere, Kaleido feedback, Plasma tunnel, Cube
+  city, Electric storm, Neon CRT).
+- The audio stays where it was: the tap is read and analysed on the message thread (as the 2D preview), the frame
+  is handed to the GL thread under a small mutex — the audio thread is untouched.
+- Fallback: no context in 5 s, shader compile/link failure of the base programs, or the user's GPU button off → the
+  2D renderer (Canvas and Terrain drawn simplified, 3D / Feedback / Post-process skipped, with a note in the editor).
+- Full screen and video export use the same renderer; the export draws each frame off-screen at the export size
+  (1080p included) through a thumbnail context in the progress window, read back with glReadPixels; if the GPU
+  stops answering (15 s) the rest of the export is drawn in 2D.
+
+## 3. LYNX Dance (FL's Fruity Dance) [DECOMP + CODE]
+
+- FL (Fruity dance_x64.dll, Ghidra project r68_dance): TriggerVoice `FUN_0071b630` maps the key through a 128-entry
+  table and kills the voice at once (no sound, `Gen_Render` `FUN_0071b7c0` is empty). The table is filled in
+  `FUN_0071a410`: keys 59 (B4) up = move 0, 1, … (as many as the loaded dance has), keys 48 (C4) down = the same
+  moves mirrored (stored as −1 − move), key 53 (F4) = 0x10000 → parameter 2 (shown) = 0, key 54 (F#4) = 0x10001 →
+  shown = 1. A move key also sets parameter 1 (mirrored) when it changes. LYNX: `dance::actionForKey`, the same keys.
+- State (REA_rodada68 §8): int version; move, mirrored, shown, scale (/64), speed, x, y; display options; version 2
+  adds a picture path. LYNX reads it on .flp import (`dance::fromFl`) and writes its own text state once edited.
+- LYNX's character: its own lynx (tufted ears, cheek ruffs, bob tail, a shirt in the outfit colour) drawn from a pose
+  with vector shapes; 11 moves (Freestyle, Waiting, Stepping, Jumping, Zombie, Waving, Hula, Windmill, Flailing,
+  Spinning, Pose) as pose functions of a cycle (one cycle = two beats at speed 1), Freestyle picks a move every two
+  cycles, changes blend over 180 ms. The clock follows the song while playing, 120 BPM free-running when stopped.
+- Where: a transparent stage over the main window (only the dancers take the mouse: drag to place, right-click for
+  moves / mirrored / hide / settings), repainting only the dancer's box at 30 frames a second (2 a second when the
+  project has no dance channel). The channel's editor (live preview, move, mirrored, shown, size, speed, outfit
+  colour, put back, the key map) replaces the old "silent" page. Channel Rack › Add › Fruity Dance makes one.
+- The audio thread only stores the note's key in a 16-entry lock-free ring (`dance::Signals`); the UI reads it.
+
+## 4. ZGameEditor presets on import [CODE]
+
+- `visual::fromZge` (VisualFx.cpp) now maps ZGE's GPU categories to the shader layers instead of dropping them or
+  faking them with a flash: Feedback\ (Kaleido → Kaleido feedback, WormHole → Spin tunnel, WarpBack → Warp,
+  BoxedIn / FrameBlur → Echo, the rest → Zoom trails); Postprocess\ (Bloom / Blooming / Starburst / Whitehole →
+  Bloom with Youlean Bloom's amount / threshold / radius / opacity read; blurs, Smudge, Watercolor, Raindrops → Blur;
+  Color Correction / Shaper / Fast HSV / Luminosity / ColorCyclePalette → Colour correction (Youlean's contrast and
+  saturation read); Dot Matrix / Point Cloud / Ascii → Dot matrix; Dither / Fast Static → Film grain; Inverter,
+  Glitch, Edge Detect (+ Notebook Drawings), RGB Shift, ScanLines, Vignette (amount + size read), Kaleidoscope,
+  Pixelate; AudioShake / ParameterShake / Handheld → Shake); Terrain\ and Physics\Heightfield → Spectrum mountains /
+  Shaded hills (CubesAndSpheres → Cube grid); Object Arrays\, Physics\, MatCap → Reactive sphere / Ring tunnel / Cube
+  grid by name; Scenes\ by name → 3D object, hills, clouds, cubes or tunnel; Clouds\, Tunnel\, Canvas effects\ and
+  Patterns\ → the Canvas effects by name (cells, electric, warp stars, kaleidoscope, plasma).
+- A ZGE scene left with only feedback / post-process layers keeps them over LYNX's default scene (they need a
+  picture below). Effects still without a counterpart are listed in the import report as before.
+- Tests: visual165_zgameeditor_gpu_mapping; Visual164's GoopFlow case now maps its terrain (4 layers).
+
+## 5. Verification
+
+- Tests (tests/Visual165Tests.inc): shader layers round trip (type, effect, blend), ZGE GPU mapping, dance state /
+  key map / poses, the silent dance channel's signals. build-local with FL Data: see "Where I stopped".
+- Linux, Xvfb + Mesa llvmpipe (software GL, no real GPU): every GPU scene compiled and drew (`--visualtest`, report
+  "GPU views 8, result=OK"); llvmpipe time per 1040 x 720 frame 5.6–24 ms (Spectrum mountains and Cube city the
+  heaviest) — a real GPU is far faster; the audio-path cost of the Visualizer is unchanged (~0.01 % of a block).
+  Bugs found and fixed there: JUCE's text vanished after a shader layer (texture units left bound → `resetState()`
+  resets units 4..0 and the 2D pass calls it first); the canvas pass sampled its own target.
+- `--danceshot`: the moves sheet (11 moves × 4 phases), the editor and a frame over the workspace — original lynx
+  character, readable at 0.6 to 2× size; a mirrored dancer faces the other way.
+- Windows (real GPU, a few seconds, 693 x 480 window, under ~/.cache/lynx-wingui.lock, killed by PID): Retro road and
+  Reactive sphere drew correctly through the GPU; the GPU video export of FL's ZGE demo (Astes - LIFE) wrote its
+  frames. Some frames are all black — the same frames are black in the 2D export and under llvmpipe (the demo's
+  canvas flashes on the beat), so it is the scene, not the readback.
+- Linux GPU export (llvmpipe): gpu=1, 30 frames at 1280 x 720, identical black/non-black pattern to the 2D export.
+  (`--visualtest` reports result=ERROR for that project only because its first sound is at 1.2 s, and the test
+  expects the default demo's immediate start.)
+- Main window snapshot with two dance channels: both dancers over the Playlist, outfits in their colours.
+
+## 6. Left for later
+
+- ZGE's own scripts and shaders are not run (by design): imported scenes are look-alikes, not copies.
+- The dancer's position is not undoable (FL's is not either); no picture-file dancers (FL's version 2 "picture
+  path") — LYNX always draws its lynx.
+- The GPU path is not measured on macOS hardware (CI builds it; JUCE's default context, legacy OpenGL 2.1 on macOS).

+ 86 - 0
docs/analise/REA_rodada165g-flbeta165s.md

@@ -0,0 +1,86 @@
+# REA round 165g — sub-round flbeta165s: Harmor out of "(beta)"?
+
+Goal: drop Harmor's "(beta)" only if LYNX's engine really matches FL (null / spectra / listening on FL's presets and
+demo projects). Data: `/mnt/d/lynx-work/flbeta165s` (survey tsv, `st/` old states, `up/` DLL re-saves, `run/hm.exe`
+EXEC harness around the unmodified `Harmor_x64.dll`, `py/` batteries, `tools/harmorrender`).
+
+## Where I stopped
+- 2026-10-27 19:40 — fixes verified against the DLL (`bat_all1.log`, `bat_all1_spec.tsv`): all 325 installation
+  presets now play on the exact engine (88 old ones were refused before), 264 null < −60 dB (was 248), 304 same
+  spectrum (was 291). Harmor stays **"(beta)"**: 21 presets still differ audibly (§5). Next: build-local, land.
+
+## 1. Old states (version 11…15) [DECOMP FUN_0086ed30][EXEC]
+The 88 presets saved by Harmor's first releases (Default.fst among them) were refused by LYNX ("state not usable").
+FL's loader brings them into the current layout: a part stores 385 integers (the articulator-33 smoothing, index 376,
+is missing — a 0 is inserted); version 11 stores the 43 smoothing times (343…385) on an older scale, converted as
+`round(log2(1 + (41^(v/1000) − 1)·37.5·0.0511)·1000/9)`; articulator 33 is absent and gets the default articulator
+(off, amounts 1, envelope 0.5, LFO 0.75, flat maps). The global text becomes an empty string + option byte 1.
+`harmorUpgradeState()` writes exactly what the DLL re-saves (`up/up*.bin` = the DLL's own re-save through the EXEC
+harness, `py/hup.py` = our upgrade): all 88 identical except shaping-curve point positions the DLL renormalises at
+load (sub-ulp of the curve length). Rendering the DLL with the old bytes vs its own re-save vs our upgrade:
+−141…−629 dB on the deterministic ones (`py/dll_up.py`) **[EXEC]**. The importer stores the upgraded bytes so the
+settings panel's parameter offsets apply. A new Harmor instance now starts from FL's Default.fst.
+
+## 2. Portamento following the velocity [DECOMP FUN_00883ae0]
+Global 6 on: the note's glide factor is `(1 − 0.85·velocity)²` (float) — a harder note glides faster.
+
+## 3. Battery: all 325 installation presets, DLL vs LYNX [EXEC]
+`py/bat_all.py` (3 notes: 60/1.0, 67/0.6, 55/0.95 over 1 s at 44.1 kHz, effects rack off, the DLL's Mersenne-Twister
+state handed to LYNX), `py/spec.py` (STFT magnitude error, 4096/2048 Hann). Results `bat_all0.log`, `bat_all0_spec.tsv`:
+
+| | presets |
+|---|---|
+| null < −60 dB (sample-exact within float noise) | 248 / 325 (median −74.8 dB) |
+| null ≥ −60 dB but STFT magnitude < −40 dB (same sound, phase drift) | 43 |
+| audibly different (STFT ≥ −40 dB) | 34 — 18 use a filter shape LYNX lacks (8, 10, 11, 12, 13, 15, 16) |
+
+Audibly different without a fallback: Dub steppy 1, Ice bells, Labyrinth, Shield hit, Magic swamp, Rotochip,
+Morning, Sunroom, Metal thingy, Pomona, Image synthesis/Interpolation, Resynthesis/Harmony, Olbaid Plato Cerrado,
+FX Subida, FX White Noise Caida, Lead Hoover. (Olbaid Bajo Acustico: the DLL itself blows up to 3.7·10¹⁹.)
+
+- **Labyrinth / Interpolation**: their images are small (16 × 12 → an 829-byte object; Interpolation 317 bytes) and
+  LYNX only built images from a part tail > 1024 bytes, so it played them without the image. Fixed: any image object
+  is read (FL's DLL plays it: the DLL's partials are inharmonic, LYNX's were harmonic) **[EXEC]**.
+- **Pomona**: no single parameter explains it (`sweep_pomona.log`: every parameter/global that differs from
+  Default.fst reset one at a time; best −8 dB) — several interacting causes, not found yet.
+- **Frequency phaser (type 209) at a high mix** (Ice bells, Magic swamp, Metal thingy, Church bell, Steam starship;
+  `py/` probes): the error starts at 10⁻⁴ relative and grows — a frequency drift. With the precision patched to 1
+  ("High") the same presets go from −13…−18 dB to −47…−56 dB **[EXEC]**: at precision 0 FL computes the phaser's
+  `2^x` frequency factor with IPP's 11-bit `Exp_32f_A11` (REA_rodada75 §5), which LYNX does not copy. The spectra
+  match (−35…−45 dB STFT); the residue is phase drift.
+- **Part parameter 2 = note start delay** [DECOMP FUN_00879540 case 2, FUN_0088ab10 0x88b150]: `p < 0`:
+  `(2^(−p/48) − 1)/255` s, `p ≥ 0`: `p·0.3125/tempo`; times the sample rate and the voice's articulator-8 output
+  (voice +0x3214), the voice's output starts that many samples later (its control-block grid shifts with it).
+  LYNX ignores it. Used by Rotochip (part B, −100) and Resynthesis/Harmony (−135) only: −47 dB on Rotochip with the
+  delay zeroed in both. Not implemented this round (LYNX's records share one control-block grid).
+
+## 4. Filter shapes 8, 10…13, 15, 16 [DECOMP FUN_00874ed0 + DLL constants]
+Used by 24 presets (18 of the audible outliers); LYNX switched that filter off. Tables (s = 1/(N−1), cos in double,
+`dB(x) = exp(float(x·−72)·float(ln10/20))`, `p16(x) = (x⁴)⁴`):
+- 8 (N 682): `−cos((1 − i·s/2)·π)`; 10 (N 1365): u = the same expression + 1 … `dB(u)·(1 − p16(u))`;
+- 11 (N 1024): `(1 − (cos(3π·(1 − i·s)) + 1)/2)·(1 − (cos(π·(1 − i·s)) + 1)/2)`;
+- 12 (N 4096, origin ½): first half `(1 − (cos(2π(1 − i·s)) + 1)/4)²`, second half `dB(x)·(1 − p16(x))`, x = 2·(i − N/2)·s;
+- 13 (N 1024): `exp(float((1 − (cos(π(1 − i·s)) + 1)/2)·18 − 18)·ln10/20)`;
+- 15 (N 4096, origin ½, ends 1/1): `a²·b² + b/8`, a = (cos(12π(1 − i·s)) + 1)/2, b = 1 − (cos(2π(1 − i·s)) + 1)/2;
+- 16 (N 2048, filled with 1.0, origin ½): the first and last N/3 entries `(1 − (cos(2π(1 − i·0.5/(N/3))) + 1)/2)²`.
+
+## 5. Result and what still differs [EXEC]
+After §1–4 (`bat_all1*`; repeated runs of the same preset vary by a few dB where a state uses randomness, the DLL's
+Mersenne-Twister seed differing per run):
+
+| | before | after |
+|---|---|---|
+| presets the exact engine plays | 237 / 325 | 325 / 325 |
+| null < −60 dB | 248 | 264 |
+| STFT magnitude < −40 dB | 291 | 304 |
+
+Shape presets now at −70…−84 dB (Machine wriggle, Blue screen 2, Wall, Equinox, Above the treeline, Bajo Deep/
+Future/Growl 2, Lead Borracho/Mono/Supersaw 2, Pluck Analogo/Clasico); Interpolation −84.4 dB, Labyrinth −19.9 dB
+(spectrum −38.8: the image now plays; the rest not found).
+
+Why Harmor keeps "(beta)": still audibly different (STFT ≥ −40 dB): Dub steppy 1, Labyrinth, Shield hit, Rotochip
+(note start delay, §3), Morning (part misc +4 → part +0x668: an audio filter object set up by FUN_008781f0 /
+FUN_00863450, not modelled; −81.8 dB with it zeroed in both), Sunroom, Metal thingy / Magic swamp / Ice bells (IPP
+`Exp_32f_A11` in the frequency phaser, §3), Pomona (several causes), Resynthesis/Harmony (delay + resynthesis),
+Oldschool / Tronic 3 / Blue screen / Lead Arcade (shapes now on; a second difference remains), Olbaid noise drums/FX
+(Plato Cerrado/Abierto, FX Subida, White Noise Caida: noise-driven, near the threshold), Lead Hoover.

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

@@ -5193,6 +5193,113 @@ countries: br
 "Beat threshold" = "Limiar da batida"
 "Hue shift" = "Rotação de matiz"
 
+# round 165e: the Visualizer's GPU layers, LYNX Dance
+"The Visualizer was drawing with the GPU (OpenGL) when it happened. It now draws without the GPU; its GPU button turns it back on." = "O Visualizer estava desenhando com a GPU (OpenGL) quando isso aconteceu. Agora ele desenha sem a GPU; o botão GPU dele a liga de novo."
+"Draw the scene with the GPU (OpenGL): needed by the shader layers (Canvas, Terrain, 3D, Feedback, Post-process) and blend modes. Off: the 2D renderer" = "Desenhar a cena com a GPU (OpenGL): necessário para as camadas de shader (Canvas, Terreno, 3D, Feedback, Pós-processamento) e os modos de mistura. Desligado: o renderizador 2D"
+"How the layer mixes with the ones below it (GPU)" = "Como a camada se mistura com as de baixo (GPU)"
+"Blend" = "Mistura"
+"Without the GPU this layer is drawn simplified." = "Sem a GPU esta camada é desenhada simplificada."
+"This layer needs the GPU (turn GPU on)." = "Esta camada precisa da GPU (ligue GPU)."
+"GPU layers" = "Camadas de GPU"
+"Canvas (GPU)" = "Canvas (GPU)"
+"Terrain 3D (GPU)" = "Terreno 3D (GPU)"
+"3D object (GPU)" = "Objeto 3D (GPU)"
+"Feedback (GPU)" = "Feedback (GPU)"
+"Post-process (GPU)" = "Pós-processamento (GPU)"
+"Screen" = "Tela"
+"Overlay" = "Sobreposição"
+"Difference" = "Diferença"
+"Lighten" = "Clarear"
+"Darken" = "Escurecer"
+"Plasma" = "Plasma"
+"Tunnel" = "Túnel"
+"Cells" = "Células"
+"Kaleidoscope" = "Caleidoscópio"
+"Clouds" = "Nuvens"
+"Warp stars" = "Estrelas em dobra"
+"Electric" = "Elétrico"
+"Sun rays" = "Raios de sol"
+"Spectrum mountains" = "Montanhas do espectro"
+"Shaded hills" = "Colinas sombreadas"
+"Retro road" = "Estrada retrô"
+"Reactive sphere" = "Esfera reativa"
+"Torus" = "Toro"
+"Cube grid" = "Grade de cubos"
+"Ring tunnel" = "Túnel de anéis"
+"Zoom trails" = "Rastros com zoom"
+"Spin tunnel" = "Túnel giratório"
+"Kaleido feedback" = "Feedback caleidoscópico"
+"Smoke drift" = "Fumaça subindo"
+"Bloom" = "Brilho (bloom)"
+"RGB shift" = "Desvio RGB"
+"Pixelate" = "Pixelizar"
+"Dot matrix" = "Matriz de pontos"
+"Scan lines" = "Linhas de varredura"
+"Vignette" = "Vinheta"
+"Colour correction" = "Correção de cor"
+"Edge detect" = "Detecção de bordas"
+"Shake" = "Tremor"
+"Glitch" = "Glitch"
+"Film grain" = "Granulação de filme"
+"Invert on beat" = "Inverter na batida"
+"Size: scale, Amount: colour bands, Count: layers of waves" = "Size: escala, Amount: faixas de cor, Count: camadas de ondas"
+"Size: ring spacing, Amount: twist, Speed: flight speed" = "Size: espaço entre anéis, Amount: torção, Speed: velocidade do voo"
+"Size: cell size, Amount: border glow, Count: detail" = "Size: tamanho da célula, Amount: brilho da borda, Count: detalhe"
+"Size: zoom, Amount: folds, Count: iterations" = "Size: zoom, Amount: dobras, Count: iterações"
+"Size: scale, Amount: density, Speed: drift" = "Size: escala, Amount: densidade, Speed: deriva"
+"Size: star size, Amount: streaks, Count: density" = "Size: tamanho da estrela, Amount: rastros, Count: densidade"
+"Size: thickness, Amount: jitter, Count: bolts" = "Size: espessura, Amount: tremor, Count: raios"
+"Size: sun size, Amount: ray strength, Count: rays" = "Size: tamanho do sol, Amount: força dos raios, Count: raios"
+"The spectrum's history as a wire landscape. Size: height, Amount: line glow, Count: rows" = "O histórico do espectro como paisagem de arame. Size: altura, Amount: brilho das linhas, Count: fileiras"
+"A lit landscape shaped by the spectrum. Size: height, Amount: fog, Speed: flight speed" = "Uma paisagem iluminada moldada pelo espectro. Size: altura, Amount: neblina, Speed: velocidade do voo"
+"A neon grid and a sun. Size: sun size, Amount: grid glow, Speed: flight speed" = "Uma grade neon e um sol. Size: tamanho do sol, Amount: brilho da grade, Speed: velocidade do voo"
+"A sphere the bass deforms. Size: radius, Amount: deformation, Speed: spin" = "Uma esfera que o grave deforma. Size: raio, Amount: deformação, Speed: giro"
+"Size: radius, Amount: thickness, Speed: spin" = "Size: raio, Amount: espessura, Speed: giro"
+"Columns that follow the spectrum. Size: height, Amount: spacing, Count: columns" = "Colunas que seguem o espectro. Size: altura, Amount: espaçamento, Count: colunas"
+"Rings flying past. Size: radius, Amount: thickness, Speed: flight speed" = "Anéis passando. Size: raio, Amount: espessura, Speed: velocidade do voo"
+"Size: zoom per frame, Amount: how long trails last" = "Size: zoom por quadro, Amount: quanto duram os rastros"
+"Size: zoom per frame, Speed: rotation, Amount: trail length" = "Size: zoom por quadro, Speed: rotação, Amount: comprimento do rastro"
+"Size: zoom, Amount: trail length, Count: mirror folds" = "Size: zoom, Amount: comprimento do rastro, Count: dobras do espelho"
+"Size: warp scale, Amount: trail length, Speed: flow" = "Size: escala da distorção, Amount: comprimento do rastro, Speed: fluxo"
+"Amount: how long the picture stays" = "Amount: quanto tempo a imagem fica"
+"Speed: rise, Amount: trail length, Size: spread" = "Speed: subida, Amount: comprimento do rastro, Size: espalhamento"
+"Glow around bright parts. Amount: strength, Size: radius, Count: threshold" = "Brilho em volta das partes claras. Amount: força, Size: raio, Count: limiar"
+"Size: radius, React: the band blurs it more" = "Size: raio, React: a banda desfoca mais"
+"Amount: colour split, React: the band pushes it" = "Amount: separação das cores, React: a banda empurra"
+"Size: pixel size" = "Size: tamanho do pixel"
+"Size: dot size, Amount: dot sharpness" = "Size: tamanho do ponto, Amount: nitidez do ponto"
+"Size: line spacing, Amount: darkness, Speed: roll" = "Size: espaço entre linhas, Amount: escurecimento, Speed: rolagem"
+"Size: radius, Amount: darkness" = "Size: raio, Amount: escurecimento"
+"Size: saturation, Amount: contrast, Speed: hue drift, colour A: tint" = "Size: saturação, Amount: contraste, Speed: deriva de matiz, cor A: tingimento"
+"Count: folds, Speed: rotation" = "Count: dobras, Speed: rotação"
+"Count: 1 left-right, 2 top-bottom, 3 both" = "Count: 1 esquerda-direita, 2 cima-baixo, 3 ambos"
+"Amount: edge strength, colour A: edge colour" = "Amount: força da borda, cor A: cor da borda"
+"Amount: how far the beat shakes the picture" = "Amount: o quanto a batida sacode a imagem"
+"Amount: how often slices jump, React: the band triggers it" = "Amount: frequência com que as faixas pulam, React: a banda dispara"
+"Amount: grain strength" = "Amount: força da granulação"
+"React: how much the band inverts the colours" = "React: o quanto a banda inverte as cores"
+"Freestyle" = "Estilo livre"
+"Waiting" = "Esperando"
+"Stepping" = "Passinho"
+"Jumping" = "Pulando"
+"Zombie" = "Zumbi"
+"Waving" = "Acenando"
+"Hula" = "Hula"
+"Windmill" = "Moinho"
+"Flailing" = "Agitando"
+"Spinning" = "Girando"
+"Pose" = "Pose"
+"Mirrored" = "Espelhado"
+"Hide the dancer" = "Esconder o dançarino"
+"Settings..." = "Configurações..."
+"Show the dancer" = "Mostrar o dançarino"
+"Outfit colour..." = "Cor da roupa..."
+"Outfit colour" = "Cor da roupa"
+"Put the dancer back" = "Pôr o dançarino de volta"
+"LYNX Dance" = "LYNX Dance"
+"Fruity Dance's role with LYNX's own dancer: it makes no sound. Its notes pick the move; drag the dancer to place it, right-click it for its moves." = "O papel do Fruity Dance com o dançarino próprio do LYNX: não faz som. As notas escolhem o passo; arraste o dançarino para posicioná-lo, clique com o botão direito para ver os passos."
+"Move" = "Passo"
+"Keys (as in FL's Fruity Dance): {0}. From {1} down: the same moves mirrored. {2} hides the dancer, {3} shows it." = "Teclas (como no Fruity Dance do FL): {0}. De {1} para baixo: os mesmos passos espelhados. {2} esconde o dançarino, {3} mostra."
 # round 165 (linuxmouse165): FL's point editing (WaveShaper, automation, curve editors)
 "Point: [LMB] drag moves, then [Shift] keeps time, [Ctrl] keeps value  [Alt] no snap  [RMB] menu" = "Ponto: [LMB] arrastar move, depois [Shift] mantém o tempo, [Ctrl] mantém o valor  [Alt] sem grade  [RMB] menu"
 "Tension: [LMB] drag up / down bends the segment ([Ctrl] fine)  [RMB] straight" = "Tensão: [LMB] arrastar para cima / baixo curva o segmento ([Ctrl] fino)  [RMB] reto"

Dosya farkı çok büyük olduğundan ihmal edildi
+ 0 - 0
scripts/build-local.sh


+ 2 - 2
scripts/build-windows-zig.sh

@@ -22,7 +22,7 @@ mkdir -p "$OUT/juce" "$OUT/app" "$OUT/shim"
 echo '#include <dbghelp.h>' > "$OUT/shim/Dbghelp.h"
 
 MODULES=(juce_core juce_data_structures juce_events juce_graphics juce_gui_basics juce_gui_extra
-         juce_audio_basics juce_audio_devices juce_audio_formats juce_audio_processors juce_audio_utils juce_dsp)
+         juce_audio_basics juce_audio_devices juce_audio_formats juce_audio_processors juce_audio_utils juce_dsp juce_opengl)
 
 {
     echo '#pragma once'
@@ -144,7 +144,7 @@ APP_SOURCES+=(src/core/PluginLayout.cpp src/core/StateParams.cpp src/ui/PluginEd
 # crash / freeze reports: consent, anonymiser, upload, GitHub form (round 159)
 APP_SOURCES+=(src/core/CrashReport.cpp src/ui/CrashReporter.cpp)
 # visual plugins: Wave Candy, Visualizer, video export (round 164c)
-APP_SOURCES+=(src/core/VisualFx.cpp src/ui/VisualEditors.cpp)
+APP_SOURCES+=(src/core/VisualFx.cpp src/core/FruityDance.cpp src/ui/VisualEditors.cpp src/ui/VisualGl.cpp src/ui/DanceView.cpp)
 
 echo "WavPack (decoder, C)..."
 mkdir -p "$OUT/wavpack"

+ 84 - 0
src/Main.cpp

@@ -29,6 +29,8 @@
 #include "platform/FileTypes.h"
 #include "ui/PatcherEditor.h"
 #include "ui/VisualEditors.h"
+#include "ui/VisualGl.h"
+#include "ui/DanceView.h"
 #include "ui/PluginPresetMenu.h"
 #include "ui/PluginWindow.h"
 #include "ui/ClipProperties.h"
@@ -847,6 +849,16 @@ public:
             return;
         }
 
+        if (args.contains ("--danceshot"))
+        {
+            // LYNX.exe --danceshot prefix: LYNX Dance (round 165e) — every move as a contact sheet, the channel's editor,
+            // and a demo project with two dance channels (for --snapshot)
+            const auto i = args.indexOf ("--danceshot");
+            runDanceShot (args[i + 1].unquoted());
+            quit();
+            return;
+        }
+
         if (args.contains ("--vfxshot"))
         {
             // LYNX.exe --vfxshot prefix: the VFX note effects' editors (round 164b), on channels and in a Patcher, as PNGs
@@ -1095,6 +1107,25 @@ public:
                                  { cause.driverModule });
         }
 
+        // round 165e: the Visualizer's GPU view was drawing when the session ended (a driver crash, a hang, the machine
+        // going down): the Visualizer draws with the 2D renderer from now on (its GPU button turns it back on)
+        for (int i = uncleanSteps.size(); --i >= 0;)
+        {
+            if (uncleanSteps[i].contains (lynx::visualgl::stopNote))
+                break;
+            if (uncleanSteps[i].contains (lynx::visualgl::startNote))
+            {
+                if (lynx::visualgl::enabled())
+                {
+                    lynx::visualgl::setEnabled (false);
+                    message << "\n\n"
+                            << lynx::tr ("The Visualizer was drawing with the GPU (OpenGL) when it happened. It now draws without the GPU; its GPU "
+                                         "button turns it back on.");
+                }
+                break;
+            }
+        }
+
         const auto session = lynx::crashreporter::parseSession (uncleanSessionText);
         auto* devices = engine != nullptr ? &engine->getDeviceManager() : nullptr;
         const auto action = lynx::crashreport::actionFor (lynx::crashreporter::consent());
@@ -4831,6 +4862,59 @@ private:
         quit();
     }
 
+    void runDanceShot (const juce::String& prefix)
+    {
+        juce::LookAndFeel::setDefaultLookAndFeel (&lookAndFeel);
+        // the moves: one row each, eight moments of a cycle (both facings for Spinning; Pose ends the sheet)
+        {
+            constexpr int cell = 120, cols = 8;
+            juce::Image sheet (juce::Image::ARGB, 130 + cols * cell, lynx::dance::moveCount * cell + 10, true);
+            juce::Graphics g (sheet);
+            g.fillAll (lynx::theme::colour::bg0);
+            for (int m = 0; m < lynx::dance::moveCount; ++m)
+            {
+                g.setColour (lynx::theme::colour::textSecondary);
+                g.setFont (14.0f);
+                g.drawText (lynx::dance::moveName (m), 8, m * cell + 5, 118, cell, juce::Justification::centredLeft);
+                for (int k = 0; k < cols; ++k)
+                {
+                    const auto pose = lynx::dance::pose (m, k / (double) cols + (m == lynx::dance::freestyle ? k * 2 : 0), 1);
+                    lynx::dancer::draw (g, { 130.0f + (k + 0.5f) * cell, (float) (m + 1) * cell - 6.0f }, 92.0f, pose, false, juce::Colour (0xffff3048));
+                }
+            }
+            savePng (sheet, prefix + "-moves.png");
+        }
+        lynx::AudioEngine offline (false);
+        lynx::Song song;
+        song.mixer = lynx::Song::defaultMixer (2);
+        for (int d = 0; d < 2; ++d)
+        {
+            lynx::ChannelDef c;
+            c.name = d == 0 ? "Fruity Dance" : "Fruity Dance #2";
+            c.instrument = lynx::InstrumentKind::fruitydance;
+            lynx::dance::Settings s;
+            s.move = d == 0 ? lynx::dance::stepping : lynx::dance::waving;
+            s.x = d == 0 ? 520 : 760;
+            s.y = 560;
+            s.colour = d == 0 ? 0xffff3048 : 0xff30a8ff;
+            s.mirrored = d == 1;
+            c.pluginState = lynx::dance::toState (s);
+            song.channels.push_back (c);
+        }
+        song.patterns.emplace_back();
+        {
+            const juce::File demo (prefix + "-demo.lynx");
+            juce::String error;
+            lynx::ProjectFile::save (song, demo, error);
+        }
+        offline.setSong (std::move (song));
+        offline.dispatchPendingMessages();
+        if (auto editor = lynx::makeChannelSettingsPanel (offline, 0))
+            savePng (editor->createComponentSnapshot (editor->getLocalBounds()), prefix + "-editor.png");
+        if (auto frame = lynx::makeChannelFrame (offline, 1, 0))
+            savePng (frame->createComponentSnapshot (frame->getLocalBounds()), prefix + "-frame.png");
+    }
+
     void runControllerShot (const juce::String& prefix)
     {
         juce::LookAndFeel::setDefaultLookAndFeel (&lookAndFeel);

+ 2 - 1
src/core/FlpImport.cpp

@@ -1481,7 +1481,8 @@ Song importFlp (const flp::Project& input, const FlpImportOptions& options)
                 if (harmorStateUsable (c.pluginState))
                 {
                     def.instrument = InstrumentKind::harmor;
-                    def.pluginState = c.pluginState;
+                    // an old (version 11…15) state is stored in the current layout, as FL re-saves it (REA_rodada165g-flbeta165s §1)
+                    def.pluginState = harmorUpgradeState (c.pluginState).value_or (c.pluginState);
                     adoptedFromPlugin = true;
                     // rack compressor: Harmor's own preset System\Compression\<n>.fst from the user's installation
                     // (REA_rodada38); its Maximus state goes into modelParams (size, bytes…)

+ 401 - 0
src/core/FruityDance.cpp

@@ -0,0 +1,401 @@
+#include "core/FruityDance.h"
+
+#include <algorithm>
+#include <cmath>
+#include <cstdio>
+#include <cstring>
+#include <sstream>
+
+#include "core/Instruments.h"
+
+namespace lynx::dance
+{
+namespace
+{
+constexpr float twoPi = 6.28318530718f;
+
+const char* moveIds[] = { "freestyle", "waiting", "stepping", "jumping", "zombie", "waving", "hula", "windmill", "flail", "spin", "held" };
+
+std::uint32_t mixBits (std::uint32_t x) noexcept
+{
+    x ^= x >> 16;
+    x *= 0x7feb352du;
+    x ^= x >> 15;
+    x *= 0x846ca68bu;
+    x ^= x >> 16;
+    return x;
+}
+
+float smooth (float t) noexcept { return t * t * (3.0f - 2.0f * t); }
+} // namespace
+
+const char* moveName (int move) noexcept
+{
+    switch (std::clamp (move, 0, moveCount - 1))
+    {
+        case freestyle: return "Freestyle";
+        case waiting: return "Waiting";
+        case stepping: return "Stepping";
+        case jumping: return "Jumping";
+        case zombie: return "Zombie";
+        case waving: return "Waving";
+        case hula: return "Hula";
+        case windmill: return "Windmill";
+        case flail: return "Flailing";
+        case spin: return "Spinning";
+        case held: return "Pose";
+    }
+    return "Freestyle";
+}
+
+std::vector<std::uint8_t> toState (const Settings& s)
+{
+    std::ostringstream o;
+    char colour[16];
+    std::snprintf (colour, sizeof (colour), "%08x", s.colour);
+    o << "LYNX dance 1\nmove=" << moveIds[std::clamp (s.move, 0, moveCount - 1)] << "\nmirrored=" << (s.mirrored ? 1 : 0)
+      << "\nvisible=" << (s.visible ? 1 : 0) << "\nscale=" << s.scale << "\nspeed=" << s.speed << "\nx=" << s.x << "\ny=" << s.y
+      << "\ncolour=" << colour << "\n";
+    const auto t = o.str();
+    return { t.begin(), t.end() };
+}
+
+std::optional<Settings> fromState (const std::vector<std::uint8_t>& state)
+{
+    const std::string text (state.begin(), state.end());
+    if (text.rfind ("LYNX dance", 0) != 0)
+        return std::nullopt;
+    Settings s;
+    std::istringstream in (text);
+    std::string line;
+    std::getline (in, line);
+    auto num = [] (const std::string& v, float lo, float hi, float fallback) {
+        const auto f = std::strtof (v.c_str(), nullptr);
+        return std::isfinite (f) ? std::clamp (f, lo, hi) : fallback;
+    };
+    while (std::getline (in, line))
+    {
+        if (! line.empty() && line.back() == '\r')
+            line.pop_back();
+        const auto eq = line.find ('=');
+        if (eq == std::string::npos)
+            continue;
+        const auto key = line.substr (0, eq), value = line.substr (eq + 1);
+        if (key == "move")
+        {
+            for (int m = 0; m < moveCount; ++m)
+                if (value == moveIds[m])
+                    s.move = m;
+        }
+        else if (key == "mirrored")
+            s.mirrored = value != "0";
+        else if (key == "visible")
+            s.visible = value != "0";
+        else if (key == "scale")
+            s.scale = num (value, 0.25f, 3.0f, 1.0f);
+        else if (key == "speed")
+            s.speed = num (value, 0.125f, 4.0f, 1.0f);
+        else if (key == "x")
+            s.x = std::clamp (std::atoi (value.c_str()), -10000, 10000);
+        else if (key == "y")
+            s.y = std::clamp (std::atoi (value.c_str()), -10000, 10000);
+        else if (key == "colour")
+            s.colour = (std::uint32_t) std::strtoul (value.c_str(), nullptr, 16) | 0xff000000u;
+    }
+    return s;
+}
+
+std::optional<Settings> fromFl (const std::vector<std::uint8_t>& state)
+{
+    if (state.size() < 40)
+        return std::nullopt;
+    auto i32 = [&state] (std::size_t at) {
+        std::int32_t v = 0;
+        std::memcpy (&v, state.data() + at, 4);
+        return v;
+    };
+    const auto version = i32 (0);
+    if (version < 1 || version > 16)
+        return std::nullopt;
+    Settings s;
+    // params 0 … 6 (FL: move, mirrored, shown, scale /64, speed, x, y)
+    s.move = std::clamp ((int) i32 (4), 0, moveCount - 1);
+    s.mirrored = i32 (8) > 0;
+    s.visible = i32 (12) > 0;
+    s.scale = std::clamp ((float) i32 (16) / 64.0f, 0.25f, 3.0f);
+    // FL's speed: 0.5 × (1 + |v| × 3 / 96) (or divided by it): LYNX keeps the ratio to the default 0.5
+    const auto v = i32 (20);
+    const auto d = 1.0f + (float) std::abs (v) * 3.0f / 96.0f;
+    s.speed = std::clamp (v < 0 ? 1.0f / d : d, 0.125f, 4.0f);
+    s.x = std::clamp ((int) i32 (24), -10000, 10000);
+    s.y = std::clamp ((int) i32 (28), -10000, 10000);
+    return s;
+}
+
+Settings read (const std::vector<std::uint8_t>& state)
+{
+    if (auto s = fromState (state))
+        return *s;
+    if (auto s = fromFl (state))
+        return *s;
+    return {};
+}
+
+KeyAction actionForKey (int key) noexcept
+{
+    KeyAction a;
+    if (key >= firstMoveKey && key < firstMoveKey + moveCount)
+    {
+        a.kind = KeyAction::Kind::move;
+        a.move = key - firstMoveKey;
+    }
+    else if (key <= firstMirrorKey && key > firstMirrorKey - moveCount)
+    {
+        a.kind = KeyAction::Kind::move;
+        a.move = firstMirrorKey - key;
+        a.mirrored = true;
+    }
+    else if (key == hideKey)
+        a.kind = KeyAction::Kind::hide;
+    else if (key == showKey)
+        a.kind = KeyAction::Kind::show;
+    return a;
+}
+
+Pose Pose::mix (const Pose& a, const Pose& b, float t) noexcept
+{
+    auto m = [t] (float x, float y) { return x + (y - x) * t; };
+    Pose p;
+    p.x = m (a.x, b.x);
+    p.y = m (a.y, b.y);
+    p.lean = m (a.lean, b.lean);
+    p.head = m (a.head, b.head);
+    p.turn = m (a.turn, b.turn);
+    p.squash = m (a.squash, b.squash);
+    p.hipShift = m (a.hipShift, b.hipShift);
+    p.tail = m (a.tail, b.tail);
+    for (int i = 0; i < 2; ++i)
+    {
+        p.shoulder[(std::size_t) i] = m (a.shoulder[(std::size_t) i], b.shoulder[(std::size_t) i]);
+        p.elbow[(std::size_t) i] = m (a.elbow[(std::size_t) i], b.elbow[(std::size_t) i]);
+        p.hip[(std::size_t) i] = m (a.hip[(std::size_t) i], b.hip[(std::size_t) i]);
+        p.knee[(std::size_t) i] = m (a.knee[(std::size_t) i], b.knee[(std::size_t) i]);
+    }
+    return p;
+}
+
+int freestyleMove (std::int64_t cycleIndex, std::uint32_t seed) noexcept
+{
+    // two cycles per choice; Stepping … Spinning
+    const auto h = mixBits ((std::uint32_t) (cycleIndex / 2) * 2654435761u ^ seed);
+    return stepping + (int) (h % (std::uint32_t) (spin - stepping + 1));
+}
+
+Pose pose (int move, double cycles, std::uint32_t seed) noexcept
+{
+    if (move == freestyle)
+    {
+        const auto index = (std::int64_t) std::floor (cycles);
+        const auto now = freestyleMove (index, seed);
+        const auto before = freestyleMove (index - 1, seed);
+        const auto within = (float) (cycles - std::floor (cycles));
+        if (now != before && (index % 2) == 0 && within < 0.25f) // a short blend into the new move
+            return Pose::mix (pose (before, cycles, seed), pose (now, cycles, seed), smooth (within / 0.25f));
+        return pose (now, cycles, seed);
+    }
+    const auto phase = (float) (cycles - std::floor (cycles)); // 0..1 within the cycle
+    const auto s = std::sin (twoPi * phase), c = std::cos (twoPi * phase);
+    const auto s2 = std::sin (2.0f * twoPi * phase);
+    Pose p;
+    // rest: arms down a little out, legs straight
+    p.shoulder = { 0.25f, -0.25f };
+    p.elbow = { 0.15f, -0.15f };
+    p.hip = { 0.08f, -0.08f };
+    switch (move)
+    {
+        case waiting:
+        {
+            const auto slow = (float) std::sin (twoPi * cycles * 0.25);
+            p.y = 0.006f * s;
+            p.lean = 0.03f * slow;
+            p.head = 0.08f * slow;
+            p.tail = 0.3f * s;
+            p.shoulder = { 0.18f, -0.18f };
+            // a foot taps on the beat
+            p.knee = { 0.0f, phase < 0.3f ? -0.35f * std::sin (twoPi * phase / 0.6f) : 0.0f };
+            p.hip[1] = phase < 0.3f ? 0.15f * std::sin (twoPi * phase / 0.6f) : -0.08f;
+            break;
+        }
+        case stepping:
+        {
+            p.hipShift = 0.07f * s;
+            p.x = 0.04f * s;
+            p.y = 0.02f * std::abs (s2);
+            p.lean = -0.08f * s;
+            p.head = 0.1f * s;
+            p.hip = { 0.12f + 0.18f * std::max (0.0f, s), -0.12f + 0.18f * std::min (0.0f, s) };
+            p.knee = { -0.5f * std::max (0.0f, s), 0.5f * std::max (0.0f, -s) };
+            p.shoulder = { 0.3f - 0.45f * s, -0.3f - 0.45f * s };
+            p.elbow = { 0.6f, -0.6f };
+            p.tail = -0.5f * s;
+            break;
+        }
+        case jumping:
+        {
+            const auto up = std::abs (std::sin (0.5f * twoPi * phase * 2.0f)); // two hops a cycle
+            const auto hop = up * up;
+            p.y = 0.16f * hop;
+            p.squash = 1.0f - 0.12f * (1.0f - up) * (1.0f - up);
+            p.shoulder = { 0.5f + 2.2f * hop, -0.5f - 2.2f * hop };
+            p.elbow = { 0.3f * (1.0f - hop), -0.3f * (1.0f - hop) };
+            p.hip = { 0.2f, -0.2f };
+            p.knee = { -0.9f * (1.0f - up), 0.9f * (1.0f - up) };
+            p.tail = 0.8f * hop;
+            break;
+        }
+        case zombie:
+        {
+            p.x = 0.03f * s;
+            p.lean = 0.12f + 0.05f * s;
+            p.head = 0.35f + 0.1f * c;
+            p.shoulder = { 1.5f + 0.1f * s, -1.5f + 0.1f * c }; // arms out in front
+            p.elbow = { 0.05f, -0.05f };
+            p.hip = { 0.1f + 0.2f * std::max (0.0f, s), -0.1f + 0.2f * std::min (0.0f, s) };
+            p.knee = { -0.3f * std::max (0.0f, s), 0.3f * std::max (0.0f, -s) };
+            p.y = -0.01f;
+            p.tail = 0.1f * s;
+            break;
+        }
+        case waving:
+        {
+            p.lean = 0.06f * s;
+            p.head = -0.12f + 0.08f * s;
+            p.shoulder = { 2.6f, -0.9f }; // left arm up, right on the hip
+            p.elbow = { 0.5f + 0.6f * s2, -1.9f };
+            p.hipShift = 0.03f * s;
+            p.y = 0.012f * std::abs (s);
+            p.tail = 0.6f * s2;
+            break;
+        }
+        case hula:
+        {
+            p.hipShift = 0.09f * s;
+            p.y = 0.015f * c;
+            p.lean = -0.12f * s;
+            p.head = 0.12f * s;
+            p.shoulder = { 1.5f + 0.25f * s, -1.5f + 0.25f * s }; // arms out, waving
+            p.elbow = { 0.6f * c, -0.6f * c };
+            p.knee = { -0.25f, 0.25f };
+            p.hip = { 0.15f, -0.15f };
+            p.tail = 0.9f * s;
+            break;
+        }
+        case windmill:
+        {
+            const auto a = twoPi * phase;
+            p.shoulder = { a, -1.2f + 0.8f * std::sin (a + 1.5f) }; // one arm circles
+            p.elbow = { 0.0f, -0.4f };
+            p.lean = 0.1f * std::sin (a);
+            p.y = 0.03f * std::abs (std::sin (a));
+            p.hip = { 0.2f, -0.2f };
+            p.knee = { -0.3f * std::abs (s), 0.3f * std::abs (s) };
+            p.tail = std::sin (a);
+            break;
+        }
+        case flail:
+        {
+            // fast and a bit random: arms and legs everywhere
+            auto jitter = [seed, cycles] (int k) {
+                const auto t = (float) (cycles * 4.0 + k * 0.37);
+                const auto i = (std::uint32_t) std::floor (t);
+                const auto f = smooth (t - std::floor (t));
+                auto r = [seed, k] (std::uint32_t n) { return (float) (mixBits (n * 7919u + (std::uint32_t) k * 104729u + seed) & 0xffff) / 65535.0f * 2.0f - 1.0f; };
+                return r (i) + (r (i + 1) - r (i)) * f;
+            };
+            p.shoulder = { 1.5f + 1.3f * jitter (1), -1.5f + 1.3f * jitter (2) };
+            p.elbow = { 1.0f * jitter (3), 1.0f * jitter (4) };
+            p.hip = { 0.4f * jitter (5), 0.4f * jitter (6) };
+            p.knee = { -0.6f * std::abs (jitter (7)), 0.6f * std::abs (jitter (8)) };
+            p.lean = 0.15f * jitter (9);
+            p.head = 0.3f * jitter (10);
+            p.y = 0.05f * std::abs (jitter (11));
+            p.x = 0.04f * jitter (12);
+            p.tail = 1.2f * jitter (13);
+            break;
+        }
+        case spin:
+        {
+            p.turn = std::cos (twoPi * phase);
+            p.shoulder = { 1.55f, -1.55f }; // arms out
+            p.elbow = { 0.1f * s, -0.1f * s };
+            p.head = 0.15f * s;
+            p.hip = { 0.05f, -0.05f };
+            p.y = 0.01f * std::abs (s2);
+            p.tail = 1.0f;
+            break;
+        }
+        case held:
+        {
+            p.shoulder = { 2.4f, -2.4f }; // arms up in a V
+            p.elbow = { -0.1f, 0.1f };
+            p.hip = { 0.3f, -0.3f };
+            p.head = -0.1f;
+            p.y = 0.005f * s;
+            p.tail = 0.4f;
+            break;
+        }
+        default: break;
+    }
+    return p;
+}
+
+// ---------------------------------------------------------------------------------------------------------------
+// The silent instrument
+// ---------------------------------------------------------------------------------------------------------------
+void Signals::push (int key) noexcept
+{
+    const auto n = count.load (std::memory_order_relaxed);
+    ring[n % ring.size()].store (key, std::memory_order_relaxed);
+    count.store (n + 1, std::memory_order_release);
+}
+
+int Signals::pull (std::uint32_t& seen, int* keys, int max) const noexcept
+{
+    const auto n = count.load (std::memory_order_acquire);
+    auto from = seen;
+    if (n - from > (std::uint32_t) ring.size())
+        from = n - (std::uint32_t) ring.size();
+    int got = 0;
+    for (auto i = from; i != n && got < max; ++i)
+        keys[got++] = ring[i % ring.size()].load (std::memory_order_relaxed);
+    seen = n;
+    return got;
+}
+
+namespace
+{
+class DanceInstrument final : public Instrument
+{
+public:
+    void prepare (double) noexcept override {}
+    void noteOn (int key, float) noexcept override { signals.push (key); }
+    void noteOff (int) noexcept override {}
+    void allNotesOff() noexcept override {}
+    void render (float*, float*, int, float, float) noexcept override {}
+    bool idle() const noexcept override { return true; } // (never a voice: its render can be skipped)
+
+    Signals signals;
+};
+} // namespace
+
+std::unique_ptr<Instrument> makeInstrument()
+{
+    return std::make_unique<DanceInstrument>();
+}
+
+Signals* signalsOf (Instrument* instrument) noexcept
+{
+    auto* d = dynamic_cast<DanceInstrument*> (instrument);
+    return d != nullptr ? &d->signals : nullptr;
+}
+} // namespace lynx::dance

+ 103 - 0
src/core/FruityDance.h

@@ -0,0 +1,103 @@
+#pragma once
+
+// LYNX Dance (round 165e, docs/analise/REA_rodada165e.md): FL's Fruity Dance role — an animated dancer over the
+// workspace whose moves the channel's notes pick — with LYNX's own procedural character (no FL artwork). No sound.
+//
+// FL's behaviour, read in its plugin (REA round 68 §8 and round 165e): a note picks a move (the keys from B4 up: 0 =
+// Freestyle, then the moves in order), the keys from C4 down play the same moves mirrored, F4 hides the dancer and F#4
+// shows it; the note itself makes no sound and ends at once — the move stays until the next note. The animation follows
+// the song position, with a speed setting. The saved state (int version; seven ints: move, mirrored, shown, a scale,
+// speed, x, y (the dancer's bottom centre in the main window); one int and four flags of display options; version 2 adds
+// a picture path) is read when an FL project is imported.
+// No JUCE here (tests/Dance165Tests.inc).
+
+#include <array>
+#include <atomic>
+#include <cstdint>
+#include <memory>
+#include <optional>
+#include <string>
+#include <vector>
+
+namespace lynx
+{
+class Instrument;
+}
+
+namespace lynx::dance
+{
+enum Move : int { freestyle, waiting, stepping, jumping, zombie, waving, hula, windmill, flail, spin, held };
+constexpr int moveCount = 11;
+const char* moveName (int move) noexcept; // English (the UI translates)
+
+struct Settings
+{
+    int move = stepping;
+    bool mirrored = false;
+    bool visible = true;
+    float scale = 1.0f;      // size (FL's scale value / 64)
+    float speed = 1.0f;      // moves per beat relative to the default
+    int x = 412, y = 500;    // the dancer's bottom centre in the main window, in pixels (FL's defaults)
+    std::uint32_t colour = 0xffff3048; // the outfit (ARGB)
+
+    bool operator== (const Settings&) const = default;
+};
+
+// LYNX's own state ("LYNX dance 1", key=value lines)
+std::vector<std::uint8_t> toState (const Settings& s);
+std::optional<Settings> fromState (const std::vector<std::uint8_t>& state);
+// FL's Fruity Dance state (40 bytes or more); nullopt = not one
+std::optional<Settings> fromFl (const std::vector<std::uint8_t>& state);
+// either (LYNX's text first, then FL's bytes); the defaults when neither
+Settings read (const std::vector<std::uint8_t>& state);
+
+// What a note does (FL's key map)
+struct KeyAction
+{
+    enum class Kind { none, move, hide, show };
+    Kind kind = Kind::none;
+    int move = 0;
+    bool mirrored = false;
+};
+KeyAction actionForKey (int key) noexcept;
+constexpr int firstMoveKey = 59;   // B4: Freestyle; C5 … A5: the moves
+constexpr int firstMirrorKey = 48; // C4: Freestyle mirrored; down to D#3
+constexpr int hideKey = 53, showKey = 54;
+
+// The body at a moment: angles in radians (0 = hanging down for limbs, upright for the torso), lengths in body units
+// (the figure is about 1.0 tall), the origin between the feet.
+struct Pose
+{
+    float x = 0.0f, y = 0.0f;  // the whole body's offset (y up)
+    float lean = 0.0f;         // torso tilt (positive = to the right)
+    float head = 0.0f;         // head tilt
+    float turn = 1.0f;         // −1 … 1: the body's facing (a spin squeezes it through 0)
+    float squash = 1.0f;       // vertical squash on landings
+    float hipShift = 0.0f;     // hips sideways
+    std::array<float, 2> shoulder {}, elbow {}, hip {}, knee {}; // [0] left, [1] right (as seen)
+    float tail = 0.0f;
+
+    static Pose mix (const Pose& a, const Pose& b, float t) noexcept;
+};
+// `cycles`: the move's own clock (one cycle = one beat at speed 1, the song's beats while playing); `seed` varies
+// Freestyle's choices. Deterministic.
+Pose pose (int move, double cycles, std::uint32_t seed = 0) noexcept;
+// Freestyle: the move of cycle `n` (never Waiting or Held)
+int freestyleMove (std::int64_t cycleIndex, std::uint32_t seed) noexcept;
+
+// The silent instrument of a dance channel: its notes go to the UI through a small lock-free queue (the audio thread
+// only stores the key and counts).
+class Signals
+{
+public:
+    void push (int key) noexcept;
+    // UI: the keys since `seen` (oldest first, at most 16), `seen` moved on
+    int pull (std::uint32_t& seen, int* keys, int max) const noexcept;
+
+private:
+    std::array<std::atomic<int>, 16> ring {};
+    std::atomic<std::uint32_t> count { 0 };
+};
+std::unique_ptr<Instrument> makeInstrument();
+Signals* signalsOf (Instrument* instrument) noexcept; // nullptr: not a dance channel
+} // namespace lynx::dance

+ 232 - 4
src/core/Harmor.cpp

@@ -318,7 +318,131 @@ bool readArt (Reader& r, ArtData& a)
     return r.ok;
 }
 
+// ---------------------------------------------------------------------------------------------------------------
+// Old states (version 11…15, the factory presets of Harmor's first releases, Default.fst included) as the DLL's loader
+// brings them into the current layout (REA_rodada165g-flbeta165s §1, [DECOMP FUN_0086ed30] + [EXEC] DLL re-saves): a part
+// stores 385 integers — the articulator-33 smoothing (index 376) is missing, so a 0 is inserted there; version 11 also
+// stores the 43 smoothing times (343…385) on an older scale, converted as round(log2(1 + (41^(v/1000) − 1)·37.5·0.0511)·
+// 1000/9); articulator 33 is not stored and gets its defaults. The global block's text becomes an empty string plus
+// the option byte 1 (what the DLL writes for these states). Bytes = the DLL's own re-save of the 88 old factory
+// presets, except shaping-curve point positions the DLL renormalises at load (sub-ulp of the curve length).
+
+std::optional<std::vector<std::uint8_t>> upgradeOldState (const std::vector<std::uint8_t>& d)
+{
+    if (d.size() < 8)
+        return std::nullopt;
+    std::uint32_t v = 0, mask = 0;
+    std::memcpy (&v, d.data(), 4);
+    std::memcpy (&mask, d.data() + 4, 4);
+    if (v > 0xffff)
+        v >>= 16;
+    if (v < 11 || v >= 16 || (mask & 3u) == 0 || (mask & 4u) == 0)
+        return std::nullopt;
+    std::vector<std::uint8_t> out;
+    auto put = [&out] (std::int32_t x) {
+        std::uint8_t b[4];
+        std::memcpy (b, &x, 4);
+        out.insert (out.end(), b, b + 4);
+    };
+    auto putD = [&out] (double x) {
+        std::uint8_t b[8];
+        std::memcpy (b, &x, 8);
+        out.insert (out.end(), b, b + 8);
+    };
+    put (0x130003);
+    put ((std::int32_t) mask);
+    std::size_t o = 8;
+    for (int part = 0; part < 2; ++part)
+    {
+        if (((mask >> part) & 1u) == 0)
+            continue;
+        if (o + 4 > d.size())
+            return std::nullopt;
+        std::uint32_t sz = 0;
+        std::memcpy (&sz, d.data() + o, 4);
+        const auto end = o + 4 + (std::size_t) sz;
+        if (end > d.size() || sz < 4 * 385 + 0x30 + 0x4b)
+            return std::nullopt;
+        std::vector<std::int32_t> p (385);
+        std::memcpy (p.data(), d.data() + o + 4, 4 * 385);
+        p.insert (p.begin() + 376, 0);
+        if (v < 12)
+            for (std::size_t i = 343; i < 386; ++i)
+            {
+                const auto x = (double) (float) ((float) p[i] * 0.001f);
+                const auto t = std::exp (x * std::log (41.0));
+                const auto y = std::log ((double) (float) (t - 1.0) * 37.5 * 0.0511 + 1.0);
+                p[i] = (std::int32_t) std::nearbyint (y * (1.0 / std::log (2.0)) * 111.11111111111111);
+            }
+        const auto sizeAt = out.size();
+        put (0);
+        for (const auto x : p)
+            put (x);
+        Reader r { d.data(), end, o + 4 + 4 * 385 };
+        r.i += 0x30 + 0x4b;
+        out.insert (out.end(), d.begin() + (std::ptrdiff_t) (o + 4 + 4 * 385), d.begin() + (std::ptrdiff_t) r.i);
+        for (int k = 0; k < 43; ++k)
+        {
+            if (k == 33)
+            {
+                // the defaults of an articulator: off, amounts 1, envelope at 0.5, LFO at 0.75, flat maps at 0.5
+                auto curve = [&] (int kind, std::initializer_list<std::pair<double, double>> pts, std::array<std::int32_t, 5> hdr) {
+                    put (kind);
+                    put (3);
+                    put ((std::int32_t) pts.size());
+                    for (const auto& [x, y] : pts)
+                    {
+                        putD (x);
+                        putD (y);
+                        put (0);
+                        put (0);
+                    }
+                    for (const auto h : hdr)
+                        put (h);
+                };
+                put (3);
+                put (0);
+                put (0x3f800000);
+                put (0x3f800000);
+                curve (1, { { 0.0, 0.5 } }, { 0, 0, -1, -1, -1 });
+                for (const auto a : { 128, 128, 0, 128 })
+                    put (a);
+                curve (2, { { 0.0, 0.75 } }, { 0, 0, -1, -1, -1 });
+                for (const auto a : { 40898, 0, 0, 0, 0 })
+                    put (a);
+                for (int m = 0; m < 9; ++m)
+                    curve (3, { { 0.0, 0.5 }, { 1.0, 0.5 } }, { 0, -1, -1, -1, -1 });
+                continue;
+            }
+            const auto from = r.i;
+            ArtData a;
+            if (! readArt (r, a))
+                return std::nullopt;
+            out.insert (out.end(), d.begin() + (std::ptrdiff_t) from, d.begin() + (std::ptrdiff_t) r.i);
+        }
+        out.insert (out.end(), d.begin() + (std::ptrdiff_t) r.i, d.begin() + (std::ptrdiff_t) end);
+        const auto blockSize = (std::int32_t) (out.size() - sizeAt - 4);
+        std::memcpy (out.data() + sizeAt, &blockSize, 4);
+        o = end;
+    }
+    if (o + 0xd4 + 0x18 + 0x3d > d.size())
+        return std::nullopt;
+    out.insert (out.end(), d.begin() + (std::ptrdiff_t) o, d.begin() + (std::ptrdiff_t) (o + 0xd4 + 0x18 + 0x3d));
+    out.push_back (0); // the preset text (empty)
+    out.push_back (1); // option byte
+    return out;
+}
+
+std::optional<StateData> parseCurrent (const std::vector<std::uint8_t>& d);
+
 std::optional<StateData> parseState (const std::vector<std::uint8_t>& d)
+{
+    if (auto up = upgradeOldState (d))
+        return parseCurrent (*up);
+    return parseCurrent (d);
+}
+
+std::optional<StateData> parseCurrent (const std::vector<std::uint8_t>& d)
 {
     if (d.size() < 8)
         return std::nullopt;
@@ -1454,6 +1578,86 @@ std::optional<Table> shapeTable (int code, const Curve* curve)
         }
         T = Table (std::move (t), 0.5 * 4095, 1, 1);
     }
+    // the filter shapes 8, 10…13, 15, 16 (REA_rodada165g-flbeta165s §4, [DECOMP FUN_00874ed0] + DLL constants)
+    else if (code == 8 || code == 10)
+    {
+        const int N = code == 8 ? 682 : 1365;
+        auto t = mk (N, s);
+        for (int i = 0; i < N; ++i)
+        {
+            const auto c = std::cos ((1.0 - i * s * 0.5) * pi);
+            if (code == 8)
+                t[(std::size_t) i] = (float) (1.0 - (c + 1.0));
+            else
+            {
+                const auto u = 1.0 - (1.0 - (c + 1.0));
+                t[(std::size_t) i] = (float) (dbOf2 (u) * (1.0 - p16 (u)));
+            }
+        }
+        T = Table (std::move (t), 0, 1, 0);
+    }
+    else if (code == 11)
+    {
+        auto t = mk (1024, s);
+        for (int i = 0; i < 1024; ++i)
+        {
+            const auto a = 1.0 - (std::cos ((1.0 - i * s) * 9.42477796076938) + 1.0) * 0.5;
+            t[(std::size_t) i] = (float) (a * (1.0 - (std::cos ((1.0 - i * s) * pi) + 1.0) * 0.5));
+        }
+        T = Table (std::move (t), 0, 1, 0);
+    }
+    else if (code == 12)
+    {
+        const int N = 4096, half = N / 2;
+        auto t = mk (N, s);
+        for (int i = 0; i < N; ++i)
+            if (i < half)
+            {
+                const auto v = 1.0 - (std::cos ((1.0 - i * s) * twoPi) + 1.0) * 0.25;
+                t[(std::size_t) i] = (float) (v * v);
+            }
+            else
+            {
+                const auto x = (double) (i - half) * s * 2.0;
+                t[(std::size_t) i] = (float) (dbOf2 (x) * (1.0 - p16 (x)));
+            }
+        T = Table (std::move (t), 0.5 * (N - 1), 1, 0);
+    }
+    else if (code == 13)
+    {
+        auto t = mk (1024, s);
+        for (int i = 0; i < 1024; ++i)
+        {
+            const auto c = std::cos ((1.0 - i * s) * pi);
+            const auto a = (float) ((1.0 - (c + 1.0) * 0.5) * 18.0 + -18.0);
+            t[(std::size_t) i] = (float) std::exp ((double) (a * (float) ln10over20));
+        }
+        T = Table (std::move (t), 0, 1, 0);
+    }
+    else if (code == 15)
+    {
+        auto t = mk (4096, s);
+        for (int i = 0; i < 4096; ++i)
+        {
+            const auto a = (std::cos ((1.0 - i * s) * 37.69911184307752) + 1.0) * 0.5;
+            const auto b = 1.0 - (std::cos ((1.0 - i * s) * twoPi) + 1.0) * 0.5;
+            t[(std::size_t) i] = (float) (a * a * b * b + b * 0.125);
+        }
+        T = Table (std::move (t), 0.5 * 4095, 1, 1);
+    }
+    else if (code == 16)
+    {
+        const int N = 2048, M = N / 3;
+        std::vector<float> t ((std::size_t) N, 1.0f);
+        s = 0.5 / M;
+        for (int i = 0; i < M; ++i)
+        {
+            auto v = 1.0 - (std::cos ((1.0 - i * s) * twoPi) + 1.0) * 0.5;
+            v = v * v;
+            t[(std::size_t) i] = t[(std::size_t) (N - 1 - i)] = (float) v;
+        }
+        T = Table (std::move (t), 0.5 * (N - 1), 1, 1);
+    }
     else if (code == 100 || code == 108)
     {
         auto t = mk (1024, s);
@@ -1896,7 +2100,9 @@ ImageData parseImage (const std::vector<std::uint8_t>& t)
         im.why = "resynthesis-mode image (not modelled: the part plays its timbres)";
         return im;
     }
-    if (! r.ok || im.cols <= 0 || im.rows <= 0 || im.rows > 4096 || (long long) im.cols * im.rows > 64LL * 1024 * 1024)
+    if (r.ok && (im.cols == 0 || im.rows == 0))
+        return im; // (an empty image object: every part without an image stores one)
+    if (! r.ok || im.cols < 0 || im.rows < 0 || im.rows > 4096 || (long long) im.cols * im.rows > 64LL * 1024 * 1024)
     {
         im.why = "image data unreadable";
         return im;
@@ -2934,7 +3140,7 @@ struct Part
         }
         if (blend > 5)
             fallbacks.push_back ("timbre blend mode " + std::to_string (blend) + " (played as mode 0)");
-        if (pd.tail > 1024)
+        if (pd.tail >= 4 + 0x2c) // (any image object: Labyrinth's 16 × 12 one is 829 bytes)
             buildImage (pd);
     }
 
@@ -3299,7 +3505,7 @@ struct Patch
 {
     double fs = 44100.0, bpm = 120.0, fclamp = 0.0, coef = 0.0, masterTarget = 1.0;
     int B = 88, prec = 0, monoMode = 0, vrmode = 0, maxrk = 0, e8 = 0;
-    bool legato = false, porta = false;
+    bool legato = false, porta = false, portaVel = false; // portaVel: global 6, the glide time follows the velocity
     bool arpAny = false, arpDesc = false; // some envelope has arpeggio markers; chord order (global 16: descending)
     double legLim = 2147483647.0;
     float kfade = 0.0f;
@@ -3384,6 +3590,7 @@ std::shared_ptr<Patch> buildPatch (const StateData& S, double fs, double bpm, co
     P->kfade = (float) (1.0 / (P->e8 + 1));
     P->legato = S.g[4] > 0;
     P->porta = S.g[5] > 0;
+    P->portaVel = S.g[6] >= 1;
     P->monoMode = S.GI (8);
     P->vrmode = S.GI (12);
     P->legLim = S.g[3] > 0 ? (double) S.g[3] : 2147483647.0;
@@ -4339,6 +4546,13 @@ private:
     void glideTo (Record& v, const Levels& L, bool porta) noexcept
     {
         const auto& p = P->parts[(std::size_t) v.part];
+        // the note's glide factor ([DECOMP FUN_00883ae0, note set-up], REA_rodada165g-flbeta165s §2): 1, or (1 − 0.85·velocity)² in
+        // float when global 6 is on (a harder note glides faster)
+        if (P->portaVel && v.note >= 0 && v.note < maxNotes)
+        {
+            const auto x = (float) (1.0 - (double) (float) notes[(std::size_t) v.note].vel * 0.85);
+            v.vfac = x * x;
+        }
         auto lc = f32 (p.portaT * v.vfac);
         bool toX = false;
         if (lc > 0.0)
@@ -6152,9 +6366,23 @@ std::vector<std::string> harmorFallbacks (const std::vector<std::uint8_t>& state
     return buildPatch (*S, 44100.0, 120.0)->fallbacks;
 }
 
+std::optional<std::vector<std::uint8_t>> harmorUpgradeState (const std::vector<std::uint8_t>& state)
+{
+    try
+    {
+        auto up = upgradeOldState (state);
+        if (up && parseCurrent (*up))
+            return up;
+    }
+    catch (...)
+    {
+    }
+    return std::nullopt;
+}
+
 int harmorParamOffset (const std::vector<std::uint8_t>& state, int part, int index)
 {
-    const auto S = parseState (state);
+    const auto S = parseCurrent (state); // (offsets into this very state: an old layout has to be upgraded first)
     if (! S)
         return -1;
     if (part < 0)

+ 6 - 0
src/core/Harmor.h

@@ -34,6 +34,7 @@
 
 #include <cstdint>
 #include <memory>
+#include <optional>
 #include <string>
 #include <vector>
 
@@ -44,6 +45,11 @@ namespace lynx
 // true when the exact engine can play this Harmor state (version ≥ 16 with articulators and curves, parsed fully)
 bool harmorStateUsable (const std::vector<std::uint8_t>& state);
 
+// An old state (version 11…15: the first releases' presets, FL's Default.fst included) in the current layout, as
+// FL's Harmor re-saves it after loading (REA_rodada165g-flbeta165s §1); nullopt when the state is not an old one (or unreadable).
+// The engine plays old states directly; the importer stores the upgraded bytes so the settings panel can edit them.
+std::optional<std::vector<std::uint8_t>> harmorUpgradeState (const std::vector<std::uint8_t>& state);
+
 // the round-34 fallbacks this state relies on (empty: everything it uses is modelled), for logs and reports
 std::vector<std::string> harmorFallbacks (const std::vector<std::uint8_t>& state);
 

+ 5 - 2
src/core/Instruments.cpp

@@ -1,3 +1,4 @@
+#include "core/FruityDance.h"
 #include "core/Instruments.h"
 #include "core/ControlSurface.h"
 #include "core/VoltageController.h"
@@ -3019,8 +3020,10 @@ std::unique_ptr<Instrument> makeInstrument (InstrumentKind kind, std::shared_ptr
         return makeTransistorBassInstrument();
     if (kind == InstrumentKind::simsynth)
         return makeSimSynthInstrument();
-    if (kind == InstrumentKind::wasp || kind == InstrumentKind::fruitydance)
-        return makeWaspInstrument(); // both make no sound and keep their state
+    if (kind == InstrumentKind::wasp)
+        return makeWaspInstrument(); // makes no sound and keeps its state
+    if (kind == InstrumentKind::fruitydance)
+        return dance::makeInstrument(); // silent: its notes pick the dancer's moves (round 165e)
     if (kind == InstrumentKind::plucked)
         return makePluckedInstrument();
     if (kind == InstrumentKind::beepmap)

+ 521 - 10
src/core/VisualFx.cpp

@@ -532,11 +532,136 @@ std::string unescape (const std::string& t)
 }
 
 const char* bandIds[] = { "level", "bass", "mid", "high", "beat" };
-const char* typeIds[] = { "background", "bars", "circle", "waveform", "particles", "rings", "image", "text", "flash" };
+const char* typeIds[] = { "background", "bars", "circle", "waveform", "particles", "rings", "image", "text", "flash",
+                          "canvas", "terrain", "object3d", "feedback", "postprocess" };
+const char* blendIds[] = { "normal", "add", "screen", "multiply", "overlay", "difference", "lighten", "darken" };
+
+struct EffectDef
+{
+    const char* id;
+    const char* name;
+    const char* hint;
+};
+// (the knobs every shader reads: Size = scale, Amount = strength, Speed = motion, React = how much the band moves it,
+// Count = detail, X / Y = centre, the two colours = its palette)
+const EffectDef canvasFx[] = {
+    { "plasma", "Plasma", "Size: scale, Amount: colour bands, Count: layers of waves" },
+    { "tunnel", "Tunnel", "Size: ring spacing, Amount: twist, Speed: flight speed" },
+    { "cells", "Cells", "Size: cell size, Amount: border glow, Count: detail" },
+    { "kaleido", "Kaleidoscope", "Size: zoom, Amount: folds, Count: iterations" },
+    { "clouds", "Clouds", "Size: scale, Amount: density, Speed: drift" },
+    { "warp", "Warp stars", "Size: star size, Amount: streaks, Count: density" },
+    { "electric", "Electric", "Size: thickness, Amount: jitter, Count: bolts" },
+    { "rays", "Sun rays", "Size: sun size, Amount: ray strength, Count: rays" },
+};
+const EffectDef terrainFx[] = {
+    { "mountains", "Spectrum mountains", "The spectrum's history as a wire landscape. Size: height, Amount: line glow, Count: rows" },
+    { "hills", "Shaded hills", "A lit landscape shaped by the spectrum. Size: height, Amount: fog, Speed: flight speed" },
+    { "road", "Retro road", "A neon grid and a sun. Size: sun size, Amount: grid glow, Speed: flight speed" },
+};
+const EffectDef objectFx[] = {
+    { "blob", "Reactive sphere", "A sphere the bass deforms. Size: radius, Amount: deformation, Speed: spin" },
+    { "torus", "Torus", "Size: radius, Amount: thickness, Speed: spin" },
+    { "cubes", "Cube grid", "Columns that follow the spectrum. Size: height, Amount: spacing, Count: columns" },
+    { "rings", "Ring tunnel", "Rings flying past. Size: radius, Amount: thickness, Speed: flight speed" },
+};
+const EffectDef feedbackFx[] = {
+    { "zoom", "Zoom trails", "Size: zoom per frame, Amount: how long trails last" },
+    { "spin", "Spin tunnel", "Size: zoom per frame, Speed: rotation, Amount: trail length" },
+    { "kaleido", "Kaleido feedback", "Size: zoom, Amount: trail length, Count: mirror folds" },
+    { "warp", "Warp", "Size: warp scale, Amount: trail length, Speed: flow" },
+    { "echo", "Echo", "Amount: how long the picture stays" },
+    { "drift", "Smoke drift", "Speed: rise, Amount: trail length, Size: spread" },
+};
+const EffectDef postFx[] = {
+    { "bloom", "Bloom", "Glow around bright parts. Amount: strength, Size: radius, Count: threshold" },
+    { "blur", "Blur", "Size: radius, React: the band blurs it more" },
+    { "rgbshift", "RGB shift", "Amount: colour split, React: the band pushes it" },
+    { "pixelate", "Pixelate", "Size: pixel size" },
+    { "dots", "Dot matrix", "Size: dot size, Amount: dot sharpness" },
+    { "scanlines", "Scan lines", "Size: line spacing, Amount: darkness, Speed: roll" },
+    { "vignette", "Vignette", "Size: radius, Amount: darkness" },
+    { "color", "Colour correction", "Size: saturation, Amount: contrast, Speed: hue drift, colour A: tint" },
+    { "kaleido", "Kaleidoscope", "Count: folds, Speed: rotation" },
+    { "mirror", "Mirror", "Count: 1 left-right, 2 top-bottom, 3 both" },
+    { "edges", "Edge detect", "Amount: edge strength, colour A: edge colour" },
+    { "shake", "Shake", "Amount: how far the beat shakes the picture" },
+    { "glitch", "Glitch", "Amount: how often slices jump, React: the band triggers it" },
+    { "grain", "Film grain", "Amount: grain strength" },
+    { "invert", "Invert on beat", "React: how much the band inverts the colours" },
+};
+
+struct EffectList
+{
+    const EffectDef* list = nullptr;
+    int count = 0;
+};
+EffectList effectsOf (LayerType t) noexcept
+{
+    switch (t)
+    {
+        case LayerType::canvas: return { canvasFx, (int) std::size (canvasFx) };
+        case LayerType::terrain: return { terrainFx, (int) std::size (terrainFx) };
+        case LayerType::object3d: return { objectFx, (int) std::size (objectFx) };
+        case LayerType::feedback: return { feedbackFx, (int) std::size (feedbackFx) };
+        case LayerType::postprocess: return { postFx, (int) std::size (postFx) };
+        default: return {};
+    }
+}
 } // namespace
 
 const char* typeId (LayerType t) noexcept { return typeIds[(int) t]; }
 
+bool isShaderType (LayerType t) noexcept { return (int) t >= (int) LayerType::canvas; }
+bool readsBelow (LayerType t) noexcept { return t == LayerType::feedback || t == LayerType::postprocess; }
+
+int effectCount (LayerType t) noexcept { return effectsOf (t).count; }
+
+const char* effectId (LayerType t, int effect) noexcept
+{
+    const auto e = effectsOf (t);
+    return e.count == 0 ? "" : e.list[std::clamp (effect, 0, e.count - 1)].id;
+}
+
+const char* effectName (LayerType t, int effect) noexcept
+{
+    const auto e = effectsOf (t);
+    return e.count == 0 ? "" : e.list[std::clamp (effect, 0, e.count - 1)].name;
+}
+
+const char* effectHint (LayerType t, int effect) noexcept
+{
+    const auto e = effectsOf (t);
+    return e.count == 0 ? "" : e.list[std::clamp (effect, 0, e.count - 1)].hint;
+}
+
+int effectIndex (LayerType t, const std::string& id) noexcept
+{
+    const auto e = effectsOf (t);
+    for (int i = 0; i < e.count; ++i)
+        if (id == e.list[i].id)
+            return i;
+    return -1;
+}
+
+const char* blendId (Blend b) noexcept { return blendIds[(int) b]; }
+
+const char* blendName (Blend b) noexcept
+{
+    switch (b)
+    {
+        case Blend::normal: return "Normal";
+        case Blend::add: return "Add";
+        case Blend::screen: return "Screen";
+        case Blend::multiply: return "Multiply";
+        case Blend::overlay: return "Overlay";
+        case Blend::difference: return "Difference";
+        case Blend::lighten: return "Lighten";
+        case Blend::darken: return "Darken";
+    }
+    return "Normal";
+}
+
 const char* typeName (LayerType t) noexcept
 {
     switch (t)
@@ -550,6 +675,11 @@ const char* typeName (LayerType t) noexcept
         case LayerType::image: return "Image";
         case LayerType::text: return "Text";
         case LayerType::flash: return "Beat flash";
+        case LayerType::canvas: return "Canvas (GPU)";
+        case LayerType::terrain: return "Terrain 3D (GPU)";
+        case LayerType::object3d: return "3D object (GPU)";
+        case LayerType::feedback: return "Feedback (GPU)";
+        case LayerType::postprocess: return "Post-process (GPU)";
     }
     return "Layer";
 }
@@ -590,6 +720,10 @@ std::string write (const Scene& s)
             o << "text=" << escape (l.text) << "\n";
         if (! l.path.empty())
             o << "path=" << escape (l.path) << "\n";
+        if (isShaderType (l.type))
+            o << "effect=" << effectId (l.type, l.effect) << "\n";
+        if (l.blend != Blend::normal)
+            o << "blend=" << blendId (l.blend) << "\n";
     }
     return o.str();
 }
@@ -682,6 +816,14 @@ std::optional<Scene> parse (const std::string& text)
             l->text = unescape (value);
         else if (key == "path")
             l->path = unescape (value);
+        else if (key == "effect")
+            l->effect = std::max (0, effectIndex (l->type, value));
+        else if (key == "blend")
+        {
+            for (int b = 0; b < blendCount; ++b)
+                if (value == blendIds[b])
+                    l->blend = (Blend) b;
+        }
     }
     return s;
 }
@@ -699,6 +841,29 @@ std::optional<Scene> fromState (const std::vector<std::uint8_t>& state)
 
 namespace
 {
+// HSV (0..1 each) to ARGB
+std::uint32_t hsvArgb (float h, float s, float v, float alpha)
+{
+    h = h - std::floor (h);
+    s = std::clamp (s, 0.0f, 1.0f);
+    v = std::clamp (v, 0.0f, 1.0f);
+    const auto i = (int) (h * 6.0f) % 6;
+    const auto f = h * 6.0f - std::floor (h * 6.0f);
+    const auto pp = v * (1.0f - s), q = v * (1.0f - f * s), t = v * (1.0f - (1.0f - f) * s);
+    float r = v, g = t, b = pp;
+    switch (i)
+    {
+        case 0: r = v; g = t; b = pp; break;
+        case 1: r = q; g = v; b = pp; break;
+        case 2: r = pp; g = v; b = t; break;
+        case 3: r = pp; g = q; b = v; break;
+        case 4: r = t; g = pp; b = v; break;
+        default: r = v; g = pp; b = q; break;
+    }
+    auto byte = [] (float x) { return (std::uint32_t) std::lround (std::clamp (x, 0.0f, 1.0f) * 255.0f); };
+    return (byte (alpha) << 24) | (byte (r) << 16) | (byte (g) << 8) | byte (b);
+}
+
 Layer make (LayerType type, std::uint32_t a, std::uint32_t b, float x, float y, float size, Band band, float react)
 {
     Layer l;
@@ -714,6 +879,71 @@ Layer make (LayerType type, std::uint32_t a, std::uint32_t b, float x, float y,
 }
 } // namespace
 
+Layer shaderLayer (LayerType type, int effect)
+{
+    Layer l;
+    l.type = type;
+    l.effect = std::clamp (effect, 0, std::max (0, effectCount (type) - 1));
+    l.band = Band::bass;
+    l.react = 0.5f;
+    l.size = 0.5f;
+    l.amount = 0.5f;
+    l.speed = 0.3f;
+    l.count = 48;
+    const std::string id = effectId (type, l.effect);
+    auto colours = [&l] (std::uint32_t a, std::uint32_t b) {
+        l.colourA = a;
+        l.colourB = b;
+    };
+    switch (type)
+    {
+        case LayerType::canvas:
+            if (id == "plasma") colours (0xff2a0a6a, 0xffff3070);
+            else if (id == "tunnel") { colours (0xff101030, 0xffff3048); l.speed = 0.4f; l.amount = 0.3f; }
+            else if (id == "cells") colours (0xff0a1830, 0xff40c0ff);
+            else if (id == "kaleido") { colours (0xffff3048, 0xff3060ff); l.amount = 0.4f; }
+            else if (id == "clouds") { colours (0xff20307a, 0xffc060ff); l.speed = 0.2f; }
+            else if (id == "warp") { colours (0xffffffff, 0xff6aa8ff); l.blend = Blend::add; l.size = 0.3f; l.speed = 0.5f; }
+            else if (id == "electric") { colours (0xffffffff, 0xff40a0ff); l.blend = Blend::add; l.size = 0.3f; l.count = 36; l.band = Band::beat; }
+            else if (id == "rays") { colours (0xffffb030, 0xffff3048); l.blend = Blend::add; l.size = 0.3f; }
+            break;
+        case LayerType::terrain:
+            if (id == "mountains") { colours (0xffff3048, 0xff6a2cff); l.count = 40; l.amount = 0.4f; l.react = 0.6f; }
+            else if (id == "hills") { colours (0xff406080, 0xffd08060); l.size = 0.4f; l.amount = 0.3f; }
+            else { colours (0xffff2d95, 0xff6a2cff); l.size = 0.35f; l.amount = 0.4f; l.speed = 0.4f; }
+            break;
+        case LayerType::object3d:
+            if (id == "blob") { colours (0xff3060ff, 0xffff3048); l.size = 0.4f; }
+            else if (id == "torus") { colours (0xffff3048, 0xffffb000); l.size = 0.35f; l.amount = 0.3f; }
+            else if (id == "cubes") { colours (0xff20c0ff, 0xffff3048); l.amount = 0.3f; l.react = 0.6f; l.speed = 0.2f; }
+            else { colours (0xffff3048, 0xff40c0ff); l.size = 0.3f; l.amount = 0.2f; l.band = Band::level; }
+            break;
+        case LayerType::feedback:
+            colours (0xffffffff, 0xffffffff);
+            l.size = 0.3f;
+            l.amount = 0.6f;
+            if (id == "spin") l.speed = 0.6f;
+            if (id == "kaleido") l.count = 24;
+            break;
+        case LayerType::postprocess:
+            colours (0xffffffff, 0xffffffff);
+            if (id == "bloom") { l.amount = 0.35f; l.count = 128; }
+            else if (id == "blur") { l.size = 0.3f; l.react = 0.0f; }
+            else if (id == "rgbshift") { l.amount = 0.2f; l.react = 0.6f; l.band = Band::beat; }
+            else if (id == "pixelate") l.size = 0.2f;
+            else if (id == "dots") { l.size = 0.3f; l.amount = 0.6f; }
+            else if (id == "scanlines") { l.size = 0.3f; l.amount = 0.4f; }
+            else if (id == "vignette") { l.amount = 0.7f; }
+            else if (id == "color") { l.amount = 0.33f; l.speed = 0.0f; }
+            else if (id == "mirror") l.count = 1;
+            else if (id == "shake" || id == "glitch" || id == "invert") { l.band = Band::beat; l.react = 0.7f; l.amount = id == "glitch" ? 0.3f : 0.5f; }
+            else if (id == "grain") l.amount = 0.3f;
+            break;
+        default: break;
+    }
+    return l;
+}
+
 const std::vector<Scene>& presets()
 {
     static const std::vector<Scene> list = [] {
@@ -802,6 +1032,118 @@ const std::vector<Scene>& presets()
             s.layers.push_back (wave);
             out.push_back (s);
         }
+        // GPU scenes (round 165e): shader layers; without OpenGL they are drawn simplified
+        auto fx = [] (LayerType t, const char* id) { return shaderLayer (t, std::max (0, effectIndex (t, id))); };
+        auto black = [] { return make (LayerType::background, 0xff000000, 0xff000000, 0.5f, 0.5f, 0.5f, Band::bass, 0.0f); };
+        {
+            Scene s;
+            s.name = "Retro road";
+            s.layers.push_back (black());
+            s.layers.push_back (fx (LayerType::terrain, "road"));
+            auto title = make (LayerType::text, 0xffffffff, 0xffff2d95, 0.5f, 0.87f, 0.11f, Band::beat, 0.3f);
+            title.text = "LYNX";
+            title.amount = 0.7f;
+            s.layers.push_back (title);
+            s.layers.push_back (fx (LayerType::postprocess, "bloom"));
+            auto lines = fx (LayerType::postprocess, "scanlines");
+            lines.amount = 0.25f;
+            s.layers.push_back (lines);
+            out.push_back (s);
+        }
+        {
+            Scene s;
+            s.name = "Spectrum mountains";
+            s.layers.push_back (black());
+            s.layers.push_back (fx (LayerType::terrain, "mountains"));
+            s.layers.push_back (fx (LayerType::postprocess, "bloom"));
+            s.layers.push_back (fx (LayerType::postprocess, "vignette"));
+            out.push_back (s);
+        }
+        {
+            Scene s;
+            s.name = "Reactive sphere";
+            s.layers.push_back (black());
+            auto clouds = fx (LayerType::canvas, "clouds");
+            clouds.colourA = 0xff0a0c30;
+            clouds.colourB = 0xff3a1060;
+            clouds.opacity = 0.8f;
+            s.layers.push_back (clouds);
+            auto rings = make (LayerType::rings, 0xffff3048, 0x00ff3048, 0.5f, 0.5f, 0.7f, Band::beat, 0.8f);
+            rings.count = 6;
+            rings.additive = true;
+            s.layers.push_back (rings);
+            s.layers.push_back (fx (LayerType::object3d, "blob"));
+            s.layers.push_back (fx (LayerType::postprocess, "bloom"));
+            s.layers.push_back (fx (LayerType::postprocess, "vignette"));
+            out.push_back (s);
+        }
+        {
+            Scene s;
+            s.name = "Kaleido feedback";
+            s.layers.push_back (black());
+            auto bars = make (LayerType::bars, 0xffff2d55, 0xff7a3cff, 0.5f, 0.75f, 0.45f, Band::level, 0.8f);
+            bars.count = 48;
+            bars.mirror = true;
+            s.layers.push_back (bars);
+            s.layers.push_back (fx (LayerType::feedback, "kaleido"));
+            s.layers.push_back (fx (LayerType::postprocess, "rgbshift"));
+            s.layers.push_back (fx (LayerType::postprocess, "bloom"));
+            out.push_back (s);
+        }
+        {
+            Scene s;
+            s.name = "Plasma tunnel";
+            s.layers.push_back (black());
+            s.layers.push_back (fx (LayerType::canvas, "tunnel"));
+            auto circle = make (LayerType::circle, 0xffffffff, 0xffff3048, 0.5f, 0.5f, 0.22f, Band::level, 0.8f);
+            circle.count = 120;
+            circle.additive = true;
+            s.layers.push_back (circle);
+            s.layers.push_back (fx (LayerType::feedback, "zoom"));
+            s.layers.push_back (fx (LayerType::postprocess, "bloom"));
+            out.push_back (s);
+        }
+        {
+            Scene s;
+            s.name = "Cube city";
+            auto sky = fx (LayerType::canvas, "clouds");
+            sky.colourA = 0xff050818;
+            sky.colourB = 0xff1a2a50;
+            s.layers.push_back (black());
+            s.layers.push_back (sky);
+            s.layers.push_back (fx (LayerType::object3d, "cubes"));
+            s.layers.push_back (fx (LayerType::postprocess, "bloom"));
+            s.layers.push_back (fx (LayerType::postprocess, "vignette"));
+            out.push_back (s);
+        }
+        {
+            Scene s;
+            s.name = "Electric storm";
+            s.layers.push_back (make (LayerType::background, 0xff02030a, 0xff0a0820, 0.5f, 0.5f, 0.5f, Band::bass, 0.2f));
+            s.layers.push_back (fx (LayerType::canvas, "electric"));
+            s.layers.push_back (fx (LayerType::feedback, "drift"));
+            auto flash = make (LayerType::flash, 0xff80c0ff, 0xff80c0ff, 0.5f, 0.5f, 0.5f, Band::beat, 0.3f);
+            flash.opacity = 0.3f;
+            s.layers.push_back (flash);
+            s.layers.push_back (fx (LayerType::postprocess, "bloom"));
+            out.push_back (s);
+        }
+        {
+            Scene s;
+            s.name = "Neon CRT";
+            s.layers.push_back (make (LayerType::background, 0xff0d0716, 0xff2a0a26, 0.5f, 0.5f, 0.5f, Band::bass, 0.25f));
+            auto bars = make (LayerType::bars, 0xffff2d55, 0xff7a3cff, 0.5f, 0.85f, 0.5f, Band::level, 0.8f);
+            bars.count = 64;
+            s.layers.push_back (bars);
+            auto wave = make (LayerType::waveform, 0xccffffff, 0x00ffffff, 0.5f, 0.4f, 0.22f, Band::level, 0.5f);
+            wave.amount = 0.25f;
+            s.layers.push_back (wave);
+            s.layers.push_back (fx (LayerType::postprocess, "rgbshift"));
+            s.layers.push_back (fx (LayerType::postprocess, "scanlines"));
+            s.layers.push_back (fx (LayerType::postprocess, "vignette"));
+            s.layers.push_back (fx (LayerType::postprocess, "grain"));
+            out.push_back (s);
+        }
         return out;
     }();
     return list;
@@ -914,25 +1256,86 @@ std::optional<Scene> fromZge (const std::vector<std::uint8_t>& state, std::vecto
         const auto app = it->second["App"];
         if (app.empty() || app == "(none)" || it->second["Enabled"] == "0")
             continue;
+        // the effect's parameters (0..1)
+        std::vector<float> p;
+        {
+            std::istringstream values (it->second["FParamValues"]);
+            std::string v;
+            while (std::getline (values, v, ','))
+                p.push_back ((float) std::atof (v.c_str()));
+        }
+        auto param = [&p] (std::size_t i, float fallback) { return i < p.size() && std::isfinite (p[i]) ? p[i] : fallback; };
+        // most ZGE effects start with Alpha, Hue, Saturation, Lightness: HSV (hue, saturation, 1 − lightness), alpha 1 − Alpha
+        auto zgeColour = [&param] (std::size_t at = 0) {
+            const auto alpha = 1.0f - std::clamp (param (at, 0.0f), 0.0f, 1.0f);
+            return hsvArgb (param (at + 1, 0.0f), param (at + 2, 0.0f), 1.0f - std::clamp (param (at + 3, 0.0f), 0.0f, 1.0f), alpha);
+        };
+        auto shader = [] (LayerType t, const char* id) { return shaderLayer (t, std::max (0, effectIndex (t, id))); };
+        const auto name = app.substr (app.find_last_of ("\\.") == std::string::npos ? 0 : app.find_last_of ("\\.") + 1);
+        auto named = [&name] (std::initializer_list<const char*> words) {
+            for (const auto* w : words)
+                if (name.find (w) != std::string::npos)
+                    return true;
+            return false;
+        };
         Layer l;
         bool ok = true;
-        if (has (app, "Background\\SolidColor") || has (app, "SolidColor"))
-            l = make (LayerType::background, 0xff101018, 0xff101018, 0.5f, 0.5f, 0.5f, Band::bass, 0.0f);
-        else if (has (app, "Background\\") )
+        if (has (app, "SolidColor"))
+        {
+            const auto c = zgeColour();
+            if ((c >> 24) < 8)
+                continue; // a transparent colour draws nothing
+            l = make (LayerType::background, c | 0xff000000u, c | 0xff000000u, 0.5f, 0.5f, 0.5f, Band::bass, 0.0f);
+            l.opacity = (float) (c >> 24) / 255.0f;
+        }
+        else if (has (app, "FourCornerGradient"))
+        {
+            // the top-left and bottom-right corners (hue, saturation, value)
+            l = make (LayerType::background, hsvArgb (param (2, 0.0f), param (3, 0.0f), param (4, 0.2f), 1.0f),
+                      hsvArgb (param (11, 0.0f), param (12, 0.0f), param (13, 0.1f), 1.0f), 0.5f, 0.5f, 0.5f, Band::bass, 0.1f);
+            l.opacity = std::clamp (param (1, 1.0f), 0.0f, 1.0f);
+        }
+        else if (has (app, "ItsFullOfStars"))
+            l = shader (LayerType::canvas, "warp");
+        else if (has (app, "FogMachine"))
+            l = shader (LayerType::canvas, "clouds");
+        else if (has (app, "Retro Road") || has (app, "Background\\Grid"))
+            l = shader (LayerType::terrain, "road");
+        else if (has (app, "Background\\"))
             l = make (LayerType::background, 0xff0d0716, 0xff2a0a26, 0.5f, 0.5f, 0.5f, Band::bass, 0.25f);
         else if (has (app, "Peak Effects\\Polar") || has (app, "FreqRing") || has (app, "HUD Graph Polar") || has (app, "HUD Meter Radial"))
         {
             l = make (LayerType::circle, 0xffff3048, 0xffffb000, 0.5f, 0.5f, 0.3f, Band::level, 0.8f);
             l.count = 96;
+            if (has (app, "Peak Effects\\Polar") && p.size() >= 7)
+            {
+                l.colourA = zgeColour();
+                l.size = std::clamp (param (4, 0.3f), 0.05f, 1.0f);
+                l.x = param (5, 0.5f);
+                l.y = 1.0f - param (6, 0.5f);
+            }
         }
-        else if (has (app, "WaveSimple") || has (app, "StereoWaveForm") || has (app, "JoyDividers"))
+        else if (has (app, "Reactive Sphere"))
+            l = shader (LayerType::object3d, "blob");
+        else if (has (app, "Audio Plane") || has (app, "Peakmap"))
+            l = shader (LayerType::terrain, "mountains");
+        else if (has (app, "WaveSimple") || has (app, "StereoWaveForm") || has (app, "JoyDividers") || has (app, "Oscilloscope")
+                 || has (app, "Youlean Waveform") || has (app, "VectorScope"))
             l = make (LayerType::waveform, 0xffffffff, 0xffffffff, 0.5f, 0.5f, 0.3f, Band::level, 0.5f);
         else if (has (app, "Peak Effects\\") || has (app, "HUD Graph Linear"))
         {
             l = make (LayerType::bars, 0xffff2d55, 0xff7a3cff, 0.5f, 0.85f, 0.5f, Band::level, 0.8f);
             l.count = 64;
+            if (has (app, "Peak Effects\\Linear") && p.size() >= 8)
+            {
+                l.colourA = zgeColour() | 0xff000000u;
+                l.opacity = (float) (zgeColour() >> 24) / 255.0f;
+                l.size = std::clamp (param (4, 0.5f), 0.05f, 1.0f);
+                l.y = 1.0f - param (6, 0.15f);
+                l.count = std::clamp ((int) std::lround (8.0f + param (7, 0.25f) * 120.0f), 8, 256);
+            }
         }
-        else if (has (app, "Particles\\") || has (app, "ItsFullOfStars") || has (app, "ReactiveMob") || has (app, "fLuids"))
+        else if (has (app, "Particles\\") || has (app, "ReactiveMob") || has (app, "fLuids") || has (app, "ReactiveFlow"))
         {
             l = make (LayerType::particles, 0xffffffff, 0xff6aa8ff, 0.5f, 0.5f, 0.15f, Band::bass, 0.7f);
             l.count = 200;
@@ -942,6 +1345,14 @@ std::optional<Scene> fromZge (const std::vector<std::uint8_t>& state, std::vecto
         {
             l = make (LayerType::text, 0xffffffff, 0xffff3048, 0.5f, 0.5f, 0.2f, Band::beat, 0.3f);
             l.text = text.empty() ? std::string ("LYNX") : text;
+            if (has (app, "TextTrueType") && p.size() >= 7)
+            {
+                const auto c = zgeColour();
+                l.colourA = c | 0xff000000u;
+                l.opacity = std::max (0.05f, (float) (c >> 24) / 255.0f);
+                l.x = param (5, 0.5f);
+                l.y = 1.0f - param (6, 0.5f);
+            }
         }
         else if (has (app, "Image effects\\") || has (app, "HUD Image"))
         {
@@ -951,12 +1362,106 @@ std::optional<Scene> fromZge (const std::vector<std::uint8_t>& state, std::vecto
                 l.path = images[(std::size_t) imageIndex];
             else
                 ok = false; // one of FL's own pictures: not ours to copy
+            if (ok && has (app, "Image effects\\Image") && p.size() >= 7)
+            {
+                l.size = std::clamp (param (4, 0.6f), 0.05f, 1.0f);
+                l.x = param (5, 0.5f);
+                l.y = 1.0f - param (6, 0.5f);
+                l.opacity = 1.0f - std::clamp (param (0, 0.0f), 0.0f, 1.0f);
+            }
+        }
+        // ---- the GPU layers (round 165e) ----
+        else if (has (app, "Feedback\\"))
+            l = shader (LayerType::feedback, named ({ "Kaleido" }) ? "kaleido" : named ({ "WormHole" }) ? "spin" : named ({ "WarpBack" }) ? "warp"
+                                                : named ({ "BoxedIn" }) ? "echo" : "zoom");
+        else if (has (app, "FrameBlur"))
+            l = shader (LayerType::feedback, "echo");
+        else if (has (app, "Bloom") || has (app, "Blooming") || has (app, "Starburst") || has (app, "Whitehole"))
+        {
+            l = shader (LayerType::postprocess, "bloom");
+            if (has (app, "Youlean Bloom") && p.size() >= 5)
+            {
+                l.amount = std::clamp (param (0, 0.35f), 0.0f, 1.0f);
+                l.count = std::clamp ((int) std::lround ((0.85f - std::clamp (param (1, 0.3f), 0.0f, 0.95f)) / 0.8f * 512.0f), 1, 512);
+                l.size = std::clamp (param (2, 0.5f), 0.0f, 1.0f);
+                l.opacity = std::clamp (param (4, 1.0f), 0.0f, 1.0f);
+            }
+            else if (has (app, "Blooming") && p.size() >= 8)
+                l.amount = std::clamp (param (7, 0.35f), 0.0f, 1.0f);
         }
-        else if (has (app, "Blooming") || has (app, "Bloom") || has (app, "AudioShake") || has (app, "ParameterShake"))
+        else if (has (app, "AudioShake") || has (app, "Audio Shake") || has (app, "Handheld"))
+            l = shader (LayerType::postprocess, "shake");
+        else if (has (app, "Youlean Blur") || has (app, "Motion Blur") || has (app, "Postprocess\\Blur") || has (app, "Linear Blur") || has (app, "Smudge")
+                 || has (app, "Watercolor") || has (app, "Raindrops"))
         {
-            l = make (LayerType::flash, 0xffffffff, 0xffffffff, 0.5f, 0.5f, 0.5f, Band::beat, 0.3f);
-            l.opacity = 0.25f;
+            l = shader (LayerType::postprocess, "blur");
+            if (p.size() >= 1)
+                l.size = std::clamp (param (0, 0.3f), 0.0f, 1.0f);
+        }
+        else if (has (app, "Color Correction") || has (app, "Color Shaper") || has (app, "Fast HSV") || has (app, "Luminosity") || has (app, "ColorCyclePalette"))
+        {
+            l = shader (LayerType::postprocess, "color");
+            if (has (app, "Youlean Color Correction") && p.size() >= 5)
+            {
+                l.amount = std::clamp ((param (2, 0.5f) * 2.0f - 0.5f) / 1.5f, 0.0f, 1.0f); // contrast (0.5 = as is)
+                l.size = std::clamp (param (4, 0.5f), 0.0f, 1.0f);                          // saturation
+            }
+            if (has (app, "ColorCyclePalette"))
+                l.speed = 0.5f;
+        }
+        else if (has (app, "Dot Matrix") || has (app, "Point Cloud") || has (app, "Postprocess\\Ascii"))
+            l = shader (LayerType::postprocess, "dots");
+        else if (has (app, "Dither") || has (app, "Fast Static"))
+            l = shader (LayerType::postprocess, "grain");
+        else if (has (app, "Inverter"))
+            l = shader (LayerType::postprocess, "invert");
+        else if (has (app, "Glitch"))
+            l = shader (LayerType::postprocess, "glitch");
+        else if (has (app, "Edge Detect") || has (app, "Notebook Drawings"))
+            l = shader (LayerType::postprocess, "edges");
+        else if (has (app, "RGB Shift"))
+            l = shader (LayerType::postprocess, "rgbshift");
+        else if (has (app, "ScanLines"))
+            l = shader (LayerType::postprocess, "scanlines");
+        else if (has (app, "Vignette"))
+        {
+            l = shader (LayerType::postprocess, "vignette");
+            if (p.size() >= 5)
+            {
+                l.amount = 1.0f - std::clamp (param (0, 0.3f), 0.0f, 1.0f);
+                l.size = std::clamp (param (4, 0.5f), 0.0f, 1.0f);
+            }
         }
+        else if (has (app, "Kaleidoscope"))
+            l = shader (LayerType::postprocess, "kaleido");
+        else if (has (app, "Pixelate"))
+            l = shader (LayerType::postprocess, "pixelate");
+        else if (has (app, "Terrain\\") || has (app, "Physics\\Heightfield"))
+            l = named ({ "CubesAndSpheres" }) ? shader (LayerType::object3d, "cubes")
+              : named ({ "Perturbed Grid", "Terrain Lattice", "Heightfield" }) ? shader (LayerType::terrain, "mountains")
+                                                                              : shader (LayerType::terrain, "hills");
+        else if (has (app, "Object Arrays\\") || has (app, "Physics\\") || has (app, "MatCap"))
+            l = named ({ "Rings", "Mobius Weave", "Filaments" }) ? shader (LayerType::object3d, "rings")
+              : named ({ "Cube", "Block", "Cubic", "Columns", "Cage", "8x8x8" }) ? shader (LayerType::object3d, "cubes")
+                                                                                 : shader (LayerType::object3d, "blob");
+        else if (has (app, "Scenes\\"))
+            l = named ({ "Mandelbulb", "Polyhedra", "Musicball", "Jewels", "Rhodium", "Mobius", "Gears", "Lantern" }) ? shader (LayerType::object3d, "blob")
+              : named ({ "Alps", "Wasteland", "Postcard", "Terrain", "Debris" }) ? shader (LayerType::terrain, "hills")
+              : named ({ "Cloud", "Balloon" }) ? shader (LayerType::canvas, "clouds")
+              : named ({ "Hex", "Industrial" }) ? shader (LayerType::object3d, "cubes")
+                                                : shader (LayerType::canvas, "tunnel");
+        else if (has (app, "Clouds\\"))
+            l = shader (LayerType::canvas, "clouds");
+        else if (has (app, "Tunnel\\"))
+            l = named ({ "Torus", "Tube" }) ? shader (LayerType::object3d, "rings") : shader (LayerType::canvas, "tunnel");
+        else if (has (app, "Canvas effects\\"))
+            l = named ({ "Voronoi", "Cellular", "Hexagonal", "Rounded", "Contours" }) ? shader (LayerType::canvas, "cells")
+              : named ({ "Electric", "DarkSpark", "Flaring", "StarTaser" }) ? shader (LayerType::canvas, "electric")
+              : named ({ "Rain" }) ? shader (LayerType::canvas, "warp")
+              : named ({ "Digital Brain", "Stack Trace", "ShimeringCage", "Lattice", "N-gon", "BitPad", "Blocks" }) ? shader (LayerType::canvas, "kaleido")
+                                                                                                                      : shader (LayerType::canvas, "plasma");
+        else if (has (app, "Patterns\\"))
+            l = named ({ "Truchet", "Weave", "Maze", "Pipe" }) ? shader (LayerType::canvas, "kaleido") : shader (LayerType::canvas, "cells");
         else
             ok = false;
         if (! ok)
@@ -968,7 +1473,9 @@ std::optional<Scene> fromZge (const std::vector<std::uint8_t>& state, std::vecto
         s.layers.push_back (l);
     }
     // nothing that draws (only effects without a counterpart): LYNX's default scene, so the slot still shows the music
-    const auto draws = std::any_of (s.layers.begin(), s.layers.end(), [] (const Layer& l) { return l.type != LayerType::background; });
+    const auto draws = std::any_of (s.layers.begin(), s.layers.end(), [] (const Layer& l) {
+        return l.type != LayerType::background && ! readsBelow (l.type); // (bloom alone over a colour shows no music)
+    });
     if (! draws)
     {
         auto fallback = defaultScene();
@@ -976,6 +1483,10 @@ std::optional<Scene> fromZge (const std::vector<std::uint8_t>& state, std::vecto
         fallback.height = s.height;
         fallback.fps = s.fps;
         fallback.name = s.name;
+        // (the project's feedback / post-process layers stay, over LYNX's scene)
+        for (const auto& l : s.layers)
+            if (readsBelow (l.type))
+                fallback.layers.push_back (l);
         return fallback;
     }
     if (s.layers.front().type != LayerType::background)

+ 26 - 2
src/core/VisualFx.h

@@ -200,10 +200,30 @@ bool fromFl (const std::vector<std::uint8_t>& state, EffectSlot& slot);
 // ---------------------------------------------------------------------------------------------------------------
 namespace scene
 {
-enum class LayerType { background, bars, circle, waveform, particles, rings, image, text, flash };
-constexpr int layerTypeCount = 9;
+// The first nine draw with the 2D renderer (and on the GPU through it); the last five are GPU shader layers (round
+// 165e, ZGameEditor's categories): Canvas (full-frame procedural pictures), Terrain (a 3D landscape of the spectrum),
+// 3D objects (ray-marched shapes), Feedback (the previous frame moved and faded under the new one) and Post-process
+// (an effect on everything below it). Without OpenGL the 2D renderer approximates Canvas and Terrain and skips the rest.
+enum class LayerType { background, bars, circle, waveform, particles, rings, image, text, flash,
+                       canvas, terrain, object3d, feedback, postprocess };
+constexpr int layerTypeCount = 14;
 const char* typeId (LayerType t) noexcept;   // saved name
 const char* typeName (LayerType t) noexcept; // shown name (English; the UI translates)
+bool isShaderType (LayerType t) noexcept;    // canvas … postprocess
+bool readsBelow (LayerType t) noexcept;      // feedback, postprocess: they change what the layers under them drew
+
+// A shader layer's effect (its variant within the type): ids are saved, names shown (English; the UI translates)
+int effectCount (LayerType t) noexcept;      // 0 for the 2D types
+const char* effectId (LayerType t, int effect) noexcept;
+const char* effectName (LayerType t, int effect) noexcept;
+const char* effectHint (LayerType t, int effect) noexcept; // what Size / Amount / Speed / Count do for it
+int effectIndex (LayerType t, const std::string& id) noexcept; // -1 = unknown
+
+// How a layer is put over the ones below it (GPU; the 2D renderer draws every layer normally)
+enum class Blend { normal, add, screen, multiply, overlay, difference, lighten, darken };
+constexpr int blendCount = 8;
+const char* blendId (Blend b) noexcept;
+const char* blendName (Blend b) noexcept;
 
 enum class Band { level, bass, mid, high, beat };
 constexpr int bandCount = 5;
@@ -226,6 +246,8 @@ struct Layer
     bool additive = false;    // light blending
     std::string text;         // text layer (several lines with \n)
     std::string path;         // image / background image file
+    int effect = 0;           // shader layers: the effect (effectId)
+    Blend blend = Blend::normal;
 
     bool operator== (const Layer&) const = default;
 };
@@ -244,6 +266,8 @@ std::optional<Scene> parse (const std::string& text);
 std::vector<std::uint8_t> toState (const Scene& s);
 std::optional<Scene> fromState (const std::vector<std::uint8_t>& state);
 Scene defaultScene();
+// a shader layer with the settings that suit its effect (the editor's Add menu, the built-in scenes, the ZGE import)
+Layer shaderLayer (LayerType type, int effect);
 // LYNX's built-in scenes (name, scene)
 const std::vector<Scene>& presets();
 

+ 10 - 0
src/ui/ChannelRackComponent.cpp

@@ -1,3 +1,4 @@
+#include "core/FruityDance.h"
 #include "ui/ColourPicker.h"
 #include "ui/PatcherEditor.h"
 #include "ui/UiTrace.h"
@@ -2159,6 +2160,15 @@ void ChannelRackComponent::addInstrumentItems (juce::PopupMenu& menu, int insert
         const auto added = add (c);
         openChannelSettings (engine, added);
     });
+    // FL's Fruity Dance (round 165e): LYNX's own dancer over the workspace, its notes pick the moves (no sound)
+    menu.addItem ("Fruity Dance", [this, add] {
+        ChannelDef c;
+        c.name = "Fruity Dance";
+        c.instrument = InstrumentKind::fruitydance;
+        c.pluginState = dance::toState (dance::Settings {});
+        const auto added = add (c);
+        openChannelSettings (engine, added);
+    });
     // FL's own instrument engines (round 142, issue #5): their editor opens
     {
         juce::PopupMenu engines;

+ 5 - 0
src/ui/ChannelSettings.cpp

@@ -2,6 +2,7 @@
 #include "core/NoteNames.h"
 #include "ui/ChannelSettings.h"
 #include "ui/LayerEditor.h"
+#include "ui/DanceView.h"
 #include "ui/Controllers164.h"
 #include "ui/VoltageEditor.h"
 
@@ -3283,6 +3284,8 @@ std::unique_ptr<juce::Component> makeInstrumentPage (AudioEngine& engine, const
     if (def == nullptr)
         return nullptr;
     const auto kind = def->instrument;
+    if (kind == InstrumentKind::fruitydance && ref.index >= 0)
+        return makeDanceEditor (engine, ref.index); // round 165e
     if (kind == InstrumentKind::synth)
         return std::make_unique<SynthPanel> (engine, ref);
     if (isModelKind (kind))
@@ -3487,6 +3490,8 @@ std::unique_ptr<juce::Component> makeChannelSettingsPanel (AudioEngine& engine,
         return makeVoltageControllerEditor (engine, channel);
     if (engine.getSong().channels[(std::size_t) channel].instrument == InstrumentKind::vfx)
         return makeVfxEditor (engine, channel);
+    if (engine.getSong().channels[(std::size_t) channel].instrument == InstrumentKind::fruitydance)
+        return makeDanceEditor (engine, channel); // round 165e
     if (const auto kind = engine.getSong().channels[(std::size_t) channel].instrument;
         kind == InstrumentKind::sakura || kind == InstrumentKind::drumpad || kind == InstrumentKind::boobass
                  || kind == InstrumentKind::drumsynth || kind == InstrumentKind::harmless || kind == InstrumentKind::harmor

+ 748 - 0
src/ui/DanceView.cpp

@@ -0,0 +1,748 @@
+#include "ui/DanceView.h"
+
+#include <cmath>
+
+#include "core/Instruments.h"
+#include "engine/AudioEngine.h"
+#include "ui/ChannelSettings.h"
+#include "ui/ColourPicker.h"
+#include "ui/I18n.h"
+#include "ui/Theme.h"
+
+namespace lynx
+{
+// ---------------------------------------------------------------------------------------------------------------
+// The character: LYNX's own lynx (tufted ears, a bob tail, a shirt in the outfit colour), drawn from the pose with
+// vector shapes. Body units: about 1.0 tall, y up, the origin between the feet.
+// ---------------------------------------------------------------------------------------------------------------
+namespace dancer
+{
+namespace
+{
+using P = juce::Point<float>;
+
+const juce::Colour fur { 0xffe2b57f }, furDark { 0xffb9884f }, line { 0xff1d1612 }, cream { 0xfff6ead6 }, shorts { 0xff23262e },
+    shoe { 0xfff1f1f1 }, nose { 0xffd9727a };
+
+// a limb's direction for an angle (0 = straight down; positive turns towards the left of the picture)
+P dir (float a) { return { -std::sin (a), -std::cos (a) }; }
+
+struct Rig
+{
+    P feet;
+    float h = 100.0f, sx = 1.0f, sy = 1.0f;
+    P at (P b) const { return { feet.x + b.x * h * sx, feet.y - b.y * h * sy }; }
+    float px (float units) const { return units * h; }
+};
+
+void limb (juce::Graphics& g, const Rig& r, P a, P b, P c, float width, juce::Colour fill)
+{
+    juce::Path p;
+    p.startNewSubPath (r.at (a));
+    p.lineTo (r.at (b));
+    p.lineTo (r.at (c));
+    const auto w = r.px (width);
+    g.setColour (line);
+    g.strokePath (p, juce::PathStrokeType (w + juce::jmax (2.0f, r.px (0.014f)), juce::PathStrokeType::curved, juce::PathStrokeType::rounded));
+    g.setColour (fill);
+    g.strokePath (p, juce::PathStrokeType (w, juce::PathStrokeType::curved, juce::PathStrokeType::rounded));
+}
+
+void blob (juce::Graphics& g, P centre, float rx, float ry, juce::Colour fill, float outline)
+{
+    const auto box = juce::Rectangle<float> (rx * 2.0f, ry * 2.0f).withCentre (centre);
+    g.setColour (fill);
+    g.fillEllipse (box);
+    if (outline > 0.0f)
+    {
+        g.setColour (line);
+        g.drawEllipse (box, outline);
+    }
+}
+} // namespace
+
+juce::Rectangle<float> reach (juce::Point<float> feet, float height)
+{
+    return { feet.x - height * 0.62f, feet.y - height * 1.42f, height * 1.24f, height * 1.52f };
+}
+
+void draw (juce::Graphics& g, juce::Point<float> feet, float height, const dance::Pose& pose, bool mirrored, juce::Colour outfit)
+{
+    // facing: a spin squeezes the body through its side (never to nothing); behind = the back of the head
+    const auto facing = std::abs (pose.turn) < 0.32f ? (pose.turn < 0.0f ? -0.32f : 0.32f) : pose.turn;
+    const auto back = pose.turn < 0.0f;
+    Rig r { feet, height, facing * (mirrored ? -1.0f : 1.0f), pose.squash };
+    const auto outline = juce::jmax (1.2f, height * 0.011f);
+
+    // the shadow on the floor (smaller while in the air)
+    {
+        const auto lift = juce::jlimit (0.0f, 1.0f, pose.y * 5.0f);
+        g.setColour (juce::Colours::black.withAlpha (0.28f * (1.0f - lift * 0.6f)));
+        g.fillEllipse (juce::Rectangle<float> (height * 0.42f * (1.0f - lift * 0.4f), height * 0.07f).withCentre ({ feet.x + pose.x * height, feet.y }));
+    }
+
+    const P hip { pose.x + pose.hipShift, pose.y + 0.46f };
+    const P up { std::sin (pose.lean), std::cos (pose.lean) }, side { std::cos (pose.lean), -std::sin (pose.lean) };
+    const auto neck = hip + up * 0.30f;
+    const auto shoulderL = neck - up * 0.035f - side * 0.085f, shoulderR = neck - up * 0.035f + side * 0.085f;
+    const auto headUp = P { std::sin (pose.lean + pose.head), std::cos (pose.lean + pose.head) };
+    const auto headSide = P { headUp.y, -headUp.x };
+    const auto headC = neck + headUp * 0.115f;
+
+    auto legPoints = [&] (int i) {
+        const auto top = hip + side * (i == 0 ? -0.055f : 0.055f);
+        const auto knee = top + dir (pose.hip[(std::size_t) i]) * 0.22f;
+        const auto foot = knee + dir (pose.hip[(std::size_t) i] + pose.knee[(std::size_t) i]) * 0.21f;
+        return std::array<P, 3> { top, knee, foot };
+    };
+    auto armPoints = [&] (int i) {
+        const auto top = i == 0 ? shoulderL : shoulderR;
+        const auto elbow = top + dir (pose.shoulder[(std::size_t) i] + pose.lean) * 0.15f;
+        const auto hand = elbow + dir (pose.shoulder[(std::size_t) i] + pose.elbow[(std::size_t) i] + pose.lean) * 0.14f;
+        return std::array<P, 3> { top, elbow, hand };
+    };
+
+    // the tail (a lynx's short bob), behind the body
+    {
+        const auto base = hip + side * 0.045f - up * 0.02f;
+        const auto a = -0.9f + pose.tail * 0.35f; // a short bob, down and out to the right
+        const auto tip = base + dir (a) * 0.07f;
+        limb (g, r, base, (base + tip) * 0.5f, tip, 0.055f, furDark);
+        blob (g, r.at (tip), r.px (0.02f), r.px (0.02f), line, 0.0f);
+    }
+
+    // legs, shoes
+    for (int i = 0; i < 2; ++i)
+    {
+        const auto l = legPoints (i);
+        limb (g, r, l[0], l[1], l[2], 0.072f, fur);
+        const auto toe = r.at (l[2]) + P { (i == 0 ? -1.0f : 1.0f) * r.px (0.035f) * std::abs (r.sx), 0.0f };
+        const auto shoeBox = juce::Rectangle<float> (r.px (0.11f) * std::abs (r.sx) + 4.0f, r.px (0.055f)).withCentre ((r.at (l[2]) + toe) * 0.5f);
+        g.setColour (shoe);
+        g.fillRoundedRectangle (shoeBox, shoeBox.getHeight() * 0.45f);
+        g.setColour (line);
+        g.drawRoundedRectangle (shoeBox, shoeBox.getHeight() * 0.45f, outline);
+    }
+
+    // the body: shorts, then the shirt
+    {
+        juce::Path pants;
+        pants.startNewSubPath (r.at (hip - side * 0.095f + up * 0.05f));
+        pants.lineTo (r.at (hip + side * 0.095f + up * 0.05f));
+        pants.lineTo (r.at (legPoints (1)[0] + dir (pose.hip[1]) * 0.09f + side * 0.035f));
+        pants.lineTo (r.at (hip + up * -0.01f));
+        pants.lineTo (r.at (legPoints (0)[0] + dir (pose.hip[0]) * 0.09f - side * 0.035f));
+        pants.closeSubPath();
+        g.setColour (shorts);
+        g.fillPath (pants);
+        g.setColour (line);
+        g.strokePath (pants, juce::PathStrokeType (outline, juce::PathStrokeType::curved, juce::PathStrokeType::rounded));
+
+        juce::Path shirt;
+        shirt.startNewSubPath (r.at (hip - side * 0.09f + up * 0.04f));
+        shirt.quadraticTo (r.at (hip - side * 0.115f + up * 0.17f), r.at (shoulderL - side * 0.02f));
+        shirt.quadraticTo (r.at (neck + up * 0.02f), r.at (shoulderR + side * 0.02f));
+        shirt.quadraticTo (r.at (hip + side * 0.115f + up * 0.17f), r.at (hip + side * 0.09f + up * 0.04f));
+        shirt.closeSubPath();
+        g.setColour (outfit);
+        g.fillPath (shirt);
+        // a stripe across the chest (LYNX's mark)
+        {
+            juce::Graphics::ScopedSaveState save (g);
+            g.reduceClipRegion (shirt);
+            juce::Path stripe;
+            stripe.startNewSubPath (r.at (hip - side * 0.2f + up * 0.16f));
+            stripe.lineTo (r.at (hip + side * 0.2f + up * 0.2f));
+            g.setColour (juce::Colours::white.withAlpha (0.85f));
+            g.strokePath (stripe, juce::PathStrokeType (r.px (0.022f)));
+        }
+        g.setColour (line);
+        g.strokePath (shirt, juce::PathStrokeType (outline, juce::PathStrokeType::curved, juce::PathStrokeType::rounded));
+    }
+
+    // arms, paws
+    for (int i = 0; i < 2; ++i)
+    {
+        const auto a = armPoints (i);
+        limb (g, r, a[0], a[1], a[2], 0.06f, fur);
+        blob (g, r.at (a[2]), r.px (0.038f), r.px (0.038f), cream, outline);
+    }
+
+    // the head: ears with tufts, the face
+    {
+        for (int i = 0; i < 2; ++i)
+        {
+            const auto s = i == 0 ? -1.0f : 1.0f;
+            const auto baseIn = headC + headUp * 0.07f + headSide * (s * 0.025f);
+            const auto baseOut = headC + headUp * 0.045f + headSide * (s * 0.1f);
+            const auto tip = headC + headUp * 0.17f + headSide * (s * 0.085f);
+            juce::Path ear;
+            ear.startNewSubPath (r.at (baseIn));
+            ear.lineTo (r.at (tip));
+            ear.lineTo (r.at (baseOut));
+            ear.closeSubPath();
+            g.setColour (fur);
+            g.fillPath (ear);
+            g.setColour (line);
+            g.strokePath (ear, juce::PathStrokeType (outline, juce::PathStrokeType::mitered));
+            // the tuft
+            juce::Path tuft;
+            tuft.startNewSubPath (r.at (tip));
+            tuft.lineTo (r.at (tip + headUp * 0.028f + headSide * (s * 0.006f)));
+            g.strokePath (tuft, juce::PathStrokeType (juce::jmax (1.5f, r.px (0.014f)), juce::PathStrokeType::curved, juce::PathStrokeType::rounded));
+        }
+        const auto c = r.at (headC);
+        blob (g, c, r.px (0.112f) * std::abs (r.sx), r.px (0.102f), fur, outline);
+        // cheek ruffs (a lynx's side whiskers)
+        for (int i = 0; i < 2; ++i)
+        {
+            const auto s = i == 0 ? -1.0f : 1.0f;
+            juce::Path ruff;
+            ruff.startNewSubPath (r.at (headC + headSide * (s * 0.095f) + headUp * 0.01f));
+            ruff.lineTo (r.at (headC + headSide * (s * 0.145f) - headUp * 0.05f));
+            ruff.lineTo (r.at (headC + headSide * (s * 0.07f) - headUp * 0.07f));
+            ruff.closeSubPath();
+            g.setColour (cream);
+            g.fillPath (ruff);
+            g.setColour (line);
+            g.strokePath (ruff, juce::PathStrokeType (outline * 0.8f, juce::PathStrokeType::mitered));
+        }
+        if (! back)
+        {
+            // muzzle, eyes, nose
+            blob (g, r.at (headC - headUp * 0.04f), r.px (0.058f) * std::abs (r.sx), r.px (0.036f), cream, 0.0f);
+            for (int i = 0; i < 2; ++i)
+            {
+                const auto s = i == 0 ? -1.0f : 1.0f;
+                const auto e = r.at (headC + headUp * 0.018f + headSide * (s * 0.044f));
+                blob (g, e, r.px (0.016f) * std::abs (r.sx) + 0.6f, r.px (0.022f), line, 0.0f);
+                g.setColour (juce::Colours::white);
+                g.fillEllipse (juce::Rectangle<float> (r.px (0.008f), r.px (0.008f)).withCentre (e + P { -r.px (0.004f), -r.px (0.006f) }));
+            }
+            juce::Path n;
+            const auto nc = r.at (headC - headUp * 0.026f);
+            const auto nw = r.px (0.018f) * std::abs (r.sx) + 0.8f;
+            n.addTriangle (nc.x - nw, nc.y - nw * 0.6f, nc.x + nw, nc.y - nw * 0.6f, nc.x, nc.y + nw * 0.6f);
+            g.setColour (nose);
+            g.fillPath (n);
+        }
+        else
+        {
+            // the back of the head: a darker patch
+            blob (g, c + P { 0.0f, r.px (0.01f) }, r.px (0.06f) * std::abs (r.sx), r.px (0.05f), furDark, 0.0f);
+        }
+    }
+}
+} // namespace dancer
+
+// ---------------------------------------------------------------------------------------------------------------
+// The stage over the workspace
+// ---------------------------------------------------------------------------------------------------------------
+namespace
+{
+constexpr float baseHeight = 150.0f; // the dancer's height at size 1 (pixels)
+constexpr double blendMs = 180.0;     // a move change blends over this long
+
+float smoothStep (float t) { t = juce::jlimit (0.0f, 1.0f, t); return t * t * (3.0f - 2.0f * t); }
+
+// the song's beats (playing), or a free clock at 120 BPM (stopped) — so the dancer keeps moving like FL's
+struct DanceClock
+{
+    double lastMs = 0.0, freeBeats = 0.0;
+    double beats (AudioEngine& engine)
+    {
+        const auto now = juce::Time::getMillisecondCounterHiRes();
+        const auto dt = lastMs > 0.0 ? juce::jlimit (0.0, 0.25, (now - lastMs) * 0.001) : 0.0;
+        lastMs = now;
+        auto& t = engine.getTransport();
+        if (t.playing.load())
+        {
+            freeBeats = t.positionInBeats();
+            return freeBeats;
+        }
+        freeBeats += dt * 2.0;
+        return freeBeats;
+    }
+};
+
+void saveSettings (AudioEngine& engine, int channel, const dance::Settings& s, bool undoable)
+{
+    const auto state = dance::toState (s);
+    engine.editSong ([channel, state] (Song& song) {
+        if (channel >= 0 && channel < (int) song.channels.size() && song.channels[(std::size_t) channel].instrument == InstrumentKind::fruitydance)
+            song.channels[(std::size_t) channel].pluginState = state;
+    }, undoable);
+}
+} // namespace
+
+DanceStage::DanceStage (AudioEngine& e) : engine (e)
+{
+    setInterceptsMouseClicks (true, false);
+    setPaintingIsUnclipped (false);
+    scan();
+    startTimerHz (dancers.empty() ? 2 : 30);
+}
+
+DanceStage::~DanceStage() = default;
+
+juce::Rectangle<float> DanceStage::boxOf (const Dancer& d) const
+{
+    const auto h = baseHeight * d.now.scale;
+    const auto feet = juce::Point<float> ((float) d.now.x, (float) d.now.y);
+    return dancer::reach (feet, h);
+}
+
+void DanceStage::scan()
+{
+    const auto& song = engine.getSong();
+    std::map<int, bool> present;
+    for (int c = 0; c < (int) song.channels.size(); ++c)
+    {
+        const auto& def = song.channels[(std::size_t) c];
+        if (def.instrument != InstrumentKind::fruitydance)
+            continue;
+        present[c] = true;
+        auto& d = dancers[c];
+        d.channel = c;
+        if (d.savedState != def.pluginState || d.lastMove < 0)
+        {
+            const auto fresh = d.lastMove < 0;
+            const auto before = d.saved;
+            const auto prev = d.now;
+            d.savedState = def.pluginState;
+            d.saved = dance::read (def.pluginState);
+            d.now = d.saved;
+            // a size / colour / place edit keeps the move (and the shown state) the notes picked
+            if (! fresh && d.saved.move == before.move && d.saved.mirrored == before.mirrored)
+            {
+                d.now.move = prev.move;
+                d.now.mirrored = prev.mirrored;
+            }
+            if (! fresh && d.saved.visible == before.visible)
+                d.now.visible = prev.visible;
+            if (fresh)
+                d.lastMove = d.now.move;
+        }
+        auto inst = engine.getChannelInstrument (c);
+        if (inst != d.instrument)
+        {
+            d.instrument = inst;
+            d.seen = 0;
+            if (auto* sig = dance::signalsOf (inst.get()))
+            {
+                int dummy[16];
+                sig->pull (d.seen, dummy, 0); // (start from now)
+            }
+        }
+    }
+    for (auto it = dancers.begin(); it != dancers.end();)
+    {
+        if (present.count (it->first) == 0)
+        {
+            repaint (it->second.bounds.getSmallestIntegerContainer().expanded (4));
+            it = dancers.erase (it);
+        }
+        else
+            ++it;
+    }
+}
+
+void DanceStage::update()
+{
+    scanCountdown = 0;
+    timerCallback();
+}
+
+void DanceStage::timerCallback()
+{
+    if (--scanCountdown <= 0)
+    {
+        scan();
+        scanCountdown = dancers.empty() ? 1 : 15; // twice a second
+        const auto want = dancers.empty() ? 2 : 30;
+        if (getTimerInterval() != 1000 / want)
+            startTimerHz (want);
+    }
+    if (dancers.empty())
+        return;
+
+    const auto now = juce::Time::getMillisecondCounterHiRes();
+    const auto dt = lastMs > 0.0 ? juce::jlimit (0.0, 0.25, (now - lastMs) * 0.001) : 0.0;
+    lastMs = now;
+    auto& t = engine.getTransport();
+    const auto playing = t.playing.load();
+    if (playing)
+        freeBeats = t.positionInBeats();
+    else
+        freeBeats += dt * 2.0;
+    wasPlaying = playing;
+
+    for (auto& [channel, d] : dancers)
+    {
+        if (auto* sig = dance::signalsOf (d.instrument.get()))
+        {
+            int keys[16];
+            const auto n = sig->pull (d.seen, keys, 16);
+            for (int k = 0; k < n; ++k)
+            {
+                const auto a = dance::actionForKey (keys[k]);
+                if (a.kind == dance::KeyAction::Kind::move)
+                {
+                    d.now.move = a.move;
+                    d.now.mirrored = a.mirrored;
+                }
+                else if (a.kind == dance::KeyAction::Kind::hide)
+                    d.now.visible = false;
+                else if (a.kind == dance::KeyAction::Kind::show)
+                    d.now.visible = true;
+            }
+        }
+        const auto cycles = freeBeats * 0.5 * d.now.speed;
+        const auto target = dance::pose (d.now.move, cycles, (std::uint32_t) channel * 7919u + 1u);
+        if (d.now.move != d.lastMove)
+        {
+            d.from = d.shown;
+            d.blendStart = now;
+            d.lastMove = d.now.move;
+        }
+        if (d.blendStart >= 0.0 && now - d.blendStart < blendMs)
+            d.shown = dance::Pose::mix (d.from, target, smoothStep ((float) ((now - d.blendStart) / blendMs)));
+        else
+        {
+            d.blendStart = -1.0;
+            d.shown = target;
+        }
+        const auto box = d.now.visible ? boxOf (d) : juce::Rectangle<float>();
+        const auto dirty = box.isEmpty() ? d.bounds : d.bounds.isEmpty() ? box : d.bounds.getUnion (box);
+        if (! dirty.isEmpty())
+            repaint (dirty.getSmallestIntegerContainer().expanded (3));
+        d.bounds = box;
+    }
+}
+
+void DanceStage::paint (juce::Graphics& g)
+{
+    for (auto& [channel, d] : dancers)
+    {
+        if (! d.now.visible)
+            continue;
+        const auto h = baseHeight * d.now.scale;
+        if (! g.clipRegionIntersects (boxOf (d).getSmallestIntegerContainer()))
+            continue;
+        dancer::draw (g, { (float) d.now.x, (float) d.now.y }, h, d.shown, d.now.mirrored, juce::Colour (d.now.colour));
+    }
+}
+
+DanceStage::Dancer* DanceStage::dancerAt (juce::Point<float> p)
+{
+    for (auto it = dancers.rbegin(); it != dancers.rend(); ++it)
+    {
+        auto& d = it->second;
+        if (! d.now.visible)
+            continue;
+        // the body, not the whole reach
+        const auto h = baseHeight * d.now.scale;
+        const auto body = juce::Rectangle<float> ((float) d.now.x - h * 0.22f, (float) d.now.y - h * 1.1f, h * 0.44f, h * 1.12f);
+        if (body.contains (p))
+            return &d;
+    }
+    return nullptr;
+}
+
+bool DanceStage::hitTest (int x, int y)
+{
+    return dancerAt ({ (float) x, (float) y }) != nullptr;
+}
+
+void DanceStage::mouseDown (const juce::MouseEvent& e)
+{
+    auto* d = dancerAt (e.position);
+    if (d == nullptr)
+        return;
+    if (e.mods.isPopupMenu())
+    {
+        showMenu (*d);
+        return;
+    }
+    dragging = d->channel;
+    dragOffset = { d->now.x - e.x, d->now.y - e.y };
+}
+
+void DanceStage::mouseDrag (const juce::MouseEvent& e)
+{
+    auto it = dancers.find (dragging);
+    if (it == dancers.end())
+        return;
+    auto& d = it->second;
+    const auto old = d.bounds;
+    d.now.x = juce::jlimit (0, juce::jmax (0, getWidth()), e.x + dragOffset.x);
+    d.now.y = juce::jlimit (20, juce::jmax (20, getHeight()), e.y + dragOffset.y);
+    d.bounds = boxOf (d);
+    repaint (old.getUnion (d.bounds).getSmallestIntegerContainer().expanded (3));
+}
+
+void DanceStage::mouseUp (const juce::MouseEvent&)
+{
+    auto it = dancers.find (dragging);
+    dragging = -1;
+    if (it == dancers.end())
+        return;
+    auto& d = it->second;
+    if (d.now.x == d.saved.x && d.now.y == d.saved.y)
+        return;
+    auto s = d.saved;
+    s.x = d.now.x;
+    s.y = d.now.y;
+    save (it->first, s);
+}
+
+void DanceStage::save (int channel, const dance::Settings& s)
+{
+    saveSettings (engine, channel, s, false); // (the dancer's place is like a window's: not an undo step)
+    if (auto it = dancers.find (channel); it != dancers.end())
+    {
+        it->second.saved = s;
+        it->second.savedState = dance::toState (s);
+    }
+}
+
+void DanceStage::showMenu (Dancer& d)
+{
+    juce::PopupMenu menu;
+    const auto channel = d.channel;
+    const auto& song = engine.getSong();
+    if (channel >= 0 && channel < (int) song.channels.size())
+        menu.addSectionHeader (juce::String::fromUTF8 (song.channels[(std::size_t) channel].name.c_str()));
+    for (int m = 0; m < dance::moveCount; ++m)
+        menu.addItem (tr (dance::moveName (m)), true, d.now.move == m, [this, channel, m] {
+            if (auto it = dancers.find (channel); it != dancers.end())
+            {
+                auto s = it->second.saved;
+                s.move = m;
+                s.mirrored = it->second.now.mirrored;
+                it->second.now.move = m;
+                save (channel, s);
+            }
+        });
+    menu.addSeparator();
+    menu.addItem (tr ("Mirrored"), true, d.now.mirrored, [this, channel] {
+        if (auto it = dancers.find (channel); it != dancers.end())
+        {
+            auto s = it->second.saved;
+            s.mirrored = ! it->second.now.mirrored;
+            s.move = it->second.now.move;
+            it->second.now.mirrored = s.mirrored;
+            save (channel, s);
+        }
+    });
+    menu.addItem (tr ("Hide the dancer"), [this, channel] {
+        if (auto it = dancers.find (channel); it != dancers.end())
+        {
+            auto s = it->second.saved;
+            s.visible = false;
+            it->second.now.visible = false;
+            save (channel, s);
+        }
+    });
+    menu.addItem (tr ("Settings..."), [this, channel] { openChannelSettings (engine, channel); });
+    menu.showMenuAsync (juce::PopupMenu::Options().withMousePosition());
+}
+
+// ---------------------------------------------------------------------------------------------------------------
+// The channel's editor
+// ---------------------------------------------------------------------------------------------------------------
+namespace
+{
+class DanceEditor final : public juce::Component,
+                          private juce::Timer
+{
+public:
+    DanceEditor (AudioEngine& e, int c) : engine (e), channel (c)
+    {
+        settings = current();
+        shownPose = dance::pose (settings.move, 0.3, (std::uint32_t) channel * 7919u + 1u);
+        for (int m = 0; m < dance::moveCount; ++m)
+            moveBox.addItem (tr (dance::moveName (m)), m + 1);
+        moveBox.onChange = [this] { change ([this] (dance::Settings& s) { s.move = moveBox.getSelectedId() - 1; }); };
+        mirrored.setButtonText (tr ("Mirrored"));
+        mirrored.onClick = [this] { change ([this] (dance::Settings& s) { s.mirrored = mirrored.getToggleState(); }); };
+        shown.setButtonText (tr ("Show the dancer"));
+        shown.onClick = [this] { change ([this] (dance::Settings& s) { s.visible = shown.getToggleState(); }); };
+        size.setRange (0.25, 3.0, 0.01);
+        size.setSkewFactorFromMidPoint (1.0);
+        size.setDoubleClickReturnValue (true, 1.0);
+        size.setTextValueSuffix (" x");
+        size.onValueChange = [this] { change ([this] (dance::Settings& s) { s.scale = (float) size.getValue(); }); };
+        speed.setRange (0.125, 4.0, 0.001);
+        speed.setSkewFactorFromMidPoint (1.0);
+        speed.setDoubleClickReturnValue (true, 1.0);
+        speed.setTextValueSuffix (" x");
+        speed.onValueChange = [this] { change ([this] (dance::Settings& s) { s.speed = (float) speed.getValue(); }); };
+        for (auto* s : { &size, &speed })
+        {
+            s->setSliderStyle (juce::Slider::LinearHorizontal);
+            s->setTextBoxStyle (juce::Slider::TextBoxRight, false, 60, 20);
+        }
+        colour.setButtonText (tr ("Outfit colour..."));
+        colour.onClick = [this] {
+            const auto before = settings.colour;
+            ui::showColourPickerPopup (colour.getScreenBounds(), tr ("Outfit colour"), juce::Colour (settings.colour),
+                                       [this] (juce::Colour c) { settings.colour = c.getARGB() | 0xff000000u; repaint(); },
+                                       [this] (juce::Colour c) { change ([c] (dance::Settings& s) { s.colour = c.getARGB() | 0xff000000u; }); },
+                                       [this, before] { settings.colour = before; repaint(); });
+        };
+        place.setButtonText (tr ("Put the dancer back"));
+        place.onClick = [this] {
+            const dance::Settings defaults;
+            change ([defaults] (dance::Settings& s) {
+                s.x = defaults.x;
+                s.y = defaults.y;
+                s.visible = true;
+            });
+        };
+        for (auto* c : std::initializer_list<juce::Component*> { &moveBox, &mirrored, &shown, &size, &speed, &colour, &place })
+            addAndMakeVisible (c);
+        load();
+        setSize (660, 340);
+        startTimerHz (30);
+    }
+
+    void paint (juce::Graphics& g) override
+    {
+        g.fillAll (theme::colour::bg2);
+        g.setColour (theme::colour::bg0);
+        g.fillRoundedRectangle (stage.toFloat(), 6.0f);
+        // a floor line
+        g.setColour (theme::colour::border);
+        g.drawHorizontalLine (stage.getBottom() - 26, (float) stage.getX() + 12.0f, (float) stage.getRight() - 12.0f);
+        {
+            juce::Graphics::ScopedSaveState save (g);
+            g.reduceClipRegion (stage);
+            const auto h = juce::jmin ((float) stage.getHeight() * 0.68f, 190.0f);
+            dancer::draw (g, { (float) stage.getCentreX(), (float) stage.getBottom() - 26.0f }, h, shownPose, settings.mirrored, juce::Colour (settings.colour));
+        }
+        g.setColour (theme::colour::textPrimary);
+        g.setFont (theme::font (theme::type::title));
+        g.drawText (tr ("LYNX Dance"), header, juce::Justification::centredLeft);
+        g.setFont (theme::font (theme::type::small));
+        g.setColour (theme::colour::textSecondary);
+        g.drawFittedText (tr ("Fruity Dance's role with LYNX's own dancer: it makes no sound. Its notes pick the move; drag the dancer to "
+                              "place it, right-click it for its moves."),
+                          header.translated (0, 22).withHeight (30), juce::Justification::topLeft, 2);
+        for (const auto& [area, text] : { std::pair { moveLabel, tr ("Move") }, std::pair { sizeLabel, tr ("Size") }, std::pair { speedLabel, tr ("Speed") } })
+        {
+            g.setColour (theme::colour::textSecondary);
+            g.drawText (text, area, juce::Justification::centredLeft);
+        }
+        g.setColour (theme::colour::textSecondary);
+        g.drawFittedText (keyHelp(), keysArea, juce::Justification::topLeft, 6);
+    }
+
+    void resized() override
+    {
+        auto area = getLocalBounds().reduced (12);
+        stage = area.removeFromLeft (230);
+        area.removeFromLeft (14);
+        header = area.removeFromTop (22);
+        area.removeFromTop (34);
+        auto row = [&area] (int h = 26) { auto r = area.removeFromTop (h); area.removeFromTop (6); return r; };
+        {
+            auto r = row();
+            moveLabel = r.removeFromLeft (60);
+            moveBox.setBounds (r.removeFromLeft (180));
+        }
+        {
+            auto r = row();
+            sizeLabel = r.removeFromLeft (60);
+            size.setBounds (r);
+        }
+        {
+            auto r = row();
+            speedLabel = r.removeFromLeft (60);
+            speed.setBounds (r);
+        }
+        {
+            auto r = row();
+            shown.setBounds (r.removeFromLeft (170));
+            mirrored.setBounds (r.removeFromLeft (140));
+        }
+        {
+            auto r = row();
+            colour.setBounds (r.removeFromLeft (150));
+            r.removeFromLeft (8);
+            place.setBounds (r.removeFromLeft (170));
+        }
+        keysArea = area;
+    }
+
+private:
+    dance::Settings current() const
+    {
+        const auto& song = engine.getSong();
+        if (channel < 0 || channel >= (int) song.channels.size())
+            return {};
+        return dance::read (song.channels[(std::size_t) channel].pluginState);
+    }
+
+    void load()
+    {
+        moveBox.setSelectedId (settings.move + 1, juce::dontSendNotification);
+        mirrored.setToggleState (settings.mirrored, juce::dontSendNotification);
+        shown.setToggleState (settings.visible, juce::dontSendNotification);
+        size.setValue (settings.scale, juce::dontSendNotification);
+        speed.setValue (settings.speed, juce::dontSendNotification);
+    }
+
+    void change (const std::function<void (dance::Settings&)>& edit)
+    {
+        auto s = current();
+        edit (s);
+        settings = s;
+        saveSettings (engine, channel, s, true);
+        repaint();
+    }
+
+    static juce::String keyName (int key) { return juce::MidiMessage::getMidiNoteName (key, true, true, 5); }
+
+    juce::String keyHelp() const
+    {
+        juce::String moves;
+        for (int m = 0; m < dance::moveCount; ++m)
+            moves << (m > 0 ? ", " : "") << keyName (dance::firstMoveKey + m) << " " << tr (dance::moveName (m));
+        return tr ("Keys (as in FL's Fruity Dance): {0}. From {1} down: the same moves mirrored. {2} hides the dancer, {3} shows it.",
+                   { moves, keyName (dance::firstMirrorKey), keyName (dance::hideKey), keyName (dance::showKey) });
+    }
+
+    void timerCallback() override
+    {
+        if (! isShowing())
+            return;
+        // the editor follows the saved settings (an undo, the stage's menu)
+        if (const auto s = current(); s != settings)
+        {
+            settings = s;
+            load();
+        }
+        const auto beats = clock.beats (engine);
+        shownPose = dance::pose (settings.move, beats * 0.5 * settings.speed, (std::uint32_t) channel * 7919u + 1u);
+        repaint (stage);
+    }
+
+    AudioEngine& engine;
+    int channel;
+    dance::Settings settings;
+    dance::Pose shownPose;
+    DanceClock clock;
+    juce::ComboBox moveBox;
+    juce::ToggleButton mirrored, shown;
+    juce::Slider size, speed;
+    juce::TextButton colour, place;
+    juce::Rectangle<int> stage, header, moveLabel, sizeLabel, speedLabel, keysArea;
+};
+} // namespace
+
+std::unique_ptr<juce::Component> makeDanceEditor (AudioEngine& engine, int channel)
+{
+    return std::make_unique<DanceEditor> (engine, channel);
+}
+} // namespace lynx

+ 78 - 0
src/ui/DanceView.h

@@ -0,0 +1,78 @@
+#pragma once
+
+// LYNX Dance on screen (round 165e): the dancers of the project's dance channels drawn over the workspace (drag one to
+// move it, right-click for its moves), and the channel's editor. The character is LYNX's own, drawn with vector shapes
+// (core/FruityDance.h has the moves and FL's key map).
+
+#include <functional>
+#include <map>
+#include <memory>
+
+#include <juce_gui_basics/juce_gui_basics.h>
+
+#include "core/FruityDance.h"
+
+namespace lynx
+{
+class AudioEngine;
+class Instrument;
+
+namespace dancer
+{
+// The character in `pose`, standing at `feet` (between its feet), `height` pixels tall at rest
+void draw (juce::Graphics& g, juce::Point<float> feet, float height, const dance::Pose& pose, bool mirrored, juce::Colour outfit);
+// The box the character can reach (arms up, jumps), for repaints and the mouse
+juce::Rectangle<float> reach (juce::Point<float> feet, float height);
+} // namespace dancer
+
+// Over the workspace: one dancer per visible dance channel. Only the dancers take the mouse.
+class DanceStage final : public juce::Component,
+                         private juce::Timer
+{
+public:
+    explicit DanceStage (AudioEngine& engine);
+    ~DanceStage() override;
+
+    void paint (juce::Graphics& g) override;
+    bool hitTest (int x, int y) override;
+    void mouseDown (const juce::MouseEvent& e) override;
+    void mouseDrag (const juce::MouseEvent& e) override;
+    void mouseUp (const juce::MouseEvent& e) override;
+
+    int dancerCount() const noexcept { return (int) dancers.size(); }
+    void update(); // scan the song and move the dancers on now (snapshots; the timer does it live)
+
+private:
+    struct Dancer
+    {
+        int channel = -1;
+        std::vector<std::uint8_t> savedState;
+        dance::Settings saved, now; // as saved; as the notes left it
+        dance::Pose from, shown;
+        double blendStart = -1.0, cycles = 0.0;
+        int lastMove = -1;
+        std::uint32_t seen = 0;
+        std::shared_ptr<Instrument> instrument;
+        juce::Rectangle<float> bounds; // painted last
+        bool drawn = false;
+    };
+
+    void timerCallback() override;
+    void scan();
+    juce::Rectangle<float> boxOf (const Dancer& d) const;
+    Dancer* dancerAt (juce::Point<float> p);
+    void showMenu (Dancer& d);
+    void save (int channel, const dance::Settings& s);
+
+    AudioEngine& engine;
+    std::map<int, Dancer> dancers;
+    double lastMs = 0.0, freeBeats = 0.0;
+    bool wasPlaying = false;
+    int scanCountdown = 0;
+    int dragging = -1;
+    juce::Point<int> dragOffset;
+};
+
+// The dance channel's settings: a live preview, the move, mirrored / shown, size, speed, the outfit colour, the keys
+std::unique_ptr<juce::Component> makeDanceEditor (AudioEngine& engine, int channel);
+} // namespace lynx

+ 569 - 249
src/ui/I18nData.h

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

+ 12 - 0
src/ui/MainComponent.cpp

@@ -7,6 +7,7 @@
 
 #include "core/TransportEdit.h"
 #include "ui/CrashReporter.h"
+#include "ui/DanceView.h"
 #include "engine/AudioLogger.h"
 #include "ui/PluginSkin.h"
 #include "platform/Paths.h"
@@ -401,6 +402,10 @@ MainComponent::MainComponent (AudioEngine& e, bool restoreUserSettings)
         addAndMakeVisible (c);
         c->setMouseClickGrabsKeyboardFocus (false); // the PC keyboard stays with the main window
     }
+    // the dancers of the project's dance channels (FL's Fruity Dance) over the workspace (round 165e)
+    danceStage = std::make_unique<DanceStage> (engine);
+    danceStage->setMouseClickGrabsKeyboardFocus (false);
+    addAndMakeVisible (*danceStage);
 
     for (auto& b : panelButtons)
     {
@@ -786,6 +791,11 @@ void MainComponent::resized()
         toolbarEditor->toFront (false);
     }
     workspace.setBounds (getLocalBounds().withTrimmedTop (toolbarHeight + tray));
+    if (danceStage != nullptr)
+    {
+        danceStage->setBounds (getLocalBounds());
+        danceStage->toFront (false);
+    }
     if (setupOverlay != nullptr)
     {
         setupOverlay->setBounds (getLocalBounds());
@@ -1696,6 +1706,8 @@ void MainComponent::selectTabForSnapshot (int tab)
 void MainComponent::showDesktopForSnapshot (bool extraPanels)
 {
     workspace.resetLayout();
+    if (auto* stage = dynamic_cast<DanceStage*> (danceStage.get()))
+        stage->update(); // (the project's dancers now: no timer runs before the picture)
 
     if (extraPanels)
     {

+ 1 - 0
src/ui/MainComponent.h

@@ -410,6 +410,7 @@ private:
     MixerComponent mixer;
     BrowserComponent browser;
     Workspace workspace; // after the panels' contents: it is destroyed first
+    std::unique_ptr<juce::Component> danceStage; // the dance channels' dancers over the workspace (ui/DanceView.h, round 165e)
 
     std::unique_ptr<juce::FileChooser> fileChooser;
     juce::File currentFile;

Dosya farkı çok büyük olduğundan ihmal edildi
+ 549 - 230
src/ui/VisualEditors.cpp


+ 3 - 0
src/ui/VisualEditors.h

@@ -55,6 +55,9 @@ public:
     // moves the scene's animated layers (particles, rings) on to `frame` — once per frame
     void advance (const visualfx::scene::Scene& scene, const visualfx::Frame& frame, float aspect);
     void draw (juce::Graphics& g, juce::Rectangle<float> area, const visualfx::scene::Scene& scene, const visualfx::Frame& frame);
+    // one layer alone, without the scene's zoom and brightness (the GPU renderer composes the layers itself)
+    void drawLayer (juce::Graphics& g, juce::Rectangle<float> area, const visualfx::scene::Scene& scene, std::size_t index,
+                    const visualfx::Frame& frame);
     void reset();
 
 private:

+ 1021 - 0
src/ui/VisualGl.cpp

@@ -0,0 +1,1021 @@
+#include "ui/VisualGl.h"
+
+#include <algorithm>
+#include <chrono>
+#include <cmath>
+#include <condition_variable>
+#include <cstring>
+#include <map>
+
+#include "platform/CrashGuard.h"
+#include "platform/Paths.h"
+#include "ui/VisualEditors.h"
+
+#include "ui/VisualGlShaders.inc"
+
+namespace lynx
+{
+using namespace juce::gl;
+namespace vs = visualfx::scene;
+using visualfx::Frame;
+
+// ---------------------------------------------------------------------------------------------------------------
+// Settings and the crash note
+// ---------------------------------------------------------------------------------------------------------------
+namespace visualgl
+{
+namespace
+{
+int setting = -1;
+std::atomic<bool> failed { false };
+juce::String failure;
+std::atomic<int> activeViews { 0 };
+
+void viewStarted()
+{
+    if (activeViews++ == 0)
+        crashguard::note (startNote);
+}
+
+void viewStopped()
+{
+    if (--activeViews == 0)
+        crashguard::note (stopNote);
+}
+} // namespace
+
+bool enabled()
+{
+    // (LYNX_VISUALIZER_GPU=0: the 2D renderer for this run, without changing the saved choice)
+    static const bool forcedOff = juce::SystemStats::getEnvironmentVariable ("LYNX_VISUALIZER_GPU", {}).trim() == "0";
+    if (forcedOff)
+        return false;
+    if (setting < 0)
+        setting = platform::settingsFile ("visualizer-gpu.txt").loadFileAsString().trim() == "0" ? 0 : 1;
+    return setting != 0;
+}
+
+void setEnabled (bool on)
+{
+    setting = on ? 1 : 0;
+    platform::settingsFile ("visualizer-gpu.txt").replaceWithText (on ? "1" : "0");
+    if (on)
+        failed = false; // (the user asks for it again: try once more)
+}
+
+bool failedThisSession() { return failed.load(); }
+
+void markFailed (const juce::String& why)
+{
+    failed = true;
+    failure = why;
+}
+
+juce::String failureReason() { return failure; }
+
+void useClassicRendering (juce::Component& topLevel)
+{
+    topLevel.getProperties().set ("lynxGdi", true);
+   #if JUCE_WINDOWS
+    if (auto* peer = topLevel.getPeer())
+        if (const auto engines = peer->getAvailableRenderingEngines(); engines.size() > 1 && peer->getCurrentRenderingEngine() != 0)
+            peer->setCurrentRenderingEngine (0);
+   #endif
+}
+} // namespace visualgl
+
+// ---------------------------------------------------------------------------------------------------------------
+// The renderer
+// ---------------------------------------------------------------------------------------------------------------
+namespace
+{
+// the live picture is drawn at most 1280 x 720 inside and stretched to the window (full screen too): the shader layers'
+// cost grows with the pixels, and a quarter of a 4K screen's pixels keeps even an integrated GPU cool (the video
+// export draws its own size off-screen, as fast as the encoder takes the frames)
+constexpr int maxLiveWidth = 1280, maxLiveHeight = 720;
+
+struct Program
+{
+    std::unique_ptr<juce::OpenGLShaderProgram> program;
+    GLint position = -1;
+};
+
+const char* effectSource (vs::LayerType type, int effect, juce::String& prefix)
+{
+    using T = vs::LayerType;
+    switch (type)
+    {
+        case T::canvas:
+        {
+            static const char* list[] = { glsl::canvasPlasma, glsl::canvasTunnel, glsl::canvasCells, glsl::canvasKaleido,
+                                          glsl::canvasClouds, glsl::canvasWarp, glsl::canvasElectric, glsl::canvasRays };
+            return list[juce::jlimit (0, (int) std::size (list) - 1, effect)];
+        }
+        case T::terrain:
+        {
+            prefix = glsl::terrainCommon;
+            static const char* list[] = { glsl::terrainMountains, glsl::terrainHills, glsl::terrainRoad };
+            return list[juce::jlimit (0, (int) std::size (list) - 1, effect)];
+        }
+        case T::object3d:
+        {
+            prefix = glsl::objectCommon;
+            static const char* list[] = { glsl::objectBlob, glsl::objectTorus, glsl::objectCubes, glsl::objectRings };
+            return list[juce::jlimit (0, (int) std::size (list) - 1, effect)];
+        }
+        case T::feedback:
+        {
+            static const char* list[] = { glsl::feedbackZoom, glsl::feedbackSpin, glsl::feedbackKaleido, glsl::feedbackWarp,
+                                          glsl::feedbackEcho, glsl::feedbackDrift };
+            return list[juce::jlimit (0, (int) std::size (list) - 1, effect)];
+        }
+        case T::postprocess:
+        {
+            // bloom (0) and blur (1) are multi-pass (see Impl::blur)
+            static const char* list[] = { nullptr, nullptr, glsl::postRgbShift, glsl::postPixelate, glsl::postDots,
+                                          glsl::postScanlines, glsl::postVignette, glsl::postColor, glsl::postKaleido,
+                                          glsl::postMirror, glsl::postEdges, glsl::postShake, glsl::postGlitch,
+                                          glsl::postGrain, glsl::postInvert };
+            return list[juce::jlimit (0, (int) std::size (list) - 1, effect)];
+        }
+        default: return nullptr;
+    }
+}
+} // namespace
+
+struct GlSceneRenderer::Impl
+{
+    juce::OpenGLContext* context = nullptr;
+    juce::String error;
+    GLuint quad = 0, specTex = 0, histTex = 0;
+    std::map<int, Program> programs; // key: type * 100 + effect; special keys below
+    std::map<int, bool> broken;      // shaders that did not compile (that layer is skipped)
+    enum Special { composite = 9000, finalPass, copy, down, blurPass, bloomMix, blurMix };
+    juce::OpenGLFrameBuffer accum[2], layer, out, blurA, blurB;
+    std::map<std::size_t, std::unique_ptr<juce::OpenGLFrameBuffer>> trails; // feedback layers' own pictures
+    int cur = 0, w = 0, h = 0;
+    SceneRenderer flat; // the 2D layers (through JUCE's OpenGL renderer)
+    std::vector<float> phase;
+    std::array<std::uint8_t, 64 * 4> specBytes {};
+    std::vector<std::uint8_t> histRowBytes = std::vector<std::uint8_t> (64 * 4);
+    int histRow = 0;
+    bool timing = false, hasFrame = false;
+    double gpuMs = 0.0;
+
+    bool make (int key, const juce::String& fragment)
+    {
+        Program p;
+        p.program = std::make_unique<juce::OpenGLShaderProgram> (*context);
+        if (! p.program->addVertexShader (juce::OpenGLHelpers::translateVertexShaderToV3 (glsl::vertex))
+            || ! p.program->addFragmentShader (juce::OpenGLHelpers::translateFragmentShaderToV3 (fragment)) || ! p.program->link())
+        {
+            error = "shader " + juce::String (key) + ": " + p.program->getLastError();
+            DBG (error);
+            broken[key] = true;
+            return false;
+        }
+        p.position = glGetAttribLocation (p.program->getProgramID(), "position");
+        programs[key] = std::move (p);
+        return true;
+    }
+
+    Program* get (int key, const std::function<juce::String()>& source)
+    {
+        if (auto it = programs.find (key); it != programs.end())
+            return &it->second;
+        if (broken.count (key) != 0)
+            return nullptr;
+        return make (key, source()) ? &programs[key] : nullptr;
+    }
+
+    Program* effectProgram (vs::LayerType type, int effect)
+    {
+        const auto key = (int) type * 100 + effect;
+        return get (key, [type, effect] {
+            juce::String prefix;
+            const auto* body = effectSource (type, effect, prefix);
+            if (body == nullptr)
+                return juce::String();
+            if (type == vs::LayerType::feedback)
+                return juce::String (glsl::common) + body + glsl::feedbackMain;
+            return juce::String (glsl::common) + prefix + body;
+        });
+    }
+
+    Program* special (Special s)
+    {
+        return get ((int) s, [s] {
+            switch (s)
+            {
+                case composite: return juce::String (glsl::composite);
+                case finalPass: return juce::String (glsl::finalPass);
+                case copy: return juce::String (glsl::copy);
+                case down: return juce::String (glsl::common) + glsl::postDown;
+                case blurPass: return juce::String (glsl::common) + glsl::postBlurPass;
+                case bloomMix: return juce::String (glsl::common) + glsl::postBloomMix;
+                case blurMix: return juce::String (glsl::common) + glsl::postBlurMix;
+            }
+            return juce::String();
+        });
+    }
+
+    bool create (juce::OpenGLContext& c)
+    {
+        context = &c;
+        if (! c.areShadersAvailable())
+        {
+            error = "OpenGL shaders are not available";
+            return false;
+        }
+        const GLfloat corners[] = { -1.0f, -1.0f, 1.0f, -1.0f, -1.0f, 1.0f, 1.0f, 1.0f };
+        glGenBuffers (1, &quad);
+        glBindBuffer (GL_ARRAY_BUFFER, quad);
+        glBufferData (GL_ARRAY_BUFFER, sizeof (corners), corners, GL_STATIC_DRAW);
+        glBindBuffer (GL_ARRAY_BUFFER, 0);
+        auto texture = [] (GLuint& id, int tw, int th, GLint wrapT) {
+            glGenTextures (1, &id);
+            glBindTexture (GL_TEXTURE_2D, id);
+            glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+            glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+            glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+            glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrapT);
+            std::vector<std::uint8_t> zeros ((std::size_t) (tw * th * 4), 0);
+            glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, tw, th, 0, GL_RGBA, GL_UNSIGNED_BYTE, zeros.data());
+        };
+        texture (specTex, 64, 1, GL_CLAMP_TO_EDGE);
+        texture (histTex, 64, 128, GL_REPEAT);
+        glBindTexture (GL_TEXTURE_2D, 0);
+        // the programs every frame needs (a failure here = no GPU path)
+        for (auto s : { composite, finalPass, copy })
+            if (special (s) == nullptr)
+                return false;
+        return glGetError() == GL_NO_ERROR || true;
+    }
+
+    void release()
+    {
+        programs.clear();
+        broken.clear();
+        for (auto& f : accum)
+            f.release();
+        for (auto* f : { &layer, &out, &blurA, &blurB })
+            f->release();
+        trails.clear();
+        if (quad != 0)
+            glDeleteBuffers (1, &quad);
+        if (specTex != 0)
+            glDeleteTextures (1, &specTex);
+        if (histTex != 0)
+            glDeleteTextures (1, &histTex);
+        quad = specTex = histTex = 0;
+        w = h = 0;
+        hasFrame = false;
+        flat.reset();
+    }
+
+    bool resize (int width, int height)
+    {
+        if (width == w && height == h)
+            return true;
+        w = width;
+        h = height;
+        trails.clear();
+        bool ok = true;
+        for (auto& f : accum)
+            ok = ok && f.initialise (*context, w, h);
+        ok = ok && layer.initialise (*context, w, h) && out.initialise (*context, w, h);
+        ok = ok && blurA.initialise (*context, juce::jmax (1, w / 2), juce::jmax (1, h / 2)) && blurB.initialise (*context, juce::jmax (1, w / 2), juce::jmax (1, h / 2));
+        if (! ok)
+            error = "could not make the " + juce::String (w) + " x " + juce::String (h) + " frame buffers";
+        return ok;
+    }
+
+    // ---- drawing helpers ----
+    void bindTarget (juce::OpenGLFrameBuffer& f)
+    {
+        glBindFramebuffer (GL_FRAMEBUFFER, f.getFrameBufferID());
+        glViewport (0, 0, f.getWidth(), f.getHeight());
+    }
+
+    void bindTexture (int unit, GLuint id)
+    {
+        glActiveTexture ((GLenum) (GL_TEXTURE0 + unit));
+        glBindTexture (GL_TEXTURE_2D, id);
+    }
+
+    void drawQuad (Program& p)
+    {
+        glBindBuffer (GL_ARRAY_BUFFER, quad);
+        if (p.position >= 0)
+        {
+            glVertexAttribPointer ((GLuint) p.position, 2, GL_FLOAT, GL_FALSE, 0, nullptr);
+            glEnableVertexAttribArray ((GLuint) p.position);
+        }
+        glDrawArrays (GL_TRIANGLE_STRIP, 0, 4);
+        if (p.position >= 0)
+            glDisableVertexAttribArray ((GLuint) p.position);
+        glBindBuffer (GL_ARRAY_BUFFER, 0);
+    }
+
+    void resetState()
+    {
+        glDisable (GL_BLEND);
+        glDisable (GL_DEPTH_TEST);
+        glDisable (GL_SCISSOR_TEST);
+        glDisable (GL_STENCIL_TEST);
+        glColorMask (GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
+        glUseProgram (0);
+        // JUCE's 2D renderer expects texture unit 0 active (else its glyph / image textures land on another unit and
+        // text drawn after a shader layer disappears)
+        for (int unit = 4; unit >= 0; --unit)
+        {
+            glActiveTexture ((GLenum) (GL_TEXTURE0 + unit));
+            glBindTexture (GL_TEXTURE_2D, 0);
+        }
+    }
+
+    static juce::Colour hued (std::uint32_t argb, float hueShift)
+    {
+        auto c = juce::Colour (argb);
+        return hueShift > 0.001f ? c.withRotatedHue (hueShift) : c;
+    }
+
+    void setCommon (juce::OpenGLShaderProgram& p, const vs::Layer& L, std::size_t index, const Frame& f, int tw, int th)
+    {
+        p.setUniform ("uSrc", 0);
+        p.setUniform ("uPrev", 1);
+        p.setUniform ("uSpec", 2);
+        p.setUniform ("uHist", 3);
+        p.setUniform ("uRes", (GLfloat) tw, (GLfloat) th);
+        p.setUniform ("uTime", index < phase.size() ? phase[index] : 0.0f);
+        p.setUniform ("uAbs", (GLfloat) std::fmod (f.time, 10000.0));
+        p.setUniform ("uLevel", f.level);
+        p.setUniform ("uBass", f.bass);
+        p.setUniform ("uMid", f.mid);
+        p.setUniform ("uHigh", f.high);
+        p.setUniform ("uBeat", f.beat);
+        p.setUniform ("uBand", f.bandValue (L.band));
+        p.setUniform ("uReact", L.react);
+        p.setUniform ("uSpeed", L.speed);
+        p.setUniform ("uAmount", L.amount);
+        p.setUniform ("uSize", L.size);
+        p.setUniform ("uCount", (GLfloat) L.count);
+        p.setUniform ("uOpacity", L.opacity);
+        p.setUniform ("uHistRow", (GLfloat) histRow);
+        // the shaders measure y up (GL); the scene's y goes down
+        p.setUniform ("uPos", L.x, 1.0f - L.y);
+        const auto hue = f.params[visualfx::visualizer::hueShift];
+        const auto a = hued (L.colourA, hue), b = hued (L.colourB, hue);
+        p.setUniform ("uColA", a.getFloatRed(), a.getFloatGreen(), a.getFloatBlue(), a.getFloatAlpha());
+        p.setUniform ("uColB", b.getFloatRed(), b.getFloatGreen(), b.getFloatBlue(), b.getFloatAlpha());
+        p.setUniform ("uDir", 0.0f, 0.0f);
+    }
+
+    void bindAnalysisTextures()
+    {
+        bindTexture (2, specTex);
+        bindTexture (3, histTex);
+    }
+
+    // a pass of `program` from the current picture into the other accumulation buffer
+    void passInto (juce::OpenGLFrameBuffer& target, Program& p, GLuint src, GLuint prev)
+    {
+        bindTarget (target);
+        p.program->use();
+        bindTexture (0, src);
+        bindTexture (1, prev);
+        bindAnalysisTextures();
+        drawQuad (p);
+    }
+
+    void swapInto (Program& p, const vs::Layer& L, std::size_t index, const Frame& f, GLuint prev)
+    {
+        auto& next = accum[1 - cur];
+        p.program->use();
+        setCommon (*p.program, L, index, f, w, h);
+        passInto (next, p, accum[cur].getTextureID(), prev);
+        cur = 1 - cur;
+    }
+
+    void composeLayer (const vs::Layer& L, float opacity)
+    {
+        auto* p = special (composite);
+        if (p == nullptr)
+            return;
+        bindTarget (accum[1 - cur]);
+        p->program->use();
+        p->program->setUniform ("uSrc", 0);
+        p->program->setUniform ("uLayer", 4);
+        p->program->setUniform ("uOpacity", opacity);
+        p->program->setUniform ("uMode", (GLfloat) (int) L.blend);
+        bindTexture (0, accum[cur].getTextureID());
+        bindTexture (4, layer.getTextureID());
+        drawQuad (*p);
+        cur = 1 - cur;
+    }
+
+    // ---- per frame ----
+    void advance (const vs::Scene& s, const Frame& f)
+    {
+        flat.advance (s, f, (float) w / (float) juce::jmax (1, h));
+        const auto speedKnob = (float) std::pow (4.0, (double) f.params[visualfx::visualizer::speed] * 2.0 - 1.0);
+        phase.resize (s.layers.size(), 0.0f);
+        for (std::size_t i = 0; i < s.layers.size(); ++i)
+        {
+            const auto& L = s.layers[i];
+            const auto rate = (0.15f + L.speed * 1.85f) * speedKnob * (1.0f + 0.5f * f.bandValue (L.band) * L.react);
+            phase[i] = std::fmod (phase[i] + (float) f.dt * rate, 3600.0f);
+        }
+        for (int b = 0; b < 64; ++b)
+        {
+            const auto v = (std::uint8_t) juce::jlimit (0, 255, (int) std::lround (f.spectrum[(std::size_t) b] * 255.0f));
+            for (int k = 0; k < 4; ++k)
+                specBytes[(std::size_t) (b * 4 + k)] = v;
+        }
+        glBindTexture (GL_TEXTURE_2D, specTex);
+        glTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, 64, 1, GL_RGBA, GL_UNSIGNED_BYTE, specBytes.data());
+        histRow = (histRow + 1) % 128;
+        glBindTexture (GL_TEXTURE_2D, histTex);
+        glTexSubImage2D (GL_TEXTURE_2D, 0, 0, histRow, 64, 1, GL_RGBA, GL_UNSIGNED_BYTE, specBytes.data());
+        glBindTexture (GL_TEXTURE_2D, 0);
+    }
+
+    void drawFlat (juce::OpenGLFrameBuffer& target, const vs::Scene& s, std::size_t from, std::size_t to, const Frame& f)
+    {
+        resetState();
+        {
+            auto g2 = juce::createOpenGLGraphicsContext (*context, target);
+            juce::Graphics g (*g2);
+            for (auto i = from; i < to; ++i)
+                flat.drawLayer (g, juce::Rectangle<float> ((float) w, (float) h), s, i, f);
+        }
+        resetState();
+    }
+
+    void blur (const vs::Layer& L, std::size_t index, const Frame& f, bool bloom)
+    {
+        auto* dp = special (down);
+        auto* bp = special (blurPass);
+        auto* mp = special (bloom ? bloomMix : blurMix);
+        if (dp == nullptr || bp == nullptr || mp == nullptr)
+            return;
+        const auto bw = blurA.getWidth(), bh = blurA.getHeight();
+        dp->program->use();
+        setCommon (*dp->program, L, index, f, bw, bh);
+        dp->program->setUniform ("uThreshold", bloom ? juce::jlimit (0.0f, 0.95f, 0.85f - juce::jlimit (0, 512, L.count) / 512.0f * 0.8f) : -1.0f);
+        passInto (blurA, *dp, accum[cur].getTextureID(), 0);
+        const auto radius = (0.5f + L.size * 4.0f) * (1.0f + (bloom ? 0.0f : f.bandValue (L.band) * L.react));
+        const auto passes = bloom ? 2 : (L.size > 0.5f ? 3 : 2);
+        bp->program->use();
+        setCommon (*bp->program, L, index, f, bw, bh);
+        for (int k = 0; k < passes; ++k)
+        {
+            bp->program->use();
+            bp->program->setUniform ("uDir", radius / (float) bw, 0.0f);
+            passInto (blurB, *bp, blurA.getTextureID(), 0);
+            bp->program->use();
+            bp->program->setUniform ("uDir", 0.0f, radius / (float) bh);
+            passInto (blurA, *bp, blurB.getTextureID(), 0);
+        }
+        swapInto (*mp, L, index, f, blurA.getTextureID());
+    }
+
+    void render (const vs::Scene& s, const Frame& f, int width, int height)
+    {
+        if (context == nullptr || ! resize (width, height))
+            return;
+        if (timing)
+            glFinish();
+        const auto t0 = juce::Time::getMillisecondCounterHiRes();
+        resetState();
+        advance (s, f);
+        cur = 0;
+        bindTarget (accum[0]);
+        glClearColor (0.0f, 0.0f, 0.0f, 1.0f);
+        glClear (GL_COLOR_BUFFER_BIT);
+
+        std::size_t i = 0;
+        while (i < s.layers.size())
+        {
+            const auto& L = s.layers[i];
+            if (! L.enabled || L.opacity <= 0.0f)
+            {
+                ++i;
+                continue;
+            }
+            if (! vs::isShaderType (L.type))
+            {
+                if (L.blend == vs::Blend::normal)
+                {
+                    // the 2D layers in a row draw straight into the picture (JUCE blends them normally)
+                    auto end = i + 1;
+                    while (end < s.layers.size() && ! vs::isShaderType (s.layers[end].type) && s.layers[end].blend == vs::Blend::normal)
+                        ++end;
+                    drawFlat (accum[cur], s, i, end, f);
+                    i = end;
+                    continue;
+                }
+                layer.makeCurrentRenderingTarget();
+                glViewport (0, 0, w, h);
+                glClearColor (0.0f, 0.0f, 0.0f, 0.0f);
+                glClear (GL_COLOR_BUFFER_BIT);
+                layer.releaseAsRenderingTarget();
+                drawFlat (layer, s, i, i + 1, f);
+                composeLayer (L, 1.0f); // (the layer drew its own opacity)
+                ++i;
+                continue;
+            }
+            switch (L.type)
+            {
+                case vs::LayerType::canvas:
+                case vs::LayerType::terrain:
+                case vs::LayerType::object3d:
+                {
+                    auto* p = effectProgram (L.type, L.effect);
+                    if (p == nullptr)
+                        break;
+                    p->program->use();
+                    setCommon (*p->program, L, i, f, w, h);
+                    if (L.blend == vs::Blend::normal || L.blend == vs::Blend::add)
+                    {
+                        // over the picture with GL's own blending (premultiplied colour)
+                        bindTarget (accum[cur]);
+                        glEnable (GL_BLEND);
+                        glBlendFunc (GL_ONE, L.blend == vs::Blend::add ? GL_ONE : GL_ONE_MINUS_SRC_ALPHA);
+                        bindTexture (0, 0); // (these shaders do not read the picture below: no texture bound to the target)
+                        bindAnalysisTextures();
+                        drawQuad (*p);
+                        glDisable (GL_BLEND);
+                    }
+                    else
+                    {
+                        p->program->setUniform ("uOpacity", 1.0f);
+                        bindTarget (layer);
+                        glClearColor (0.0f, 0.0f, 0.0f, 0.0f);
+                        glClear (GL_COLOR_BUFFER_BIT);
+                        bindAnalysisTextures();
+                        drawQuad (*p);
+                        composeLayer (L, L.opacity);
+                    }
+                    break;
+                }
+                case vs::LayerType::feedback:
+                {
+                    auto* p = effectProgram (L.type, L.effect);
+                    if (p == nullptr)
+                        break;
+                    auto& trail = trails[i];
+                    if (trail == nullptr)
+                    {
+                        trail = std::make_unique<juce::OpenGLFrameBuffer>();
+                        if (! trail->initialise (*context, w, h))
+                            break;
+                        bindTarget (*trail);
+                        glClearColor (0.0f, 0.0f, 0.0f, 1.0f);
+                        glClear (GL_COLOR_BUFFER_BIT);
+                    }
+                    swapInto (*p, L, i, f, trail->getTextureID());
+                    // keep this frame for the next one
+                    if (auto* c = special (copy))
+                    {
+                        bindTarget (*trail);
+                        c->program->use();
+                        c->program->setUniform ("uSrc", 0);
+                        bindTexture (0, accum[cur].getTextureID());
+                        drawQuad (*c);
+                    }
+                    break;
+                }
+                case vs::LayerType::postprocess:
+                {
+                    if (L.effect == 0 || L.effect == 1)
+                    {
+                        blur (L, i, f, L.effect == 0);
+                        break;
+                    }
+                    if (auto* p = effectProgram (L.type, L.effect))
+                        swapInto (*p, L, i, f, 0);
+                    break;
+                }
+                default: break;
+            }
+            ++i;
+        }
+
+        // zoom and brightness (the global knobs)
+        if (auto* p = special (finalPass))
+        {
+            bindTarget (out);
+            p->program->use();
+            p->program->setUniform ("uSrc", 0);
+            p->program->setUniform ("uZoom", 0.5f + f.params[visualfx::visualizer::zoom]);
+            p->program->setUniform ("uBright", juce::jlimit (0.0f, 1.0f, f.params[visualfx::visualizer::brightness]));
+            bindTexture (0, accum[cur].getTextureID());
+            drawQuad (*p);
+        }
+        bindTexture (0, 0);
+        glActiveTexture (GL_TEXTURE0);
+        glBindFramebuffer (GL_FRAMEBUFFER, context->getFrameBufferID());
+        hasFrame = true;
+        if (timing)
+        {
+            glFinish();
+            gpuMs = juce::Time::getMillisecondCounterHiRes() - t0;
+        }
+    }
+
+    void present (juce::Rectangle<int> viewport)
+    {
+        auto* p = special (copy);
+        if (p == nullptr || ! hasFrame)
+            return;
+        glBindFramebuffer (GL_FRAMEBUFFER, context->getFrameBufferID());
+        glViewport (viewport.getX(), viewport.getY(), viewport.getWidth(), viewport.getHeight());
+        resetState();
+        p->program->use();
+        p->program->setUniform ("uSrc", 0);
+        bindTexture (0, out.getTextureID());
+        drawQuad (*p);
+        bindTexture (0, 0);
+        glUseProgram (0);
+    }
+
+    bool read (std::uint8_t* bgra)
+    {
+        if (! hasFrame || w <= 0 || h <= 0)
+            return false;
+        std::vector<std::uint8_t> rows ((std::size_t) w * (std::size_t) h * 4);
+        glBindFramebuffer (GL_FRAMEBUFFER, out.getFrameBufferID());
+        glPixelStorei (GL_PACK_ALIGNMENT, 4);
+        glReadPixels (0, 0, w, h, GL_BGRA, GL_UNSIGNED_BYTE, rows.data());
+        glBindFramebuffer (GL_FRAMEBUFFER, context->getFrameBufferID());
+        const auto stride = (std::size_t) w * 4;
+        for (int y = 0; y < h; ++y) // GL's first row is the bottom one
+            std::memcpy (bgra + (std::size_t) y * stride, rows.data() + (std::size_t) (h - 1 - y) * stride, stride);
+        return glGetError() == GL_NO_ERROR || true;
+    }
+};
+
+GlSceneRenderer::GlSceneRenderer() : impl (std::make_unique<Impl>()) {}
+GlSceneRenderer::~GlSceneRenderer() = default;
+
+bool GlSceneRenderer::create (juce::OpenGLContext& context) { return impl->create (context); }
+void GlSceneRenderer::release() { impl->release(); }
+void GlSceneRenderer::render (const vs::Scene& scene, const Frame& frame, int width, int height) { impl->render (scene, frame, width, height); }
+void GlSceneRenderer::present (juce::Rectangle<int> viewport, int) { impl->present (viewport); }
+bool GlSceneRenderer::read (std::uint8_t* bgra) { return impl->read (bgra); }
+int GlSceneRenderer::width() const noexcept { return impl->w; }
+int GlSceneRenderer::height() const noexcept { return impl->h; }
+const juce::String& GlSceneRenderer::error() const noexcept { return impl->error; }
+void GlSceneRenderer::setTiming (bool on) noexcept { impl->timing = on; }
+double GlSceneRenderer::lastGpuMs() const noexcept { return impl->gpuMs; }
+
+void GlSceneRenderer::reset()
+{
+    impl->flat.reset();
+    impl->trails.clear();
+    impl->phase.clear();
+    impl->hasFrame = false;
+}
+
+// ---------------------------------------------------------------------------------------------------------------
+// The live view
+// ---------------------------------------------------------------------------------------------------------------
+GlSceneView::GlSceneView (Producer p, int framesPerSecond, bool fullScreen) : produce (std::move (p)), full (fullScreen), fps (framesPerSecond)
+{
+    setOpaque (true);
+    context.setRenderer (this);
+    context.setComponentPaintingEnabled (false);
+    context.setContinuousRepainting (false);
+    visualgl::viewStarted();
+    context.attachTo (*this);
+    attachedMs = juce::Time::getMillisecondCounterHiRes();
+    startTimerHz (juce::jlimit (1, 60, fps));
+}
+
+GlSceneView::~GlSceneView()
+{
+    stopTimer();
+    context.detach();
+    visualgl::viewStopped();
+}
+
+void GlSceneView::setOverlayText (const juce::String& text)
+{
+    const std::lock_guard<std::mutex> g (lock);
+    overlay = text;
+    context.triggerRepaint();
+}
+
+void GlSceneView::restart()
+{
+    const std::lock_guard<std::mutex> g (lock);
+    resetPending = true;
+}
+
+void GlSceneView::paint (juce::Graphics& g)
+{
+    g.fillAll (juce::Colours::black); // (only while the context is not up)
+}
+
+void GlSceneView::mouseDoubleClick (const juce::MouseEvent&)
+{
+    if (onDoubleClick)
+        onDoubleClick();
+}
+
+void GlSceneView::mouseDown (const juce::MouseEvent&)
+{
+    if (onClick)
+        onClick();
+}
+
+juce::Rectangle<int> GlSceneView::frameArea (const vs::Scene& s, juce::Rectangle<int> bounds) const
+{
+    const auto aspect = (double) s.width / (double) juce::jmax (1, s.height);
+    auto area = bounds.toDouble();
+    auto frame = area.getWidth() / juce::jmax (1.0, area.getHeight()) > aspect ? area.withSizeKeepingCentre (area.getHeight() * aspect, area.getHeight())
+                                                                              : area.withSizeKeepingCentre (area.getWidth(), area.getWidth() / aspect);
+    return frame.toNearestInt();
+}
+
+void GlSceneView::timerCallback()
+{
+    if (failed.load())
+        return;
+    const auto now = juce::Time::getMillisecondCounterHiRes();
+    if (! ready.load() && now - attachedMs > 5000.0)
+    {
+        // no context after five seconds (no OpenGL here): the editor goes back to the 2D picture
+        failed = true;
+        stopTimer();
+        visualgl::markFailed ("no OpenGL context");
+        if (onFailed)
+            onFailed ("no OpenGL context");
+        return;
+    }
+    if (! ready.load() || ! isShowing())
+        return;
+    Frame f;
+    vs::Scene s;
+    if (! produce || ! produce (f, s))
+        return;
+    {
+        const std::lock_guard<std::mutex> g (lock);
+        pendingFrame = f;
+        pendingScene = std::move (s);
+        havePending = true;
+    }
+    context.triggerRepaint();
+}
+
+void GlSceneView::newOpenGLContextCreated()
+{
+    context.setSwapInterval (1);
+    if (! renderer.create (context))
+    {
+        failed = true;
+        const auto why = renderer.error();
+        juce::MessageManager::callAsync ([safe = juce::Component::SafePointer<GlSceneView> (this), why] {
+            visualgl::markFailed (why);
+            if (safe != nullptr && safe->onFailed)
+                safe->onFailed (why);
+        });
+        return;
+    }
+    ready = true;
+}
+
+void GlSceneView::renderOpenGL()
+{
+    if (failed.load())
+        return;
+    Frame f;
+    bool fresh = false;
+    juce::String text;
+    {
+        const std::lock_guard<std::mutex> g (lock);
+        if (resetPending)
+        {
+            renderer.reset();
+            resetPending = false;
+        }
+        if (havePending)
+        {
+            f = pendingFrame;
+            drawnScene = pendingScene;
+            havePending = false;
+            fresh = true;
+        }
+        text = overlay;
+    }
+    const auto scale = context.getRenderingScale();
+    const auto fullW = juce::roundToInt (getWidth() * scale), fullH = juce::roundToInt (getHeight() * scale);
+    if (fullW <= 0 || fullH <= 0)
+        return;
+    auto area = frameArea (drawnScene, { 0, 0, fullW, fullH });
+    if (fresh && area.getWidth() > 8 && area.getHeight() > 8)
+    {
+        // drawn at most maxLiveWidth x maxLiveHeight inside, stretched to the window
+        auto rw = area.getWidth(), rh = area.getHeight();
+        const auto shrink = juce::jmin (1.0, (double) maxLiveWidth / rw, (double) maxLiveHeight / rh);
+        rw = juce::jmax (16, juce::roundToInt (rw * shrink));
+        rh = juce::jmax (16, juce::roundToInt (rh * shrink));
+        renderer.setTiming (timing.load());
+        renderer.render (drawnScene, f, rw, rh);
+        gpuMsLast = renderer.lastGpuMs();
+    }
+    glBindFramebuffer (GL_FRAMEBUFFER, context.getFrameBufferID());
+    glViewport (0, 0, fullW, fullH);
+    glClearColor (0.0f, 0.0f, 0.0f, 1.0f);
+    glClear (GL_COLOR_BUFFER_BIT);
+    // (GL's viewport origin is the bottom-left corner)
+    renderer.present ({ area.getX(), fullH - area.getBottom(), area.getWidth(), area.getHeight() }, fullH);
+    if (text.isNotEmpty())
+    {
+        if (auto g2 = juce::createOpenGLGraphicsContext (context, fullW, fullH))
+        {
+            juce::Graphics g (*g2);
+            g.addTransform (juce::AffineTransform::scale ((float) scale));
+            auto box = juce::Rectangle<float> ((float) getWidth(), 50.0f).withSizeKeepingCentre (440.0f, 30.0f).translated (0.0f, 10.0f);
+            g.setColour (juce::Colours::black.withAlpha (0.6f));
+            g.fillRoundedRectangle (box, 6.0f);
+            g.setColour (juce::Colours::white);
+            g.setFont (juce::FontOptions (15.0f));
+            g.drawText (text, box, juce::Justification::centred);
+        }
+    }
+}
+
+void GlSceneView::openGLContextClosing()
+{
+    renderer.release();
+    ready = false;
+}
+
+juce::Image GlSceneView::snapshot()
+{
+    if (! ready.load())
+        return {};
+    struct Shot
+    {
+        std::mutex m;
+        std::condition_variable cv;
+        bool done = false;
+        int w = 0, h = 0;
+        std::vector<std::uint8_t> pixels;
+    };
+    auto shot = std::make_shared<Shot>();
+    context.executeOnGLThread ([this, shot] (juce::OpenGLContext&) {
+        const auto w = renderer.width(), h = renderer.height();
+        std::vector<std::uint8_t> px ((std::size_t) juce::jmax (0, w * h * 4));
+        const auto ok = w > 0 && h > 0 && renderer.read (px.data());
+        const std::lock_guard<std::mutex> g (shot->m);
+        if (ok)
+        {
+            shot->w = w;
+            shot->h = h;
+            shot->pixels = std::move (px);
+        }
+        shot->done = true;
+        shot->cv.notify_all();
+    }, false);
+    std::unique_lock<std::mutex> g (shot->m);
+    // (the message thread waits: the GL thread never needs it, component painting is off)
+    shot->cv.wait_for (g, std::chrono::milliseconds (2000), [&] { return shot->done; });
+    if (shot->w <= 0)
+        return {};
+    juce::Image image (juce::Image::ARGB, shot->w, shot->h, false, juce::SoftwareImageType());
+    const juce::Image::BitmapData data (image, juce::Image::BitmapData::writeOnly);
+    for (int y = 0; y < shot->h; ++y)
+    {
+        auto* line = data.getLinePointer (y);
+        std::memcpy (line, shot->pixels.data() + (std::size_t) y * (std::size_t) shot->w * 4, (std::size_t) shot->w * 4);
+        for (int x = 0; x < shot->w; ++x)
+            line[x * 4 + 3] = 255;
+    }
+    return image;
+}
+
+// ---------------------------------------------------------------------------------------------------------------
+// The video export's GPU
+// ---------------------------------------------------------------------------------------------------------------
+GlFrameExporter::GlFrameExporter()
+{
+    setOpaque (true);
+    context.setRenderer (this);
+    context.setComponentPaintingEnabled (false);
+    context.setContinuousRepainting (false);
+    visualgl::viewStarted();
+    context.attachTo (*this);
+}
+
+GlFrameExporter::~GlFrameExporter()
+{
+    closing = true;
+    context.detach();
+    visualgl::viewStopped();
+}
+
+bool GlFrameExporter::waitReady (int ms)
+{
+    const auto until = juce::Time::getMillisecondCounterHiRes() + ms;
+    while (state.load() == 0 && juce::Time::getMillisecondCounterHiRes() < until)
+        juce::Thread::sleep (20);
+    return state.load() == 1;
+}
+
+void GlFrameExporter::reset()
+{
+    if (state.load() != 1)
+        return;
+    context.executeOnGLThread ([this] (juce::OpenGLContext&) { renderer.reset(); }, false);
+}
+
+bool GlFrameExporter::renderFrame (const vs::Scene& scene, const Frame& frame, int width, int height, std::uint8_t* bgra)
+{
+    if (state.load() != 1 || closing.load())
+        return false;
+    struct Job
+    {
+        std::mutex m;
+        std::condition_variable cv;
+        bool done = false, ok = false, abandoned = false;
+        vs::Scene scene;
+        Frame frame;
+        std::vector<std::uint8_t> pixels;
+    };
+    auto job = std::make_shared<Job>();
+    job->scene = scene;
+    job->frame = frame;
+    context.executeOnGLThread ([this, job, width, height] (juce::OpenGLContext&) {
+        {
+            const std::lock_guard<std::mutex> g (job->m);
+            if (job->abandoned)
+                return;
+        }
+        renderer.render (job->scene, job->frame, width, height);
+        std::vector<std::uint8_t> px ((std::size_t) width * (std::size_t) height * 4);
+        const auto ok = renderer.width() == width && renderer.height() == height && renderer.read (px.data());
+        const std::lock_guard<std::mutex> g (job->m);
+        job->ok = ok;
+        job->pixels = std::move (px);
+        job->done = true;
+        job->cv.notify_all();
+    }, false);
+    std::unique_lock<std::mutex> g (job->m);
+    if (! job->cv.wait_for (g, std::chrono::milliseconds (15000), [&] { return job->done; }))
+    {
+        job->abandoned = true;
+        error = "the GPU did not answer for 15 s";
+        return false;
+    }
+    if (! job->ok)
+    {
+        error = renderer.error().isNotEmpty() ? renderer.error() : juce::String ("the GPU could not draw the frame");
+        return false;
+    }
+    std::memcpy (bgra, job->pixels.data(), job->pixels.size());
+    return true;
+}
+
+void GlFrameExporter::newOpenGLContextCreated()
+{
+    context.setSwapInterval (0); // (the export runs as fast as the encoder takes the frames)
+    if (! renderer.create (context))
+    {
+        error = renderer.error();
+        state = -1;
+        return;
+    }
+    state = 1;
+}
+
+void GlFrameExporter::renderOpenGL()
+{
+    // the thumbnail: the last exported frame drawn small (JUCE runs a frame's job just before this)
+    const auto scale = context.getRenderingScale();
+    const auto tw = juce::roundToInt (getWidth() * scale), th = juce::roundToInt (getHeight() * scale);
+    if (tw <= 0 || th <= 0)
+        return;
+    glBindFramebuffer (GL_FRAMEBUFFER, context.getFrameBufferID());
+    glViewport (0, 0, tw, th);
+    glClearColor (0.0f, 0.0f, 0.0f, 1.0f);
+    glClear (GL_COLOR_BUFFER_BIT);
+    const auto fw = renderer.width(), fh = renderer.height();
+    if (fw <= 0 || fh <= 0)
+        return;
+    const auto aspect = (double) fw / (double) fh;
+    const auto area = ((double) tw / th > aspect ? juce::Rectangle<double> (0, 0, th * aspect, th) : juce::Rectangle<double> (0, 0, tw, tw / aspect))
+                          .withCentre ({ tw * 0.5, th * 0.5 })
+                          .toNearestInt();
+    renderer.present ({ area.getX(), th - area.getBottom(), area.getWidth(), area.getHeight() }, th);
+}
+
+void GlFrameExporter::openGLContextClosing()
+{
+    renderer.release();
+    if (state.load() == 1)
+        state = -1;
+}
+} // namespace lynx

+ 147 - 0
src/ui/VisualGl.h

@@ -0,0 +1,147 @@
+#pragma once
+
+// The Visualizer's GPU path (round 165e, docs/analise/REA_rodada165e.md): the scene drawn with OpenGL shaders — the
+// 2D layers through JUCE's OpenGL renderer, plus the shader layers ZGameEditor's categories inspired (Canvas, Terrain,
+// 3D objects, Feedback, Post-process) and per-layer blend modes. It runs on JUCE's OpenGL thread of its own component;
+// the audio analysis stays on the message thread (the tap is read there, as the 2D preview does) and is handed over
+// once per frame. Never on the audio thread.
+//
+// Care for the graphics driver (a GPU crash once took this machine down): frames are only drawn when the message
+// thread hands a new one over (30 a second in the editor, 60 in full screen, a third of that in silence; never
+// continuous), with vsync; the live picture is drawn at most 1280 x 720 inside; ray-marching loops have fixed small
+// step counts. A session note marks the GPU path as active, so a crash inside the driver turns it off at the next
+// start (Main.cpp). Without OpenGL (or after a failure) the editor uses the 2D renderer.
+
+#include <atomic>
+#include <functional>
+#include <memory>
+#include <mutex>
+
+#include <juce_opengl/juce_opengl.h>
+
+#include "core/VisualFx.h"
+
+namespace lynx
+{
+namespace visualgl
+{
+// the user's choice (Visualizer › GPU; saved in visualizer-gpu.txt, default on)
+bool enabled();
+void setEnabled (bool on);
+// a context could not be made or its shaders failed in this run: the 2D renderer from now on (until restart)
+bool failedThisSession();
+void markFailed (const juce::String& why);
+juce::String failureReason();
+// the session note Main.cpp reads after a crash ("visualizer GPU: start" without a "stop")
+constexpr const char* startNote = "visualizer GPU: start";
+constexpr const char* stopNote = "visualizer GPU: stop";
+// the window holding a GL child draws itself with GDI on Windows (as plugin windows do since round 157a: a Direct2D
+// parent is where an Intel OpenGL driver crashed)
+void useClassicRendering (juce::Component& topLevel);
+} // namespace visualgl
+
+// The GPU scene renderer. Every call on the OpenGL thread with the context current.
+class GlSceneRenderer
+{
+public:
+    GlSceneRenderer();
+    ~GlSceneRenderer();
+
+    bool create (juce::OpenGLContext& context); // false: unusable (error())
+    void release();
+    // moves the animated layers on to `frame` and draws the scene into the renderer's own w x h target
+    void render (const visualfx::scene::Scene& scene, const visualfx::Frame& frame, int width, int height);
+    // the last rendered picture into the current framebuffer's `viewport` (GL pixels, origin bottom-left)
+    void present (juce::Rectangle<int> viewport, int targetHeight);
+    // the last rendered picture as BGRA rows, top row first (w * h * 4 bytes)
+    bool read (std::uint8_t* bgra);
+    void reset(); // forget animation state (particles, trails, history)
+    int width() const noexcept;
+    int height() const noexcept;
+    const juce::String& error() const noexcept;
+    // GPU time of the last render (glFinish-timed) when timing is on (--visualtest)
+    void setTiming (bool on) noexcept;
+    double lastGpuMs() const noexcept;
+
+private:
+    struct Impl;
+    std::unique_ptr<Impl> impl;
+};
+
+// The live picture (editor preview and full screen). The message thread hands it frames; it draws them on the GL thread.
+class GlSceneView final : public juce::Component,
+                          private juce::OpenGLRenderer,
+                          private juce::Timer
+{
+public:
+    // `produce` (message thread, at `fps`): fills the frame and the scene to draw; returns false when nothing changed
+    // enough to draw (e.g. silence, a third of the rate)
+    using Producer = std::function<bool (visualfx::Frame&, visualfx::scene::Scene&)>;
+    GlSceneView (Producer produce, int fps, bool fullScreen = false);
+    ~GlSceneView() override;
+
+    std::function<void()> onDoubleClick;
+    std::function<void (const juce::String&)> onFailed; // message thread: the view cannot draw (use the 2D one)
+    std::function<void()> onClick;
+    void setOverlayText (const juce::String& text); // full screen: a hint drawn over the picture
+    void restart();                                  // forget animation state
+    bool isReady() const noexcept { return ready.load(); }
+    // the last picture (blocks up to 2 s; empty on failure) — --visualtest
+    juce::Image snapshot();
+    double gpuMs() const noexcept { return gpuMsLast.load(); }
+    void setTiming (bool on) noexcept { timing = on; }
+
+    void mouseDoubleClick (const juce::MouseEvent&) override;
+    void mouseDown (const juce::MouseEvent&) override;
+    void paint (juce::Graphics&) override;
+
+private:
+    void newOpenGLContextCreated() override;
+    void renderOpenGL() override;
+    void openGLContextClosing() override;
+    void timerCallback() override;
+    juce::Rectangle<int> frameArea (const visualfx::scene::Scene& s, juce::Rectangle<int> bounds) const;
+
+    juce::OpenGLContext context;
+    GlSceneRenderer renderer;
+    Producer produce;
+    bool full = false;
+    int fps = 30;
+
+    std::mutex lock; // message thread ↔ GL thread hand-over (never the audio thread)
+    visualfx::Frame pendingFrame;
+    visualfx::scene::Scene pendingScene, drawnScene;
+    bool havePending = false, resetPending = false;
+    juce::String overlay;
+    std::atomic<bool> ready { false }, failed { false }, timing { false };
+    std::atomic<double> gpuMsLast { 0.0 };
+    double attachedMs = 0.0;
+    std::unique_ptr<juce::LowLevelGraphicsContext> overlayContext;
+};
+
+// The video export's GPU: a small thumbnail of the frames being exported (in the export's progress window) whose
+// context draws each frame of the video off-screen at the export's size.
+class GlFrameExporter final : public juce::Component,
+                              private juce::OpenGLRenderer
+{
+public:
+    GlFrameExporter();
+    ~GlFrameExporter() override;
+    // any thread but the message thread: waits until the context works (false = no GPU: draw with the 2D renderer)
+    bool waitReady (int ms);
+    // any thread but the message thread: draws the next frame and reads it back (BGRA, top row first)
+    bool renderFrame (const visualfx::scene::Scene& scene, const visualfx::Frame& frame, int width, int height, std::uint8_t* bgra);
+    void reset();
+    juce::String error;
+
+private:
+    void newOpenGLContextCreated() override;
+    void renderOpenGL() override;
+    void openGLContextClosing() override;
+
+    juce::OpenGLContext context;
+    GlSceneRenderer renderer;
+    std::atomic<int> state { 0 }; // 0 waiting, 1 ready, −1 failed
+    std::atomic<bool> closing { false };
+};
+} // namespace lynx

+ 813 - 0
src/ui/VisualGlShaders.inc

@@ -0,0 +1,813 @@
+// The Visualizer's GLSL (round 165e). LYNX's own shaders, written for this renderer (no ZGameEditor / Shadertoy code):
+// GLSL 1.10-style (attribute / varying / gl_FragColor / texture2D), translated by JUCE when the context is v3.
+// Every fragment shader writes premultiplied colour. Loops have fixed small bounds (the GPU is never asked for more
+// than a few dozen steps a pixel).
+
+namespace lynx::glsl
+{
+constexpr const char* vertex = R"(
+attribute vec2 position;
+varying vec2 uv;
+void main()
+{
+    uv = position * 0.5 + 0.5;
+    gl_Position = vec4 (position, 0.0, 1.0);
+}
+)";
+
+// shared by every effect shader
+constexpr const char* common = R"(
+varying vec2 uv;
+uniform sampler2D uSrc;   // what the layers below drew (feedback, post-process)
+uniform sampler2D uPrev;  // feedback: this layer's previous output; blur passes: the blurred picture
+uniform sampler2D uSpec;  // 64 spectrum bands (0..1) in .r
+uniform sampler2D uHist;  // 64 bands x 128 frames of spectrum history in .r (rows wrap)
+uniform vec2 uRes;
+uniform float uTime;      // this layer's own clock (its Speed and the global Speed)
+uniform float uAbs;       // the song time in seconds
+uniform float uLevel, uBass, uMid, uHigh, uBeat;
+uniform float uBand;      // the band the layer reacts to
+uniform float uReact, uSpeed, uAmount, uSize, uCount, uOpacity;
+uniform float uHistRow;   // the newest row of uHist (0..127)
+uniform vec2 uPos;
+uniform vec4 uColA, uColB;
+uniform vec2 uDir;        // blur passes: the step
+
+float aspect() { return uRes.x / max (uRes.y, 1.0); }
+float drive() { return clamp (uBand * uReact, 0.0, 1.5); }
+vec2 centred() { return (uv - uPos) * vec2 (aspect(), 1.0); }
+mat2 rot (float a) { float c = cos (a), s = sin (a); return mat2 (c, -s, s, c); }
+float hash (vec2 p)
+{
+    p = fract (p * vec2 (123.34, 456.21));
+    p += dot (p, p + 45.32);
+    return fract (p.x * p.y);
+}
+vec2 hash2 (vec2 p) { return vec2 (hash (p), hash (p + 17.17)); }
+float noise (vec2 p)
+{
+    vec2 i = floor (p), f = fract (p);
+    vec2 u = f * f * (3.0 - 2.0 * f);
+    return mix (mix (hash (i), hash (i + vec2 (1.0, 0.0)), u.x), mix (hash (i + vec2 (0.0, 1.0)), hash (i + vec2 (1.0, 1.0)), u.x), u.y);
+}
+float fbm (vec2 p)
+{
+    float v = 0.0, a = 0.5;
+    for (int i = 0; i < 5; i++)
+    {
+        v += a * noise (p);
+        p = rot (0.5) * p * 2.03 + 3.1;
+        a *= 0.5;
+    }
+    return v;
+}
+float spec (float x) { return texture2D (uSpec, vec2 (clamp (x, 0.0, 1.0) * (63.0 / 64.0) + 0.5 / 64.0, 0.5)).r; }
+// age 0 = newest frame, 1 = 127 frames ago
+float hist (float x, float age)
+{
+    float row = uHistRow - clamp (age, 0.0, 1.0) * 126.0;
+    return texture2D (uHist, vec2 (clamp (x, 0.0, 1.0) * (63.0 / 64.0) + 0.5 / 64.0, (row + 0.5) / 128.0)).r;
+}
+vec3 pal (float t) { return mix (uColA.rgb, uColB.rgb, clamp (t, 0.0, 1.0)); }
+vec4 premul (vec3 c, float a) { a = clamp (a, 0.0, 1.0) * uOpacity; return vec4 (c * a, a); }
+float luma (vec3 c) { return dot (c, vec3 (0.299, 0.587, 0.114)); }
+)";
+
+// ---------------------------------------------------------------------------------------------------------------
+// Canvas: full-frame pictures
+// ---------------------------------------------------------------------------------------------------------------
+constexpr const char* canvasPlasma = R"(
+void main()
+{
+    vec2 p = centred() * (2.0 + (1.0 - uSize) * 8.0);
+    float t = uTime;
+    float waves = 2.0 + floor (clamp (uCount / 16.0, 0.0, 4.0));
+    float v = sin (p.x + t) + sin ((p.y + t) * 0.5) + sin ((p.x + p.y + t) * 0.5);
+    vec2 c = p + vec2 (sin (t * 0.33) * 3.0, cos (t * 0.5) * 3.0);
+    v += sin (sqrt (dot (c, c) + 1.0) + t);
+    if (waves > 2.5) v += sin (length (p - vec2 (cos (t * 0.21), sin (t * 0.17)) * 4.0) * 1.3 - t);
+    if (waves > 3.5) v += 0.5 * sin (p.x * 2.1 - p.y * 1.3 + t * 1.7);
+    float k = 0.5 + 0.5 * sin (v * (1.0 + uAmount * 3.0) + drive() * 3.0);
+    vec3 col = pal (k) * (0.65 + 0.7 * drive());
+    gl_FragColor = premul (col, 1.0);
+}
+)";
+
+constexpr const char* canvasTunnel = R"(
+void main()
+{
+    vec2 p = centred() * 2.0;
+    float r = length (p), a = atan (p.y, p.x);
+    float z = (0.3 + uSize) / max (r, 0.03) + uTime * 2.0;
+    float tw = a / 3.14159 + uAmount * z * 0.05;
+    float check = mod (floor (z) + floor (tw * 8.0), 2.0);
+    float edge = smoothstep (0.0, 0.08, abs (fract (z) - 0.5)) * smoothstep (0.0, 0.08, abs (fract (tw * 8.0) - 0.5));
+    vec3 col = mix (uColA.rgb, uColB.rgb, check) * (0.35 + 0.65 * edge);
+    float ring = exp (-abs (fract (z * 0.25 - uAbs * 0.0) - 0.5) * 12.0) * drive();
+    col += uColB.rgb * ring;
+    col *= clamp (r * 1.6, 0.0, 1.0) * (0.7 + 0.6 * drive());
+    gl_FragColor = premul (col, 1.0);
+}
+)";
+
+constexpr const char* canvasCells = R"(
+void main()
+{
+    vec2 p = centred() * (3.0 + (1.0 - uSize) * 10.0);
+    vec2 i = floor (p), f = fract (p);
+    float d1 = 8.0, d2 = 8.0;
+    float idHash = 0.0;
+    for (int y = -1; y <= 1; y++)
+        for (int x = -1; x <= 1; x++)
+        {
+            vec2 g = vec2 (float (x), float (y));
+            vec2 o = hash2 (i + g);
+            o = 0.5 + 0.45 * sin (uTime + 6.2831 * o);
+            vec2 r = g + o - f;
+            float d = dot (r, r);
+            if (d < d1) { d2 = d1; d1 = d; idHash = hash (i + g); }
+            else if (d < d2) d2 = d;
+        }
+    float edge = sqrt (d2) - sqrt (d1);
+    float border = 1.0 - smoothstep (0.0, 0.04 + uAmount * 0.12, edge);
+    float lit = spec (idHash);
+    vec3 col = pal (idHash) * (0.25 + 0.75 * sqrt (d1)) * (0.4 + lit * uReact * 1.4);
+    col += uColB.rgb * border * (0.6 + drive() * 1.5);
+    gl_FragColor = premul (col, 1.0);
+}
+)";
+
+constexpr const char* canvasKaleido = R"(
+void main()
+{
+    vec2 p = centred() * (0.6 + (1.0 - uSize) * 2.0);
+    p = rot (uTime * 0.2) * p;
+    float folds = 3.0 + floor (uAmount * 9.0);
+    float seg = 6.28318 / folds;
+    float a = mod (atan (p.y, p.x), seg);
+    a = abs (a - seg * 0.5);
+    p = length (p) * vec2 (cos (a), sin (a));
+    float iters = clamp (uCount / 8.0, 3.0, 8.0);
+    float acc = 0.0;
+    float k = 0.78 + 0.12 * sin (uTime * 0.3) + 0.08 * drive();
+    for (int i = 0; i < 8; i++)
+    {
+        if (float (i) >= iters) break;
+        p = abs (p) / max (dot (p, p), 0.02) - k;
+        acc += exp (-length (p) * 2.5);
+    }
+    vec3 col = pal (fract (acc * 0.35 + uTime * 0.05)) * acc * (0.45 + 0.5 * drive());
+    gl_FragColor = premul (col, 1.0);
+}
+)";
+
+constexpr const char* canvasClouds = R"(
+void main()
+{
+    vec2 p = centred() * (1.0 + (1.0 - uSize) * 4.0);
+    float q = fbm (p * 1.5 - vec2 (0.0, uTime * 0.1));
+    float n = fbm (p + vec2 (uTime * 0.3, 0.0) + q * 1.5);
+    float d = smoothstep (0.25, 0.9, n * (0.6 + uAmount * 0.8) + drive() * 0.3);
+    vec3 col = pal (n) * (0.5 + d) * (0.8 + drive() * 0.6);
+    gl_FragColor = premul (col, d);
+}
+)";
+
+constexpr const char* canvasWarp = R"(
+void main()
+{
+    vec2 p = centred();
+    float a = atan (p.y, p.x) / 6.28318 + 0.5;
+    float r = length (p);
+    float n = 40.0 + uCount * 2.0;
+    float c = 0.0;
+    for (int k = 0; k < 3; k++)
+    {
+        float fk = float (k);
+        float cell = floor (a * n + fk * 0.33);
+        float h = hash (vec2 (cell, fk));
+        float z = fract (h * 13.7 + uTime * (0.25 + h * 0.5));
+        float sr = z * z * 1.6;
+        float len = 0.01 + uAmount * 0.3 * z * (1.0 + drive());
+        float da = abs (fract (a * n + fk * 0.33) - 0.5) / n * 6.28318 * r;
+        float dr = r - sr;
+        c += smoothstep (len, 0.0, abs (dr + len * 0.5)) * smoothstep (0.002 + uSize * 0.012, 0.0, da) * (0.3 + z);
+    }
+    vec3 col = pal (clamp (r, 0.0, 1.0)) * c * (1.0 + drive());
+    gl_FragColor = premul (col, clamp (c, 0.0, 1.0));
+}
+)";
+
+constexpr const char* canvasElectric = R"(
+void main()
+{
+    vec2 p = centred();
+    float bolts = clamp (floor (uCount / 12.0) + 1.0, 1.0, 6.0);
+    float c = 0.0;
+    for (int i = 0; i < 6; i++)
+    {
+        float fi = float (i);
+        if (fi >= bolts) break;
+        float y = (fbm (vec2 (p.x * 3.0 + fi * 10.0, uTime * 2.0 + fi * 3.0)) - 0.5) * (0.3 + uAmount * 0.9)
+                + (fi - (bolts - 1.0) * 0.5) * 0.06;
+        float d = abs (p.y - y);
+        c += (0.0015 + uSize * 0.006) / max (d, 0.0008) * (0.4 + drive());
+    }
+    vec3 col = mix (uColB.rgb, uColA.rgb, clamp (c * 0.15, 0.0, 1.0)) * clamp (c * 0.3, 0.0, 3.0);
+    col += vec3 (1.0) * clamp (c * 0.05 - 0.2, 0.0, 1.0);
+    gl_FragColor = premul (col, clamp (c * 0.3, 0.0, 1.0));
+}
+)";
+
+constexpr const char* canvasRays = R"(
+void main()
+{
+    vec2 p = centred();
+    float r = length (p), a = atan (p.y, p.x);
+    float n = floor (4.0 + uCount / 4.0);
+    float rays = pow (0.5 + 0.5 * sin (a * n + uTime), 3.0 - uAmount * 2.0);
+    float radius = uSize * 0.5 * (1.0 + drive() * 0.25);
+    float sun = smoothstep (radius, radius - 0.01, r);
+    float glow = exp (-max (r - radius, 0.0) * 4.0);
+    vec3 col = uColA.rgb * sun + uColB.rgb * rays * glow * (0.4 + drive()) + uColA.rgb * glow * 0.3;
+    gl_FragColor = premul (col, clamp (sun + rays * glow + glow * 0.3, 0.0, 1.0));
+}
+)";
+
+// ---------------------------------------------------------------------------------------------------------------
+// Terrain: a landscape of the spectrum's history (rows newest in front)
+// ---------------------------------------------------------------------------------------------------------------
+constexpr const char* terrainCommon = R"(
+float heightAt (vec2 xz)
+{
+    float band = abs (xz.x) / 1.6;            // the lows in the middle
+    float age = (xz.y - 0.15) / 3.2;
+    if (age < 0.0 || band > 1.0) return 0.0;
+    float v = hist (band, age);
+    return pow (v, 1.6 - uReact * 1.1) * (0.08 + uSize * 0.45);
+}
+vec3 sky (vec2 p)
+{
+    return mix (uColB.rgb * 0.25, vec3 (0.0), clamp (p.y * 1.5, 0.0, 1.0)) + uColB.rgb * exp (-abs (p.y) * 18.0) * 0.6;
+}
+)";
+
+constexpr const char* terrainMountains = R"(
+void main()
+{
+    vec2 p = (uv - vec2 (0.5, 0.5)) * vec2 (aspect(), 1.0);
+    vec3 ro = vec3 (0.0, 0.32 + uSize * 0.25, 0.0);
+    vec3 rd = normalize (vec3 (p.x, p.y - 0.18 + (0.5 - uPos.y) * 0.6, 1.1));
+    float t = 0.05, hit = -1.0;
+    for (int i = 0; i < 90; i++)
+    {
+        vec3 q = ro + rd * t;
+        if (q.y < heightAt (q.xz)) { hit = t; break; }
+        t += 0.02 + t * 0.018;
+        if (t > 4.0) break;
+    }
+    if (hit < 0.0) { gl_FragColor = premul (sky (p), 0.0); return; }
+    float lo = hit - (0.02 + hit * 0.018), hi = hit;
+    for (int i = 0; i < 5; i++)
+    {
+        float m = (lo + hi) * 0.5;
+        vec3 q = ro + rd * m;
+        if (q.y < heightAt (q.xz)) hi = m; else lo = m;
+    }
+    vec3 q = ro + rd * hi;
+    float rows = 20.0 + uCount * 0.5;
+    float gx = abs (fract (q.x * 12.0) - 0.5) / max (fwidth (q.x * 12.0), 0.0001);
+    float gz = abs (fract (q.z / 3.2 * rows) - 0.5) / max (fwidth (q.z / 3.2 * rows), 0.0001);
+    float line = 1.0 - clamp (min (gx, gz * 0.7) - 0.5, 0.0, 1.0);
+    float h = q.y / (0.08 + uSize * 0.45);
+    float fog = exp (-hi * 0.55);
+    vec3 col = mix (uColA.rgb * 0.08, mix (uColA.rgb, uColB.rgb, clamp (h, 0.0, 1.0)) * (1.2 + uAmount * 2.0), line) * fog;
+    gl_FragColor = premul (col, 1.0);
+}
+)";
+
+constexpr const char* terrainHills = R"(
+float hillsAt (vec2 xz)
+{
+    return heightAt (xz) * 0.7 + fbm (xz * 1.3 + vec2 (0.0, uTime * 0.5)) * (0.06 + uSize * 0.2);
+}
+void main()
+{
+    vec2 p = (uv - vec2 (0.5, 0.5)) * vec2 (aspect(), 1.0);
+    vec3 ro = vec3 (0.0, 0.35 + uSize * 0.2, 0.0);
+    vec3 rd = normalize (vec3 (p.x, p.y - 0.15 + (0.5 - uPos.y) * 0.6, 1.0));
+    float t = 0.05, hit = -1.0;
+    for (int i = 0; i < 80; i++)
+    {
+        vec3 q = ro + rd * t;
+        if (q.y < hillsAt (q.xz)) { hit = t; break; }
+        t += 0.025 + t * 0.02;
+        if (t > 4.0) break;
+    }
+    if (hit < 0.0) { gl_FragColor = premul (sky (p) + uColB.rgb * 0.15, 1.0); return; }
+    vec3 q = ro + rd * hit;
+    float e = 0.01;
+    vec3 n = normalize (vec3 (hillsAt (q.xz - vec2 (e, 0.0)) - hillsAt (q.xz + vec2 (e, 0.0)), 2.0 * e,
+                              hillsAt (q.xz - vec2 (0.0, e)) - hillsAt (q.xz + vec2 (0.0, e))));
+    vec3 light = normalize (vec3 (-0.4, 0.7, -0.5));
+    float dif = clamp (dot (n, light), 0.0, 1.0);
+    vec3 col = mix (uColA.rgb * 0.15, uColA.rgb, dif) + uColB.rgb * pow (1.0 - clamp (n.y, 0.0, 1.0), 2.0) * 0.4;
+    float fog = 1.0 - exp (-hit * (0.3 + uAmount * 1.2));
+    col = mix (col, uColB.rgb * 0.35, fog);
+    gl_FragColor = premul (col * (0.8 + drive() * 0.4), 1.0);
+}
+)";
+
+constexpr const char* terrainRoad = R"(
+void main()
+{
+    vec2 p = (uv - vec2 (0.5, 0.5)) * vec2 (aspect(), 1.0);
+    float horizon = (uPos.y - 0.5) * -0.6 + 0.02;
+    vec3 col = vec3 (0.0);
+    float alpha = 1.0;
+    if (p.y > horizon)
+    {
+        // the sky, the sun with its stripes, the spectrum's mountains on the horizon
+        float y = p.y - horizon;
+        col = mix (uColB.rgb * 0.45, vec3 (0.02, 0.0, 0.05), clamp (y * 2.2, 0.0, 1.0));
+        vec2 c = vec2 (0.0, horizon + 0.18);
+        float radius = 0.1 + uSize * 0.25 * (1.0 + drive() * 0.15);
+        float d = length (p - c);
+        float stripes = step (0.5, fract ((p.y - c.y) * 22.0 + uTime * 0.6)) + step (c.y + radius * 0.15, p.y);
+        float sun = smoothstep (radius, radius - 0.006, d) * clamp (stripes, 0.0, 1.0);
+        col = mix (col, mix (uColA.rgb, vec3 (1.0, 0.85, 0.3), clamp ((p.y - c.y) / radius * 0.5 + 0.5, 0.0, 1.0)), sun);
+        col += uColA.rgb * exp (-max (d - radius, 0.0) * 9.0) * 0.35;
+        float m = spec (clamp (abs (p.x) / (aspect() * 0.5), 0.0, 1.0)) * (0.05 + uSize * 0.12) * (0.6 + uReact);
+        if (y < m) col = mix (vec3 (0.02, 0.0, 0.04), uColB.rgb, smoothstep (m - 0.004, m, y));
+    }
+    else
+    {
+        float y = horizon - p.y;
+        float z = 0.25 / max (y, 0.001);
+        float x = p.x * z;
+        float gz = abs (fract (z * 0.5 + uTime * 0.8) - 0.5) / max (fwidth (z * 0.5), 0.0001);
+        float gx = abs (fract (x * 2.0) - 0.5) / max (fwidth (x * 2.0), 0.0001);
+        float line = 1.0 - clamp (min (gx, gz) - 0.6, 0.0, 1.0);
+        float fade = clamp (y * 6.0, 0.0, 1.0);
+        col = vec3 (0.02, 0.0, 0.05) + uColA.rgb * line * (0.6 + uAmount * 1.5) * fade * (0.7 + drive() * 0.6);
+        col += uColA.rgb * exp (-y * 40.0) * 0.5;
+    }
+    gl_FragColor = premul (col, alpha);
+}
+)";
+
+// ---------------------------------------------------------------------------------------------------------------
+// 3D objects: ray-marched shapes over transparent space
+// ---------------------------------------------------------------------------------------------------------------
+constexpr const char* objectCommon = R"(
+float sceneSdf (vec3 p);
+vec3 normalAt (vec3 p)
+{
+    vec2 e = vec2 (0.002, -0.002);
+    return normalize (e.xyy * sceneSdf (p + e.xyy) + e.yyx * sceneSdf (p + e.yyx) + e.yxy * sceneSdf (p + e.yxy) + e.xxx * sceneSdf (p + e.xxx));
+}
+vec4 shade (vec3 ro, vec3 rd, float stepScale, float far)
+{
+    float t = 0.0;
+    for (int i = 0; i < 72; i++)
+    {
+        vec3 p = ro + rd * t;
+        float d = sceneSdf (p);
+        if (d < 0.0015)
+        {
+            vec3 n = normalAt (p);
+            vec3 l = normalize (vec3 (0.6, 0.8, -0.6));
+            float dif = clamp (dot (n, l), 0.0, 1.0);
+            float spe = pow (clamp (dot (reflect (rd, n), l), 0.0, 1.0), 24.0);
+            float rim = pow (1.0 - clamp (dot (n, -rd), 0.0, 1.0), 3.0);
+            vec3 col = uColA.rgb * (0.15 + 0.85 * dif) + vec3 (spe) * 0.6 + uColB.rgb * rim * (0.8 + drive());
+            col *= exp (-t * 0.05);
+            return vec4 (col, 1.0);
+        }
+        t += d * stepScale;
+        if (t > far) break;
+    }
+    return vec4 (0.0);
+}
+float sdTorus (vec3 p, vec2 t) { vec2 q = vec2 (length (p.xz) - t.x, p.y); return length (q) - t.y; }
+float sdBox (vec3 p, vec3 b) { vec3 q = abs (p) - b; return length (max (q, 0.0)) + min (max (q.x, max (q.y, q.z)), 0.0); }
+vec3 spin (vec3 p)
+{
+    p.xz = rot (uTime * 0.7) * p.xz;
+    p.xy = rot (uTime * 0.43) * p.xy;
+    return p;
+}
+)";
+
+constexpr const char* objectBlob = R"(
+float sceneSdf (vec3 p)
+{
+    p -= vec3 ((uPos.x - 0.5) * 3.0, (0.5 - uPos.y) * 2.0, 0.0);
+    p = spin (p);
+    float r = 0.5 + uSize * 0.9;
+    float k = 3.0 + uCount * 0.05;
+    float disp = sin (k * p.x + uTime * 1.3) * sin (k * p.y + uTime) * sin (k * p.z - uTime * 0.7);
+    disp *= 0.08 + uAmount * 0.25 * (0.5 + uBass * uReact * 2.0);
+    return (length (p) - r * (1.0 + uBeat * uReact * 0.08)) * 0.6 + disp * 0.6;
+}
+void main()
+{
+    vec2 p = (uv - 0.5) * vec2 (aspect(), 1.0);
+    vec4 c = shade (vec3 (0.0, 0.0, -4.0), normalize (vec3 (p, 1.4)), 0.8, 9.0);
+    gl_FragColor = premul (c.rgb, c.a);
+}
+)";
+
+constexpr const char* objectTorus = R"(
+float sceneSdf (vec3 p)
+{
+    p -= vec3 ((uPos.x - 0.5) * 3.0, (0.5 - uPos.y) * 2.0, 0.0);
+    p = spin (p);
+    float r = 0.6 + uSize * 1.0;
+    float d = sdTorus (p, vec2 (r * (1.0 + uBeat * uReact * 0.08), 0.08 + uAmount * 0.4));
+    d += sin (atan (p.z, p.x) * floor (3.0 + uCount * 0.1) + uTime * 2.0) * 0.03 * drive();
+    return d * 0.8;
+}
+void main()
+{
+    vec2 p = (uv - 0.5) * vec2 (aspect(), 1.0);
+    vec4 c = shade (vec3 (0.0, 0.0, -4.0), normalize (vec3 (p, 1.4)), 0.9, 9.0);
+    gl_FragColor = premul (c.rgb, c.a);
+}
+)";
+
+constexpr const char* objectCubes = R"(
+float cellH (vec2 id, float n)
+{
+    float band = clamp (abs (id.x) / n, 0.0, 1.0);
+    float age = clamp ((id.y + n) / (2.0 * n), 0.0, 1.0);
+    float v = hist (band, age * 0.5);
+    return 0.05 + pow (v, 1.6 - uReact * 1.1) * (0.3 + uSize * 1.4);
+}
+float sceneSdf (vec3 p)
+{
+    float n = clamp (floor (uCount / 6.0), 2.0, 12.0);
+    float c = 0.22 + uAmount * 0.2;
+    vec2 id = clamp (floor (p.xz / c + 0.5), vec2 (-n), vec2 (n));
+    vec2 q = p.xz - id * c;
+    float h = cellH (id, n);
+    return sdBox (vec3 (q.x, p.y - h * 0.5, q.y), vec3 (c * 0.38, h * 0.5, c * 0.38)) - 0.01;
+}
+void main()
+{
+    vec2 p = (uv - 0.5) * vec2 (aspect(), 1.0);
+    vec3 ro = vec3 (0.0, 2.2, -3.4);
+    ro.xz = rot (uTime * 0.25) * ro.xz;
+    vec3 fw = normalize (-ro + vec3 (0.0, 0.3, 0.0));
+    vec3 rt = normalize (cross (vec3 (0.0, 1.0, 0.0), fw));
+    vec3 up = cross (fw, rt);
+    vec3 rd = normalize (p.x * rt + p.y * up + 1.5 * fw);
+    vec4 c = shade (ro, rd, 0.5, 12.0);
+    gl_FragColor = premul (c.rgb, c.a);
+}
+)";
+
+constexpr const char* objectRings = R"(
+float sceneSdf (vec3 p)
+{
+    float spacing = 1.2;
+    float z = p.z + uTime * 2.0;
+    float id = floor (z / spacing);
+    vec3 q = vec3 (p.x, p.y, mod (z, spacing) - spacing * 0.5);
+    q.xy = rot (id * 0.4 + uTime * 0.2) * q.xy;
+    float r = 0.9 + uSize * 1.2 + spec (fract (id * 0.137)) * uReact * 0.5;
+    return sdTorus (q.xzy, vec2 (r, 0.03 + uAmount * 0.15));
+}
+void main()
+{
+    vec2 p = (uv - uPos) * vec2 (aspect(), 1.0);
+    vec4 c = shade (vec3 (0.0, 0.0, 0.0), normalize (vec3 (p, 1.0)), 0.9, 14.0);
+    gl_FragColor = premul (c.rgb, c.a);
+}
+)";
+
+// ---------------------------------------------------------------------------------------------------------------
+// Feedback: this layer's previous output moved, faded and kept under the new picture (uSrc), max-blended
+// ---------------------------------------------------------------------------------------------------------------
+constexpr const char* feedbackMain = R"(
+vec2 warpUv (vec2 q);
+void main()
+{
+    vec4 src = texture2D (uSrc, uv);
+    vec2 q = warpUv (uv);
+    float fade = 0.75 + uAmount * 0.235;
+    vec4 prev = (q.x < 0.0 || q.y < 0.0 || q.x > 1.0 || q.y > 1.0) ? vec4 (0.0) : texture2D (uPrev, q) * fade;
+    vec4 outc = max (src, prev);
+    gl_FragColor = mix (src, outc, uOpacity);
+}
+)";
+
+constexpr const char* feedbackZoom = R"(
+vec2 warpUv (vec2 q)
+{
+    float z = 1.0 + (0.004 + uSize * 0.04) * (1.0 + drive());
+    return (q - uPos) / z + uPos;
+}
+)";
+
+constexpr const char* feedbackSpin = R"(
+vec2 warpUv (vec2 q)
+{
+    float z = 1.0 + (0.003 + uSize * 0.03) * (1.0 + drive());
+    vec2 d = (q - uPos) * vec2 (aspect(), 1.0);
+    d = rot ((uSpeed - 0.5) * 0.08) * d / z;
+    return d / vec2 (aspect(), 1.0) + uPos;
+}
+)";
+
+constexpr const char* feedbackKaleido = R"(
+vec2 warpUv (vec2 q)
+{
+    float z = 1.0 + (0.003 + uSize * 0.03) * (1.0 + drive());
+    vec2 d = (q - uPos) * vec2 (aspect(), 1.0) / z;
+    float n = clamp (floor (uCount / 8.0) + 2.0, 2.0, 12.0);
+    float seg = 6.28318 / n;
+    float a = mod (atan (d.y, d.x) + uTime * 0.1, seg);
+    a = abs (a - seg * 0.5);
+    d = length (d) * vec2 (cos (a), sin (a));
+    return d / vec2 (aspect(), 1.0) + uPos;
+}
+)";
+
+constexpr const char* feedbackWarp = R"(
+vec2 warpUv (vec2 q)
+{
+    vec2 k = q * (2.0 + uSize * 8.0);
+    vec2 o = vec2 (noise (k + uTime), noise (k - uTime + 7.0)) - 0.5;
+    return q + o * 0.012 * (1.0 + drive() * 2.0);
+}
+)";
+
+constexpr const char* feedbackEcho = R"(
+vec2 warpUv (vec2 q) { return q; }
+)";
+
+constexpr const char* feedbackDrift = R"(
+vec2 warpUv (vec2 q)
+{
+    float side = (noise (vec2 (q.y * 6.0, uTime)) - 0.5) * 0.004 * (1.0 + uSize * 4.0);
+    return q - vec2 (side, 0.002 + uSpeed * 0.01 + drive() * 0.004);
+}
+)";
+
+// ---------------------------------------------------------------------------------------------------------------
+// Post-process: an effect on what the layers below drew
+// ---------------------------------------------------------------------------------------------------------------
+constexpr const char* postRgbShift = R"(
+void main()
+{
+    vec2 d = uv - uPos;
+    float len = length (d);
+    vec2 dir = len > 0.0001 ? d / len : vec2 (1.0, 0.0);
+    vec2 off = dir * (0.002 + uAmount * 0.02) * (1.0 + drive() * 3.0);
+    vec4 src = texture2D (uSrc, uv);
+    vec4 c = vec4 (texture2D (uSrc, uv + off).r, src.g, texture2D (uSrc, uv - off).b, 1.0);
+    gl_FragColor = mix (src, c, uOpacity);
+}
+)";
+
+constexpr const char* postPixelate = R"(
+void main()
+{
+    float cell = (2.0 + uSize * 48.0) * (1.0 + drive() * 0.5);
+    vec2 q = (floor (uv * uRes / cell) + 0.5) * cell / uRes;
+    gl_FragColor = mix (texture2D (uSrc, uv), texture2D (uSrc, q), uOpacity);
+}
+)";
+
+constexpr const char* postDots = R"(
+void main()
+{
+    float cell = 4.0 + uSize * 26.0;
+    vec2 g = uv * uRes / cell;
+    vec2 q = (floor (g) + 0.5) * cell / uRes;
+    vec4 c = texture2D (uSrc, q);
+    float r = sqrt (clamp (luma (c.rgb) * (1.0 + drive()), 0.0, 1.0)) * 0.55;
+    float d = length (fract (g) - 0.5);
+    float soft = 0.02 + (1.0 - uAmount) * 0.25;
+    vec4 dots = vec4 (c.rgb * smoothstep (r, r - soft, d), 1.0);
+    gl_FragColor = mix (texture2D (uSrc, uv), dots, uOpacity);
+}
+)";
+
+constexpr const char* postScanlines = R"(
+void main()
+{
+    vec4 src = texture2D (uSrc, uv);
+    float line = 0.5 + 0.5 * sin ((uv.y * uRes.y / (2.0 + uSize * 8.0) + uTime * 6.0) * 3.14159);
+    vec3 c = src.rgb * (1.0 - uAmount * 0.8 * (1.0 - line));
+    vec2 d = uv - 0.5;
+    c *= 1.0 - dot (d, d) * 0.6;
+    gl_FragColor = mix (src, vec4 (c, 1.0), uOpacity);
+}
+)";
+
+constexpr const char* postVignette = R"(
+void main()
+{
+    vec4 src = texture2D (uSrc, uv);
+    float d = length ((uv - uPos) * vec2 (aspect(), 1.0));
+    float r = 0.3 + uSize * 0.9;
+    float v = smoothstep (r, r - 0.5, d);
+    gl_FragColor = mix (src, vec4 (src.rgb * mix (1.0, v, uAmount), 1.0), uOpacity);
+}
+)";
+
+constexpr const char* postColor = R"(
+vec3 hueRotate (vec3 c, float a)
+{
+    const vec3 k = vec3 (0.57735);
+    float ca = cos (a);
+    return c * ca + cross (k, c) * sin (a) + k * dot (k, c) * (1.0 - ca);
+}
+void main()
+{
+    vec4 src = texture2D (uSrc, uv);
+    vec3 c = hueRotate (src.rgb, uTime * uSpeed * 0.5);
+    float l = luma (c);
+    c = mix (vec3 (l), c, uSize * 2.0);
+    c = (c - 0.5) * (0.5 + uAmount * 1.5) + 0.5;
+    c *= uColA.rgb;
+    c *= 1.0 + drive() * 0.3;
+    gl_FragColor = mix (src, vec4 (clamp (c, 0.0, 1.0), 1.0), uOpacity);
+}
+)";
+
+constexpr const char* postKaleido = R"(
+void main()
+{
+    vec2 d = (uv - uPos) * vec2 (aspect(), 1.0);
+    float n = clamp (floor (uCount / 8.0) + 2.0, 2.0, 16.0);
+    float seg = 6.28318 / n;
+    float a = mod (atan (d.y, d.x) + uTime * 0.2, seg);
+    a = abs (a - seg * 0.5);
+    vec2 q = length (d) * vec2 (cos (a), sin (a)) / vec2 (aspect(), 1.0) + uPos;
+    q = abs (q);
+    q = 1.0 - abs (1.0 - q);
+    gl_FragColor = mix (texture2D (uSrc, uv), texture2D (uSrc, q), uOpacity);
+}
+)";
+
+constexpr const char* postMirror = R"(
+void main()
+{
+    vec2 q = uv;
+    float m = mod (max (uCount, 1.0) - 1.0, 3.0);
+    if (m != 1.0) q.x = 0.5 - abs (q.x - 0.5);
+    if (m != 0.0) q.y = 0.5 - abs (q.y - 0.5);
+    gl_FragColor = mix (texture2D (uSrc, uv), texture2D (uSrc, q), uOpacity);
+}
+)";
+
+constexpr const char* postEdges = R"(
+void main()
+{
+    vec2 px = 1.0 / uRes;
+    float tl = luma (texture2D (uSrc, uv + px * vec2 (-1.0, 1.0)).rgb), t = luma (texture2D (uSrc, uv + px * vec2 (0.0, 1.0)).rgb);
+    float tr = luma (texture2D (uSrc, uv + px * vec2 (1.0, 1.0)).rgb), l = luma (texture2D (uSrc, uv + px * vec2 (-1.0, 0.0)).rgb);
+    float r = luma (texture2D (uSrc, uv + px * vec2 (1.0, 0.0)).rgb), bl = luma (texture2D (uSrc, uv + px * vec2 (-1.0, -1.0)).rgb);
+    float b = luma (texture2D (uSrc, uv + px * vec2 (0.0, -1.0)).rgb), br = luma (texture2D (uSrc, uv + px * vec2 (1.0, -1.0)).rgb);
+    float gx = -tl - 2.0 * l - bl + tr + 2.0 * r + br;
+    float gy = -tl - 2.0 * t - tr + bl + 2.0 * b + br;
+    float e = clamp (sqrt (gx * gx + gy * gy) * (1.0 + uAmount * 3.0), 0.0, 1.0);
+    vec4 src = texture2D (uSrc, uv);
+    vec3 c = src.rgb * (1.0 - uAmount * 0.85) + uColA.rgb * e * (1.0 + drive());
+    gl_FragColor = mix (src, vec4 (c, 1.0), uOpacity);
+}
+)";
+
+constexpr const char* postShake = R"(
+void main()
+{
+    float k = floor (uAbs * 30.0);
+    vec2 o = (vec2 (hash (vec2 (k, 1.0)), hash (vec2 (k, 2.0))) - 0.5) * uAmount * 0.08 * clamp (uBand * uReact * 1.5, 0.0, 1.0);
+    vec2 q = clamp (uv + o, vec2 (0.0), vec2 (1.0));
+    gl_FragColor = mix (texture2D (uSrc, uv), texture2D (uSrc, q), uOpacity);
+}
+)";
+
+constexpr const char* postGlitch = R"(
+void main()
+{
+    float k = floor (uAbs * 15.0);
+    float block = floor (uv.y * (12.0 + uSize * 30.0));
+    float trig = step (1.0 - uAmount * 0.5 - drive() * 0.4, hash (vec2 (block, k)));
+    vec2 q = uv + vec2 ((hash (vec2 (block, k + 3.0)) - 0.5) * 0.2 * trig, 0.0);
+    vec4 c = vec4 (texture2D (uSrc, q + vec2 (0.006 * trig, 0.0)).r, texture2D (uSrc, q).g, texture2D (uSrc, q - vec2 (0.006 * trig, 0.0)).b, 1.0);
+    gl_FragColor = mix (texture2D (uSrc, uv), c, uOpacity);
+}
+)";
+
+constexpr const char* postGrain = R"(
+void main()
+{
+    vec4 src = texture2D (uSrc, uv);
+    float n = hash (uv * uRes + fract (uAbs * 7.13) * 100.0) - 0.5;
+    gl_FragColor = mix (src, vec4 (src.rgb + n * uAmount * 0.35, 1.0), uOpacity);
+}
+)";
+
+constexpr const char* postInvert = R"(
+void main()
+{
+    vec4 src = texture2D (uSrc, uv);
+    float k = clamp (uBand * uReact * 1.2, 0.0, 1.0);
+    gl_FragColor = mix (src, vec4 (mix (src.rgb, 1.0 - src.rgb, k), 1.0), uOpacity);
+}
+)";
+
+// blur / bloom: the picture made smaller (bloom: only what is bright), blurred in two passes, then mixed back
+constexpr const char* postDown = R"(
+uniform float uThreshold;
+void main()
+{
+    vec4 c = texture2D (uSrc, uv);
+    float l = luma (c.rgb);
+    gl_FragColor = vec4 (c.rgb * smoothstep (uThreshold, uThreshold + 0.25, l), 1.0);
+}
+)";
+
+constexpr const char* postBlurPass = R"(
+void main()
+{
+    vec4 c = texture2D (uSrc, uv) * 0.227027;
+    c += (texture2D (uSrc, uv + uDir * 1.384615) + texture2D (uSrc, uv - uDir * 1.384615)) * 0.316216;
+    c += (texture2D (uSrc, uv + uDir * 3.230769) + texture2D (uSrc, uv - uDir * 3.230769)) * 0.070270;
+    gl_FragColor = c;
+}
+)";
+
+constexpr const char* postBloomMix = R"(
+void main()
+{
+    vec4 src = texture2D (uSrc, uv);
+    vec4 glow = texture2D (uPrev, uv);
+    gl_FragColor = vec4 (src.rgb + glow.rgb * (0.5 + uAmount * 2.5) * (1.0 + drive()) * uOpacity, 1.0);
+}
+)";
+
+constexpr const char* postBlurMix = R"(
+void main()
+{
+    gl_FragColor = mix (texture2D (uSrc, uv), vec4 (texture2D (uPrev, uv).rgb, 1.0), uOpacity);
+}
+)";
+
+// ---------------------------------------------------------------------------------------------------------------
+// Composition
+// ---------------------------------------------------------------------------------------------------------------
+constexpr const char* composite = R"(
+varying vec2 uv;
+uniform sampler2D uSrc;
+uniform sampler2D uLayer;
+uniform float uOpacity;
+uniform float uMode;
+vec3 blendColour (vec3 b, vec3 l)
+{
+    if (uMode < 0.5) return l;
+    if (uMode < 1.5) return b + l;
+    if (uMode < 2.5) return 1.0 - (1.0 - b) * (1.0 - l);
+    if (uMode < 3.5) return b * l;
+    if (uMode < 4.5) return mix (2.0 * b * l, 1.0 - 2.0 * (1.0 - b) * (1.0 - l), step (0.5, b));
+    if (uMode < 5.5) return abs (b - l);
+    if (uMode < 6.5) return max (b, l);
+    return min (b, l);
+}
+void main()
+{
+    vec4 b = texture2D (uSrc, uv);
+    vec4 l = texture2D (uLayer, uv);
+    float a = clamp (l.a * uOpacity, 0.0, 1.0);
+    vec3 lc = l.a > 0.0001 ? l.rgb / l.a : vec3 (0.0);
+    vec3 r = mix (b.rgb, clamp (blendColour (b.rgb, lc), 0.0, 1.0), a);
+    gl_FragColor = vec4 (r, 1.0);
+}
+)";
+
+constexpr const char* finalPass = R"(
+varying vec2 uv;
+uniform sampler2D uSrc;
+uniform float uZoom;
+uniform float uBright;
+void main()
+{
+    vec2 q = (uv - 0.5) / uZoom + 0.5;
+    vec4 c = (q.x < 0.0 || q.y < 0.0 || q.x > 1.0 || q.y > 1.0) ? vec4 (0.0, 0.0, 0.0, 1.0) : texture2D (uSrc, q);
+    gl_FragColor = vec4 (c.rgb * uBright, 1.0);
+}
+)";
+
+constexpr const char* copy = R"(
+varying vec2 uv;
+uniform sampler2D uSrc;
+void main()
+{
+    gl_FragColor = vec4 (texture2D (uSrc, uv).rgb, 1.0);
+}
+)";
+} // namespace lynx::glsl

+ 9 - 5
tests/Visual164Tests.inc

@@ -246,18 +246,22 @@ TEST (visual164_zgameeditor_state)
                             "[UserContent]\r\nText=\"My song\",\"by me\"\r\nImages=\r\n";
     std::vector<std::string> unmapped;
     const auto s = fromZge ({ ini.begin(), ini.end() }, &unmapped);
-    CHECK (s && s->layers.size() == 3);
-    CHECK (s->layers[0].type == LayerType::background && s->layers[1].type == LayerType::bars && s->layers[2].type == LayerType::text);
+    // (round 165e: Terrain maps to a GPU terrain layer)
+    CHECK (s && s->layers.size() == 4);
+    CHECK (s->layers[0].type == LayerType::background && s->layers[1].type == LayerType::bars && s->layers[2].type == LayerType::text
+           && s->layers[3].type == LayerType::terrain);
     CHECK (s->layers[2].text == "My song\nby me");
     CHECK (s->width == 1280 && s->height == 720 && s->fps == 60);
-    CHECK (unmapped == std::vector<std::string> { "Terrain\\GoopFlow" });
+    CHECK (unmapped.empty());
     // only effects without a counterpart: LYNX's default scene (in the project's video size)
     const std::string only = "[General]\nLayerCount=1\n[AppSet0]\nApp=Feedback\\70sKaleido\n[Video export]\nVideoW=640\nVideoH=480\n";
     const auto fallback = fromZge ({ only.begin(), only.end() });
-    CHECK (fallback && fallback->layers.size() == defaultScene().layers.size() && fallback->width == 640);
+    // (round 165e: the feedback layer stays over the default scene)
+    CHECK (fallback && fallback->layers.size() == defaultScene().layers.size() + 1 && fallback->width == 640
+           && fallback->layers.back().type == LayerType::feedback);
     CHECK (! fromZge ({ 1, 2, 3 }));
     const auto fx = lynx::effectFromFl ("ZGameEditor Visualizer", { ini.begin(), ini.end() });
-    CHECK (fx && fx->kind == lynx::EffectKind::visualizer && fromState (fx->state) && fromState (fx->state)->layers.size() == 3);
+    CHECK (fx && fx->kind == lynx::EffectKind::visualizer && fromState (fx->state) && fromState (fx->state)->layers.size() == 4);
 
     if (! realFlpDir.empty())
     {

+ 211 - 0
tests/Visual165Tests.inc

@@ -0,0 +1,211 @@
+// --- The Visualizer's GPU layers (core/VisualFx.h scene) and LYNX Dance (core/FruityDance.h) - round 165e ------------
+
+#include "core/FruityDance.h"
+
+TEST (visual165_shader_layers_round_trip)
+{
+    using namespace lynx::visualfx::scene;
+    // every shader type has effects with unique ids; the 2D types none
+    for (int t = 0; t < layerTypeCount; ++t)
+    {
+        const auto type = (LayerType) t;
+        CHECK (isShaderType (type) == (effectCount (type) > 0));
+        std::set<std::string> ids;
+        for (int e = 0; e < effectCount (type); ++e)
+        {
+            CHECK (ids.insert (effectId (type, e)).second);
+            CHECK (effectIndex (type, effectId (type, e)) == e);
+            CHECK (std::string (effectName (type, e)).size() > 2 && std::string (effectHint (type, e)).size() > 2);
+            // the Add menu's layer: that effect, saved and read back unchanged
+            Scene s;
+            s.layers.push_back (shaderLayer (type, e));
+            CHECK (s.layers[0].type == type && s.layers[0].effect == e);
+            const auto back = parse (write (s));
+            CHECK (back && *back == s);
+        }
+        CHECK (effectIndex (type, "no such effect") == -1);
+    }
+    CHECK (readsBelow (LayerType::feedback) && readsBelow (LayerType::postprocess) && ! readsBelow (LayerType::canvas));
+    // blend modes are saved by id; unknown values keep Normal
+    Scene s;
+    for (int b = 0; b < blendCount; ++b)
+    {
+        Layer l;
+        l.type = LayerType::bars;
+        l.blend = (Blend) b;
+        s.layers.push_back (l);
+    }
+    const auto back = parse (write (s));
+    CHECK (back && *back == s);
+    const auto odd = parse ("LYNX visualizer 1\nlayer=postprocess\neffect=nonsense\nblend=weird\n");
+    CHECK (odd && odd->layers.size() == 1 && odd->layers[0].effect == 0 && odd->layers[0].blend == Blend::normal);
+    // a 0.1.19 scene (no effect / blend keys) reads as before
+    const auto old = parse ("LYNX visualizer 1\nlayer=bars\ncount=32\n");
+    CHECK (old && old->layers[0].blend == Blend::normal && old->layers[0].effect == 0);
+    // the built-in GPU scenes: each has a shader layer and starts with a background
+    int gpuScenes = 0;
+    for (const auto& p : presets())
+        gpuScenes += std::any_of (p.layers.begin(), p.layers.end(), [] (const Layer& l) { return isShaderType (l.type); });
+    CHECK (gpuScenes >= 6);
+}
+
+TEST (visual165_zgameeditor_gpu_mapping)
+{
+    using namespace lynx::visualfx::scene;
+    const std::string ini = "[General]\r\nLayerCount=8\r\n"
+                            "[AppSet0]\r\nApp=Background\\SolidColor\r\nFParamValues=0,0.5,1,0.5\r\nEnabled=1\r\n"
+                            "[AppSet1]\r\nApp=Canvas effects\\Electric\r\nEnabled=1\r\n"
+                            "[AppSet2]\r\nApp=Object Arrays\\CubesGrid\r\nEnabled=1\r\n"
+                            "[AppSet3]\r\nApp=Feedback\\WormHoleEclipse\r\nEnabled=1\r\n"
+                            "[AppSet4]\r\nApp=Postprocess\\Youlean Bloom\r\nFParamValues=0.4,0.3,0.6,0,0.9\r\nEnabled=1\r\n"
+                            "[AppSet5]\r\nApp=Postprocess\\Vignette\r\nFParamValues=0.2,0,0,0,0.7\r\nEnabled=1\r\n"
+                            "[AppSet6]\r\nApp=Misc\\Unknown Thing\r\nEnabled=1\r\n"
+                            "[AppSet7]\r\nApp=Terrain\\Perturbed Grid\r\nEnabled=0\r\n";
+    std::vector<std::string> unmapped;
+    const auto s = fromZge ({ ini.begin(), ini.end() }, &unmapped);
+    CHECK (s && s->layers.size() == 6);
+    if (! s || s->layers.size() != 6)
+        return;
+    // the solid colour from its parameters (Alpha, Hue, Saturation, Lightness: hue 0.5 = cyan, value 1 - 0.5)
+    const auto bg = s->layers[0];
+    CHECK (bg.type == LayerType::background && (bg.colourA & 0xffffff) == 0x008080);
+    CHECK (s->layers[1].type == LayerType::canvas && s->layers[1].effect == effectIndex (LayerType::canvas, "electric"));
+    CHECK (s->layers[2].type == LayerType::object3d && s->layers[2].effect == effectIndex (LayerType::object3d, "cubes"));
+    CHECK (s->layers[3].type == LayerType::feedback && s->layers[3].effect == effectIndex (LayerType::feedback, "spin"));
+    const auto bloom = s->layers[4];
+    CHECK (bloom.type == LayerType::postprocess && bloom.effect == effectIndex (LayerType::postprocess, "bloom"));
+    CHECK (std::abs (bloom.amount - 0.4f) < 1.0e-4f && std::abs (bloom.size - 0.6f) < 1.0e-4f && std::abs (bloom.opacity - 0.9f) < 1.0e-4f);
+    const auto vignette = s->layers[5];
+    CHECK (vignette.effect == effectIndex (LayerType::postprocess, "vignette") && std::abs (vignette.amount - 0.8f) < 1.0e-4f);
+    CHECK (unmapped == std::vector<std::string> { "Misc\\Unknown Thing" });
+
+    if (! realFlpDir.empty())
+    {
+        // FL's presets: how many of their layers now have a counterpart (report), and every scene still draws
+        const auto dir = std::filesystem::path (realFlpDir) / "Patches" / "Plugin presets" / "Effects" / "ZGameEditor Visualizer";
+        int layers = 0, missing = 0, shader = 0;
+        std::error_code ec;
+        for (auto it = std::filesystem::recursive_directory_iterator (dir, ec); ! ec && it != std::filesystem::recursive_directory_iterator(); it.increment (ec))
+            if (it->path().extension() == ".fst")
+            {
+                std::ifstream in (it->path(), std::ios::binary);
+                const std::vector<std::uint8_t> bytes ((std::istreambuf_iterator<char> (in)), std::istreambuf_iterator<char>());
+                std::vector<std::string> left;
+                const auto scene = fromZge (bytes, &left);
+                CHECK (scene.has_value());
+                if (! scene)
+                    continue;
+                layers += (int) scene->layers.size();
+                missing += (int) left.size();
+                shader += (int) std::count_if (scene->layers.begin(), scene->layers.end(), [] (const Layer& l) { return isShaderType (l.type); });
+            }
+        std::printf ("  ZGE presets: %d layers mapped (%d GPU layers), %d without a counterpart\n", layers, shader, missing);
+        CHECK (layers == 0 || shader > 100);
+    }
+}
+
+TEST (dance165_state_keys_and_poses)
+{
+    using namespace lynx::dance;
+    // LYNX's own state round trip
+    Settings s;
+    s.move = hula;
+    s.mirrored = true;
+    s.visible = false;
+    s.scale = 1.5f;
+    s.speed = 2.0f;
+    s.x = 900;
+    s.y = 640;
+    s.colour = 0xff20c0ff;
+    const auto back = fromState (toState (s));
+    CHECK (back && *back == s);
+    CHECK (read (toState (s)) == s);
+    CHECK (! fromState ({ 1, 2, 3 }) && read ({}) == Settings {});
+
+    // FL's state: int version, then move, mirrored, shown, scale (/64), speed, x, y (+ display options)
+    std::vector<std::uint8_t> fl (40, 0);
+    auto put = [&fl] (int at, std::int32_t v) { std::memcpy (fl.data() + at, &v, 4); };
+    put (0, 1);
+    put (4, jumping);
+    put (8, 1);
+    put (12, 1);
+    put (16, 96);
+    put (20, 0);
+    put (24, 300);
+    put (28, 420);
+    const auto f = fromFl (fl);
+    CHECK (f && f->move == jumping && f->mirrored && f->visible && std::abs (f->scale - 1.5f) < 1.0e-6f && f->speed == 1.0f && f->x == 300 && f->y == 420);
+    put (20, 96);
+    CHECK (fromFl (fl) && std::abs (fromFl (fl)->speed - 4.0f) < 1.0e-6f);
+    put (20, -96);
+    CHECK (fromFl (fl) && std::abs (fromFl (fl)->speed - 0.25f) < 1.0e-6f);
+    CHECK (! fromFl (std::vector<std::uint8_t> (39, 0)));
+    put (0, 0);
+    CHECK (! fromFl (fl));
+
+    // FL's key map (REA_rodada165e §3: the table its TriggerVoice reads)
+    CHECK (actionForKey (59).kind == KeyAction::Kind::move && actionForKey (59).move == freestyle && ! actionForKey (59).mirrored);
+    CHECK (actionForKey (61).move == stepping && ! actionForKey (61).mirrored);
+    CHECK (actionForKey (48).kind == KeyAction::Kind::move && actionForKey (48).move == freestyle && actionForKey (48).mirrored);
+    CHECK (actionForKey (46).move == stepping && actionForKey (46).mirrored);
+    CHECK (actionForKey (hideKey).kind == KeyAction::Kind::hide && actionForKey (showKey).kind == KeyAction::Kind::show);
+    CHECK (actionForKey (100).kind == KeyAction::Kind::none && actionForKey (20).kind == KeyAction::Kind::none);
+    CHECK (actionForKey (firstMoveKey + moveCount - 1).move == moveCount - 1);
+    CHECK (actionForKey (firstMoveKey + moveCount).kind == KeyAction::Kind::none);
+
+    // poses: deterministic, finite, moving (except the held pose's arms), Freestyle never picks Waiting / Pose
+    for (int m = 0; m < moveCount; ++m)
+    {
+        float travel = 0.0f;
+        Pose prev = pose (m, 0.0, 7);
+        for (int k = 1; k <= 64; ++k)
+        {
+            const auto p = pose (m, k / 16.0, 7);
+            CHECK (std::isfinite (p.x) && std::isfinite (p.y) && std::isfinite (p.lean) && std::isfinite (p.shoulder[0]) && std::isfinite (p.knee[1]));
+            CHECK (std::abs (p.turn) <= 1.0f + 1.0e-6f && p.squash > 0.5f && p.squash <= 1.0f + 1.0e-6f);
+            travel += std::abs (p.shoulder[0] - prev.shoulder[0]) + std::abs (p.y - prev.y) + std::abs (p.hipShift - prev.hipShift) + std::abs (p.turn - prev.turn);
+            prev = p;
+        }
+        CHECK (travel > 0.01f);
+        const auto a = pose (m, 3.37, 11), b = pose (m, 3.37, 11);
+        CHECK (a.shoulder == b.shoulder && a.y == b.y);
+    }
+    for (std::int64_t i = 0; i < 200; ++i)
+    {
+        const auto m = freestyleMove (i, 3);
+        CHECK (m >= stepping && m <= spin);
+    }
+    // a mix halfway is between the two
+    const auto p0 = pose (held, 0.0), p1 = pose (zombie, 0.0);
+    const auto mid = Pose::mix (p0, p1, 0.5f);
+    CHECK (std::abs (mid.shoulder[0] - 0.5f * (p0.shoulder[0] + p1.shoulder[0])) < 1.0e-5f);
+}
+
+TEST (dance165_silent_channel_signals)
+{
+    using namespace lynx;
+    auto inst = dance::makeInstrument();
+    auto* sig = dance::signalsOf (inst.get());
+    CHECK (sig != nullptr);
+    CHECK (dance::signalsOf (makeInstrument (InstrumentKind::wasp).get()) == nullptr);
+    if (sig == nullptr)
+        return;
+    inst->prepare (48000.0);
+    std::uint32_t seen = 0;
+    int keys[16] {};
+    CHECK (sig->pull (seen, keys, 16) == 0);
+    inst->noteOn (60, 0.8f);
+    inst->noteOn (53, 0.8f);
+    // it makes no sound
+    std::vector<float> l (512, 0.0f), r (512, 0.0f);
+    inst->render (l.data(), r.data(), 512, 1.0f, 1.0f);
+    CHECK (std::all_of (l.begin(), l.end(), [] (float v) { return v == 0.0f; }));
+    CHECK (sig->pull (seen, keys, 16) == 2 && keys[0] == 60 && keys[1] == 53);
+    CHECK (sig->pull (seen, keys, 16) == 0);
+    // more than the ring holds between two reads: the newest 16
+    for (int k = 0; k < 40; ++k)
+        inst->noteOn (k, 1.0f);
+    CHECK (sig->pull (seen, keys, 16) == 16 && keys[0] == 24 && keys[15] == 39);
+    // the made channel of the kind is the dance instrument
+    CHECK (dance::signalsOf (makeInstrument (InstrumentKind::fruitydance).get()) != nullptr);
+}

+ 64 - 0
tests/tests.cpp

@@ -11822,6 +11822,69 @@ TEST (sytrus_instrument)
     CHECK (tail.back() == 0.0f);
 }
 
+TEST (harmor_installation_presets)
+{
+    // REA_rodada165g-flbeta165s: every Harmor preset of the installation plays on the exact engine — the 88 old
+    // (version 11…15) ones through the upgrade to the current layout, which renders exactly like the old bytes and
+    // keeps the parameter offsets editable; small images (Labyrinth's 16 × 12) are played, not skipped
+    if (realFlpDir.empty())
+        return;
+    const auto folder = std::filesystem::path (realFlpDir) / "Patches" / "Plugin presets" / "Generators" / "Harmor";
+    if (! std::filesystem::exists (folder))
+        return;
+    int files = 0, usable = 0, old = 0, upgraded = 0, same = 0;
+    const std::vector<lynx::harmor::RefNote> notes { { 0, 60, 0.8, 1.0, 0.0, 3000 } };
+    for (const auto& entry : std::filesystem::recursive_directory_iterator (folder))
+    {
+        if (entry.path().extension() != ".fst")
+            continue;
+        std::ifstream in (entry.path(), std::ios::binary);
+        const std::vector<std::uint8_t> file ((std::istreambuf_iterator<char> (in)), {});
+        std::vector<std::uint8_t> st;
+        try
+        {
+            for (const auto& c : flp::parseProject (file, true).channels)
+                if (! c.pluginState.empty())
+                    st = c.pluginState;
+        }
+        catch (const flp::Error&)
+        {
+        }
+        ++files;
+        usable += lynx::harmorStateUsable (st);
+        std::uint32_t v = 0;
+        if (st.size() >= 4)
+            std::memcpy (&v, st.data(), 4);
+        if ((v > 0xffff ? v >> 16 : v) >= 16)
+            continue;
+        ++old;
+        const auto up = lynx::harmorUpgradeState (st);
+        if (! up)
+            continue;
+        std::uint32_t uv = 0;
+        std::memcpy (&uv, up->data(), 4);
+        upgraded += uv == 0x130003u && lynx::harmorParamOffset (*up, 0, 34) > 0 && lynx::harmorStateUsable (*up);
+        if (old <= 6) // (a few: rendering is the slow part)
+            same += lynx::harmor::renderReference (st, notes, 44100.0, 4096) == lynx::harmor::renderReference (*up, notes, 44100.0, 4096);
+        else
+            ++same;
+    }
+    std::printf ("  Harmor installation presets: %d files, %d usable, %d old, %d upgraded\n", files, usable, old, upgraded);
+    CHECK (files >= 300 && usable == files && old >= 80 && upgraded == old && same == old);
+
+    std::ifstream in (folder / "Bell" / "Labyrinth.fst", std::ios::binary);
+    const std::vector<std::uint8_t> file ((std::istreambuf_iterator<char> (in)), {});
+    if (file.empty())
+        return;
+    auto st = flp::parseProject (file, true).channels.at (0).pluginState;
+    const auto a = lynx::harmor::renderReference (st, notes, 44100.0, 4096);
+    const std::int32_t zero = 0;
+    for (int part = 0; part < 2; ++part)
+        std::memcpy (st.data() + lynx::harmorParamOffset (st, part, 92), &zero, 4); // image frequency scale 0
+    const auto b = lynx::harmor::renderReference (st, notes, 44100.0, 4096);
+    CHECK (a.size() == b.size() && a != b);
+}
+
 TEST (harmor_image)
 {
     // REA_rodada75: image synthesis — a looping 6-column image (gain + frequency planes) read at a speed, cubic gain and
@@ -16079,6 +16142,7 @@ TEST (fl_low_lifter_matches_fl_engine)
 #include "Vfx164Tests.inc"
 #include "Misc164Tests.inc"
 #include "Visual164Tests.inc"
+#include "Visual165Tests.inc"
 #include "Patcher164fTests.inc"
 #include "LinuxMouse165Tests.inc"
 #include "Fl165Tests.inc"

Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor