Browse Source

Round 169h: Ogun's X / Y pad drawn like FL's (4 x 4 grid, ring clipped to the pad); engine description wraps instead of an ellipsis; REA doc

Ka1-S 1 month ago
parent
commit
ddfcc1fbeb
2 changed files with 127 additions and 8 deletions
  1. 106 0
      docs/analise/REA_rodada169h.md
  2. 21 8
      src/ui/ChannelSettings.cpp

+ 106 - 0
docs/analise/REA_rodada169h.md

@@ -0,0 +1,106 @@
+# REA round 169h — Ogun / Autogun live automation, Ogun's X/Y pad, Autogun in the editor pictures, FL Slayer's description
+
+Clean-room: the behaviour below was read from FL Studio 2026's own `Ogun_x64.dll` (SHA-256
+`c2c717df…a1e4c6`, Ghidra 12.1.4 headless, project `~/ghproj/r57_og`, our scripts `tmp/r169h/gh/DecTree.java`,
+`DecRange.java`, `DecAt.java`; decompilations `tmp/r169h/pp.c`, `fx.c`, `rv.c`, `at.c`) and from its editor form
+(`TSynthEditorForm`, read in round 168o: `tmp/r168o/Ogun/TSynthEditorForm.dfm.txt`). Autogun_x64.dll shares this code
+(REA_rodada57 §1.1: `FUN_008684e0` is identical). No code or art was copied. Toxic Biohazard's MIDI / SEQ pages are in
+`REA_rodada169h-toxic.md` (sub-round).
+
+| # | Item (coordinator's words) | FL evidence | LYNX before | LYNX now |
+|---|---|---|---|---|
+| 1 | "Ogun and Autogun: live Playlist clip automation of their parameters must drive the engine in real time like FL" | §1 | clips bound (`modelparams::find`) but `OgunInstrument` had no `setParameter`: nothing happened; a knob edit rebuilt the engine (held notes cut) | §1: `Engine::setParam` applies exactly what ProcessParam recomputes; knob edits go the same live way |
+| 2 | "Ogun editor: the XY pad's dot sits half on the pad's left border at its default value" | §2 (form + driven FL) | a filled glow + ring drawn over the pad's border (outside half visible), one centre cross | §2: FL's 4 × 4 grid and small ring, clipped to the pad |
+| 3 | "Autogun is missing from the --instrumentshot tool" | §3 | Autogun not in `natives::instrumentEngines()` (no preset files) → never pictured | §3 |
+| 4 | Toxic Biohazard MIDI / SEQ pages | REA_rodada169h-toxic.md | | |
+| 5 | "FL Slayer editor: description cut with '…' at 800 px wide" | LYNX-own line (no FL equivalent) | one `drawText` line, ellipsis | §5 |
+
+## 1. Ogun / Autogun parameters while playing
+
+### 1.1 FL's ProcessParam (`FUN_008684e0`, VMT slot 6) [DECOMP]
+
+- Index mapping (`FUN_008698e0`): index `i < 0x31` (0…48) is `P[i]` (plugin `+0x12c + 4·i`); `49 ≤ i < 89` is an
+  articulator knob: articulator `(i − 49) / 8` (0…4), knob `(i − 49) mod 8` (0…3 envelope knobs `+0x98`, re-scaled by
+  `FUN_00789c70`; 4…7 LFO knobs `+0xd0`, LFO speed recomputed through the curve object's VMT `+0x40`). Indices ≥ 89 do
+  nothing. So **FL's automation targets are P0…P48 and the knobs of articulators 0…4** — Richness (P52), Quality (P54),
+  filter type / order (P49…P51) and the other settings are not automatable.
+- Value: with flag `0x20` (a host value 0…65536, automation / links) the plugin takes
+  `min + round(value/65536 · (max − min))` (banker's rounding `FUN_0040c3e0`) of the control's range (`+0x3a8 / +0x3ac`
+  of the control object).
+- With the "set" flag (bit 0), after storing P[i]:
+  - P0…P2 → `FUN_0086a570`: master level `+0x5bc` (`(3^(P0/128) − 1)/2`, 1 at 128) and tuning `+0x5c0 = P1·100 + P2`.
+  - P3, P4 → `FUN_0086a610`: `+0x5cc / +0x5d0 = P/512` and a refresh flag; the voices read P3 / P4 at every control
+    block (LYNX `Engine::control`, smoothing `xysmooth` when flag `+0x208`).
+  - P5…P9 (under the plugin lock, VMT `+0x100 / +0x108`): pre-decay `+0x248`, fullness `+0x24c`, decay `+0x250` (−1 at
+    10000), release `+0x254`, morph `+0x258`; P10, P11: the seeds `+0x23c / +0x240` (`mix32(P − 0x20cf)` when P ≥ 1,
+    else −1). The voices copy these at note start (`FUN_00842ee0`), so a change reaches the next notes.
+  - P12…P16 (unison): nothing but the stored value (read at note start), except P15 → `FUN_0086c530`: every active
+    voice's sub-voice detune factors are recomputed at once.
+  - P17, P18 → filter cutoff / resonance `+0x530 / +0x534` = P/256 (read by every control block).
+  - P19…P25 → `FUN_0086a2d0` → `FUN_00840690` (chorus): order 0 frees the chorus object, a chorus switched on is a new
+    object; otherwise the taps are recomputed (SetLength keeps the running phase `[4]` of existing taps, new taps start
+    at 0) and only when the ring's length (`FUN_0083cd50` returns true) or the spread (`+0x48` vs `+0x30`) changed are
+    all phases restarted (`[5] → [4]`) and the ring cleared (`FUN_00840d30` → VMT 0).
+  - P26…P30 → `FUN_00869dd0` (delay): stereo offset, length (tempo-synced when the sync byte `+0x358` is set),
+    feedback, volume, mode recomputed; `FUN_0083cd50(line, block + offset, length)` re-allocates and clears the line
+    (read point restarted) only when its total size changes (`FUN_0083ccf0`).
+  - P31…P39 → `FUN_0086a0a0` (reverb, FL's shared `Reverb_x64.dll` behind the wrapper `0x83f…`): a new predelay length
+    calls the wrapper's VMT 0 = `FUN_0083f650` (lines re-allocated) → `FUN_0083f5d0` (every line and state zeroed); the
+    other fields set the dirty flag, and the next block's `FUN_0083f840` recomputes the coefficients and line lengths,
+    keeps each line's position modulo its new length and zeroes the 12 lines only when the room size differs from the
+    last one (`+0x1e8`).
+  - P40…P48 → `FUN_0086a670(band = (i − 40) mod 3)`: that band's level / frequency / width and its biquad
+    coefficients (`FUN_00625290`); the filter state is kept.
+- Autogun's Magic dust (P63, REA_rodada57 §1.4): automation updates P63 only (the stage's on/off test in Gen_Render);
+  the knob handler `FUN_0088d930` also sends the band mix to the hosted Soundgoodizer.
+
+### 1.2 LYNX
+
+- `Engine::setParam (index, value)` (src/core/Ogun.cpp) does the same per index on the engine's own patch copy:
+  `designMaster`, `designTimbre`, `designFilterKnobs`, `designEqBand`, and `liveChorus` / `liveDelay` / `liveReverb`
+  with FL's keep / clear rules above. `buildPatch` now calls the same `design*` helpers, so a fresh engine and a live
+  change compute identical values.
+- `OgunInstrument::setParameter` (automation clips, links, the Event editor): FL's value law on the knob range of
+  `ogunEngineParams()` / `autogunEngineParams()`, indices 0…48 and Autogun's 63; Richness / Quality are ignored like
+  FL. The automated values are re-applied to an engine rebuilt later (tempo, sample rate).
+- The editor's knobs: `configure` compares the new state with the loaded one; when only P0…P48 differ the values go
+  to the audio thread through a `LiveParamQueue` (as FL's knobs call ProcessParam) — the held notes keep playing.
+  Magic dust from the knob still rebuilds (the band mix must reach the stage).
+- Not done: the articulator knobs (FL indices 49…88) — LYNX's Ogun page does not show the articulators' knobs, so they
+  can't be automated from LYNX, and FL projects' clips on them are not bound. LYNX's automation index is the P index,
+  so an FL clip on index 52 (articulator 0, knob 3) would bind to Richness and do nothing.
+- Tests: tests/Inst169hTests.inc (`inst169h_ogun_automation_is_live`, `..._knob_edits_keep_the_note...`,
+  `..._automation_clip_drives_the_engine`, `inst169h_autogun_shot_channel`).
+
+## 2. Ogun's X / Y pad
+
+- FL: `ModVisual: TQuickXYZ` (Left 99, Top 8, 77 × 77, `CursorStyle = QXYZCS_Ogun`, X / Y selectors `ModXWheel` /
+  `ModYWheel`: Max 512, **Value = DefaultValue = 256**) [DATA: the form]. So at FL's default the cursor is in the middle;
+  the preset FL's Ogun channel starts from ("300 Ft Glass Bowl") has Mod X = 0, so the dot sits on the left edge in
+  both programs — the value is right.
+- Driven FL (one session, both locks, FL closed by its PID 23472; shots `/mnt/e/lynx-work/r169h/fl-ogun-open.png`,
+  `fl-ogun-x0.png`, `fl-ogun-x0b.png`): `Data/System/Render tests/Ogun.flp` opened with its editor; at X = Y = 256 the
+  cursor is a small hollow ring in the middle of a pad with a 4 × 4 grid; after dragging the X wheel to its minimum the
+  ring's centre is on the pad's left edge and **only its inner half is drawn** — FL clips the cursor to the pad.
+- LYNX before: a 16-unit filled glow plus a 10-unit ring, not clipped, so half of it was painted over the pad's border
+  and the section background, and only one centre cross. LYNX now (ChannelSettings `xy` display): the 4 × 4 grid (the
+  centre lines a little stronger), the 10-unit ring in the accent colour, clipped to the pad like FL.
+
+## 3. Autogun in `--instrumentshot`
+
+- Autogun has no preset files (`Plugins/Fruity/Generators/Autogun/Data` holds `Maps`, `Random pad`, `SG.dat`; its
+  patches are numbers) [DATA], so it is not in LYNX's Add menus. The shot tool now takes `autogun` and pictures FL's own
+  `Data/System/Render tests/Autogun.flp` channel (`natives::autogunShotChannel`), imported with SG.dat.
+
+## 5. FL Slayer's description
+
+- LYNX-own text (FL has no such line). The description is now drawn with `drawFittedText` in `descriptionArea()`: two
+  lines above the knob grid (whose captions start at y 32), one line slightly condensed on designed pages, clear of the
+  sample button.
+
+## Where I stopped
+
+- Done: §1 code + tests (build running), §3 code, §5 code. In progress: §2 FL look (FL session), Windows shots.
+- Next: build-local green → Windows build → `--instrumentshot /mnt/e/lynx-work/r169h ogun,autogun,flslayer fl` → look →
+  commit → coord/train.sh inst169h.
+- Rerun: `~/.claude/jobs/f8789b49/tmp/r169h/bl.sh` (build-local via buildslot), Ghidra scripts in tmp/r169h/gh.

+ 21 - 8
src/ui/ChannelSettings.cpp

@@ -1597,14 +1597,19 @@ public:
                         if (auto* kx = knobFor (item.param); kx != nullptr)
                             if (auto* ky = knobFor (item.param2); ky != nullptr)
                             {
-                                g.setColour (colour::gridBeat);
-                                g.drawVerticalLine ((int) r.getCentreX(), r.getY(), r.getBottom());
-                                g.drawHorizontalLine ((int) r.getCentreY(), r.getX(), r.getRight());
+                                // FL's Ogun pad (TQuickXYZ, round 169h shots fl-ogun-*.png): a 4 × 4 grid and a small ring
+                                // whose centre is the value, drawn clipped to the pad — at X = 0 only its inner half shows
+                                const juce::Graphics::ScopedSaveState clip (g);
+                                g.reduceClipRegion (r.toNearestInt());
+                                for (int k = 1; k < 4; ++k)
+                                {
+                                    g.setColour (k == 2 ? colour::gridBar : colour::gridBeat);
+                                    g.drawVerticalLine ((int) (r.getX() + r.getWidth() * (float) k / 4.0f), r.getY(), r.getBottom());
+                                    g.drawHorizontalLine ((int) (r.getY() + r.getHeight() * (float) k / 4.0f), r.getX(), r.getRight());
+                                }
                                 const juce::Point<float> pt { r.getX() + r.getWidth() * normalised (*kx), r.getBottom() - r.getHeight() * normalised (*ky) };
-                                g.setColour (accent.withAlpha (0.3f));
-                                g.fillEllipse (juce::Rectangle<float> (16.0f * f, 16.0f * f).withCentre (pt));
                                 g.setColour (accent);
-                                g.drawEllipse (juce::Rectangle<float> (10.0f * f, 10.0f * f).withCentre (pt), 2.0f);
+                                g.drawEllipse (juce::Rectangle<float> (10.0f * f, 10.0f * f).withCentre (pt), juce::jmax (1.5f, 1.5f * f));
                             }
                     if (juce::String (item.display) == "toxicwave" && item.param != nullptr) // round 168n: the wave's cycle
                     {
@@ -1959,7 +1964,7 @@ public:
         g.setColour (theme::colour::textPrimary);
         g.setFont (theme::font (layout != nullptr ? theme::type::body : theme::type::title));
         if (! engineFilesMissing)
-            g.drawText (drumsynth ? tr ("DrumSynth Live — FL's engine, patch on key {0}", { juce::String (editorKey) })
+            g.drawFittedText (drumsynth ? tr ("DrumSynth Live — FL's engine, patch on key {0}", { juce::String (editorKey) })
                                         + (wavesFound ? tr (" (next hit; recorded waves from your FL installation)")
                                                       : tr (" (next hit; recorded waves not found: silent)"))
                         : harmless ? tr ("Harmless — FL's additive engine (chorus/delay/reverb/compressor rack off)")
@@ -1992,7 +1997,7 @@ public:
                         : boobass ? tr ("BooBass — FL's engine, its sound read from your FL installation (knobs: 3-band EQ)")
                         : sakura ? tr ("Sakura — physical strings (FL's engine; new parameters apply to the next note)")
                                  : tr ("Drumpad — physical drum (FL's engine; new parameters apply to the next hit)"),
-                        10, 6, getWidth() - 20, 20, juce::Justification::centredLeft);
+                              descriptionArea(), juce::Justification::centredLeft, layout != nullptr ? 1 : 2, 0.8f);
         if (engineFilesMissing) // round 168q: an engine that runs FL's own DLL / data file, which this computer lacks
         {
             const auto band = juce::Rectangle<float> (8.0f, 5.0f, (float) getWidth() - 16.0f, 22.0f);
@@ -2013,6 +2018,14 @@ public:
             g.drawText (k->getName(), k->getBounds().withHeight (14).translated (0, -14), juce::Justification::centred);
     }
 
+    // the engine's one-line description at the top (round 169h: wrapped to a second line above the knob grid, or shrunk a
+    // little on a designed page, instead of cut with "…" in a narrow window); clear of the sample button
+    juce::Rectangle<int> descriptionArea() const
+    {
+        const auto right = sampleButton.isVisible() ? getWidth() - 136 : getWidth() - 10;
+        return { 10, layout != nullptr ? 6 : 2, juce::jmax (40, right - 10), layout != nullptr ? 20 : 30 }; // (the knob grid's captions start at y 32)
+    }
+
     void resized() override
     {
         if (sampleButton.isVisible())