فهرست منبع

Toxic MIDI/SEQ pages: page shots, test fixes (round 169h, WIP)

Ka1-S 1 ماه پیش
والد
کامیت
f3c365df5e
4فایلهای تغییر یافته به همراه30 افزوده شده و 2 حذف شده
  1. 8 0
      src/Main.cpp
  2. 17 0
      src/ui/ChannelSettings.cpp
  3. 3 0
      src/ui/ChannelSettings.h
  4. 2 2
      tests/Toxic169hTests.inc

+ 8 - 0
src/Main.cpp

@@ -6051,6 +6051,14 @@ private:
                 savePng (frame->createComponentSnapshot (frame->getLocalBounds(), true, scale), file.getFullPathName());
                 std::printf ("%s %dx%d\n", file.getFullPathName().toRawUTF8(), frame->getWidth(), frame->getHeight());
             }
+            // round 169h: the layout's other pages (Toxic's MIDI / Seq …), one shot each at 1.5×
+            for (int page = 1; page < lynx::showChannelLayoutPage (*frame, -1); ++page)
+            {
+                lynx::showChannelLayoutPage (*frame, page);
+                const auto file = folder.getChildFile (name + "-" + source + "-page" + juce::String (page) + "-150.png");
+                savePng (frame->createComponentSnapshot (frame->getLocalBounds(), true, 1.5f), file.getFullPathName());
+                std::printf ("%s\n", file.getFullPathName().toRawUTF8());
+            }
         }
         return ok;
     }

+ 17 - 0
src/ui/ChannelSettings.cpp

@@ -1283,6 +1283,8 @@ public:
                && holds (item.when2Param, item.when2Min, item.when2Max);
     }
 
+    int pageCount() const { return layout != nullptr ? (int) layout->pages.size() : 0; }
+
     void showPage (int p)
     {
         page = p;
@@ -5171,6 +5173,21 @@ std::unique_ptr<juce::Component> makeChannelPrecomputePanel (AudioEngine& engine
     return std::make_unique<PrecomputePanel> (engine, ChannelRef::rack (channel));
 }
 
+int showChannelLayoutPage (juce::Component& frame, int page)
+{
+    if (auto* panel = dynamic_cast<ModelPanel*> (&frame); panel != nullptr && panel->pageCount() > 0)
+    {
+        const auto count = panel->pageCount();
+        if (page >= 0 && page < count)
+            panel->showPage (page);
+        return count;
+    }
+    for (auto* child : frame.getChildren())
+        if (const auto count = showChannelLayoutPage (*child, page); count > 0)
+            return count;
+    return 0;
+}
+
 std::unique_ptr<juce::Component> makeChannelFrame (AudioEngine& engine, int channel, int tab)
 {
     const auto kind = engine.getSong().channels[(std::size_t) channel].instrument;

+ 3 - 0
src/ui/ChannelSettings.h

@@ -33,6 +33,9 @@ std::unique_ptr<juce::Component> makeChannelPrecomputePanel (AudioEngine& engine
 // The whole channel window (REA round 143b): FL's header strip (tabs; On, Pan, Vol, Track) over the instrument page,
 // the "Envelope / instrument" tab (synth, sampler) and the "Misc" tab. `tab` < 0 = the Misc tab.
 std::unique_ptr<juce::Component> makeChannelFrame (AudioEngine& engine, int channel, int tab = 0);
+// The designed plugin page inside a channel window shows page `page` (screenshots, round 169h); returns the page count
+// of its layout (0 = no pages)
+int showChannelLayoutPage (juce::Component& frame, int page);
 
 // A Patcher node's built-in generator (round 164f): the same pages as on a channel — the instrument's page and, for
 // the synth and the sampler, the Envelope / instrument tab — editing the node `locate` finds. Null: no page for it.

+ 2 - 2
tests/Toxic169hTests.inc

@@ -87,7 +87,7 @@ TEST (toxic169h_sequencer_steps_and_clock)
     const auto ev = lynx::toxic::sequencerEvents (s, { held (60) }, {}, 44100.0, 30000, 125.0);
     // a 16th note (15/125 s = 5292 samples) quantised to the engine's 64-sample chunks
     CHECK ((onsets (ev, 60) == std::vector<int> { 0, 21184 }));
-    CHECK ((onsets (ev, 67) == std::vector<int> { 5312 }));
+    CHECK ((onsets (ev, 67) == std::vector<int> { 5312, 26496 })); // (the pattern repeats)
     CHECK ((onsets (ev, 72) == std::vector<int> { 10624 }));
     // the rest stops the lane's note and plays nothing
     bool released72 = false;
@@ -102,7 +102,7 @@ TEST (toxic169h_sequencer_swing_and_modes)
     auto s = pattern ({ 0, 1, 2 }, 3);
     set (s, 158, 1.0f); // swing: the steps last 1.25 and 0.75 sixteenths in turn
     auto ev = lynx::toxic::sequencerEvents (s, { held (60) }, {}, 44100.0, 22000, 125.0);
-    CHECK ((onsets (ev, 61) == std::vector<int> { 6656 }));
+    CHECK ((onsets (ev, 61) == std::vector<int> { 6656, 21184 }));
     CHECK ((onsets (ev, 62) == std::vector<int> { 10624 }));
     CHECK ((onsets (ev, 60) == std::vector<int> { 0, 17216 }));