Răsfoiți Sursa

Drumaxx: LYNX kits on FL's Default Kit keys, FL's Plugin database state with FL, DrumSynth kits on every key (round 169e)

Ka1-S 1 lună în urmă
părinte
comite
6eae8e87f5

+ 21 - 6
src/core/BankStates.cpp

@@ -51,7 +51,7 @@ std::vector<std::uint8_t> drumaxxState (const std::string& kitName, const std::v
     {
     {
         auto* p = P.data() + k * padParams;
         auto* p = P.data() + k * padParams;
         p[1] = 0.5f;           // pan centre
         p[1] = 0.5f;           // pan centre
-        p[4] = (float) (36 + k); // key
+        p[4] = 0.0f;           // key: an unused pad is on key 0, as in FL's Default Kit (REA_rodada169e §1)
         if (k >= (int) pads.size())
         if (k >= (int) pads.size())
             continue;
             continue;
         const auto& pad = pads[(std::size_t) k];
         const auto& pad = pads[(std::size_t) k];
@@ -110,15 +110,30 @@ std::vector<float> drumSynthParams (const std::vector<DrumSynthPatch>& patches)
         p[37] = 64.0f;
         p[37] = 64.0f;
     }
     }
     auto editorKey = 60;
     auto editorKey = 60;
-    for (const auto& patch : patches)
-    {
-        const auto slot = drumSynthKeyToSlot (patch.key);
+    const auto put = [&m] (const DrumSynthPatch& patch, int key) {
+        const auto slot = drumSynthKeyToSlot (key);
         if (slot < 0)
         if (slot < 0)
+            return;
+        for (int i = 0; i < drumSynthPatchParams && i < (int) patch.values.size(); ++i)
+            m[(std::size_t) (drumSynthPatchParams * slot + i)] = (float) patch.values[(std::size_t) i];
+    };
+    // FL's own kits cover every key: its fresh DrumSynth Live (the Plugin database's state) repeats its 24-patch kit
+    // over the 120 keys (key k plays patch k mod 24, REA_rodada169e §3). LYNX's kits are one-octave kits, repeated the
+    // same way every 12 keys, so the step sequencer's C5 (60) plays the kit's C like any other C.
+    for (int key = 0; key < drumSynthPatches; ++key)
+        for (const auto& patch : patches)
+            if (((patch.key % 12) + 12) % 12 == key % 12)
+            {
+                put (patch, key);
+                break;
+            }
+    for (const auto& patch : patches) // (a patch on its own key wins over a repeat)
+    {
+        if (drumSynthKeyToSlot (patch.key) < 0)
             continue;
             continue;
         if (&patch == &patches.front())
         if (&patch == &patches.front())
             editorKey = patch.key;
             editorKey = patch.key;
-        for (int i = 0; i < drumSynthPatchParams && i < (int) patch.values.size(); ++i)
-            m[(std::size_t) (drumSynthPatchParams * slot + i)] = (float) patch.values[(std::size_t) i];
+        put (patch, patch.key);
     }
     }
     m[(std::size_t) drumSynthEditorKeyIndex] = (float) editorKey;
     m[(std::size_t) drumSynthEditorKeyIndex] = (float) editorKey;
     m[(std::size_t) drumSynthEditorKeyIndex + 1] = 4.0f; // state version (informational)
     m[(std::size_t) drumSynthEditorKeyIndex + 1] = 4.0f; // state version (informational)

+ 24 - 21
src/core/DrumBanks.cpp

@@ -220,49 +220,52 @@ std::vector<Preset> sakuraBank()
     return b;
     return b;
 }
 }
 
 
+// The pads sit on the keys of FL's own fresh Drumaxx ("Default Kit", the Plugin database's Drumaxx.fst): kick 36,
+// snare 38, hats 42 / 44, toms 43 / 45, the side hit 37 and the cymbal slot 49 (round 169e, REA_rodada169e §1). Like
+// FL's, a kit is silent on the other keys, the step sequencer's C5 (60) included.
 std::vector<Preset> drumaxxBank()
 std::vector<Preset> drumaxxBank()
 {
 {
     std::vector<Preset> b;
     std::vector<Preset> b;
     b.push_back (make ("drumaxx", "Kit", "Acoustic Mesh", { 36, 0.68f, 0.5f, 0, 0, 0.88f, 0.45f, 0.05f, 0, 0.86f, 0.55f, 0.2f, 0.5f,
     b.push_back (make ("drumaxx", "Kit", "Acoustic Mesh", { 36, 0.68f, 0.5f, 0, 0, 0.88f, 0.45f, 0.05f, 0, 0.86f, 0.55f, 0.2f, 0.5f,
         0.5f, 0.68f, 0.02f, 0, 0.5f, 0.5f, 0.5f, 0, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0, 0.45f, 0.5f, 1, 0, 0, 0, 1,
         0.5f, 0.68f, 0.02f, 0, 0.5f, 0.5f, 0.5f, 0, 0.5f, 0.5f, 0.5f, 0.5f, 0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, 0.5f, 1,
-        0, 0, 0, 1, 0, 0, 0, 42, 0.44f, 0.5f, 0, 0, 0.88f, 0.15f, 0.3f, 0, 0.55f, 0.85f, 0.7f, 0.5f, 0.5f, 0.07f, 0.1f, 0, 0.5f, 0.5f,
-        0.5f, 0, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0, 0.12f, 0.5f, 1, 0, 0, 0, 1, 0, 0, 0, 43, 0.4f, 0.45f, 0, 0,
+        0, 0, 0, 1, 0, 0, 0, 37, 0.44f, 0.5f, 0, 0, 0.88f, 0.15f, 0.3f, 0, 0.55f, 0.85f, 0.7f, 0.5f, 0.5f, 0.07f, 0.1f, 0, 0.5f, 0.5f,
+        0.5f, 0, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0, 0.12f, 0.5f, 1, 0, 0, 0, 1, 0, 0, 0, 49, 0.4f, 0.45f, 0, 0,
         0.88f, 0.1f, 0.05f, 0, 0.7f, 0.9f, 0.5f, 0.5f, 0.5f, 0.05f, 0.02f, 0.3f, 0.5f, 0.5f, 0.5f, 0, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f,
         0.88f, 0.1f, 0.05f, 0, 0.7f, 0.9f, 0.5f, 0.5f, 0.5f, 0.05f, 0.02f, 0.3f, 0.5f, 0.5f, 0.5f, 0, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f,
         0.5f, 0.5f, 0.5f, 0, 0.2f, 0.5f, 1, 0, 0, 0, 1, 0, 0, 0 }, { "kit", "physical" }));
         0.5f, 0.5f, 0.5f, 0, 0.2f, 0.5f, 1, 0, 0, 0, 1, 0, 0, 0 }, { "kit", "physical" }));
-    b.push_back (make ("drumaxx", "Kit", "Hand Percussion", { 36, 0.6f, 0.4f, 0, 0, 0.88f, 0.35f, 0.15f, 0, 0.9f, 0.7f, 0.45f, 0.3f,
+    b.push_back (make ("drumaxx", "Kit", "Hand Percussion", { 43, 0.6f, 0.4f, 0, 0, 0.88f, 0.35f, 0.15f, 0, 0.9f, 0.7f, 0.45f, 0.3f,
         0.5f, 0.2f, 0.05f, 0, 0.5f, 0.5f, 0.5f, 0, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0, 0.5f, 0.5f, 1, 0, 0, 0, 1, 0,
         0.5f, 0.2f, 0.05f, 0, 0.5f, 0.5f, 0.5f, 0, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0, 0.5f, 0.5f, 1, 0, 0, 0, 1, 0,
-        0, 0, 37, 0.56f, 0.6f, 0, 0, 0.88f, 0.3f, 0.12f, 0, 0.86f, 0.75f, 0.5f, 0.3f, 0.5f, 0.12f, 0.05f, 0, 0.5f, 0.5f, 0.5f, 0, 0.5f,
+        0, 0, 45, 0.56f, 0.6f, 0, 0, 0.88f, 0.3f, 0.12f, 0, 0.86f, 0.75f, 0.5f, 0.3f, 0.5f, 0.12f, 0.05f, 0, 0.5f, 0.5f, 0.5f, 0, 0.5f,
         0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0, 0.35f, 0.5f, 1, 0, 0, 0, 1, 0, 0, 0, 38, 0.56f, 0.5f, 0, 0, 0.88f, 0.45f,
         0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0, 0.35f, 0.5f, 1, 0, 0, 0, 1, 0, 0, 0, 38, 0.56f, 0.5f, 0, 0, 0.88f, 0.45f,
         0.05f, 0, 0.95f, 0.95f, 0.5f, 0.5f, 0.5f, 0.16f, 0.02f, 0, 0.5f, 0.5f, 0.5f, 0, 0.55f, 0.85f, 0.5f, 0.62f, 0.5f, 0.4f, 0.5f,
         0.05f, 0, 0.95f, 0.95f, 0.5f, 0.5f, 0.5f, 0.16f, 0.02f, 0, 0.5f, 0.5f, 0.5f, 0, 0.55f, 0.85f, 0.5f, 0.62f, 0.5f, 0.4f, 0.5f,
-        0.5f, 0.5f, 0, 0.6f, 0.5f, 1, 0, 0, 0, 1, 0, 0, 0, 39, 0.44f, 0.45f, 0, 0, 0.88f, 0.1f, 0.05f, 0, 0.7f, 0.9f, 0.5f, 0.5f, 0.5f,
+        0.5f, 0.5f, 0, 0.6f, 0.5f, 1, 0, 0, 0, 1, 0, 0, 0, 37, 0.44f, 0.45f, 0, 0, 0.88f, 0.1f, 0.05f, 0, 0.7f, 0.9f, 0.5f, 0.5f, 0.5f,
         0.05f, 0.02f, 0.3f, 0.5f, 0.5f, 0.5f, 0, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0, 0.2f, 0.5f, 1, 0, 0, 0, 1, 0,
         0.05f, 0.02f, 0.3f, 0.5f, 0.5f, 0.5f, 0, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0, 0.2f, 0.5f, 1, 0, 0, 0, 1, 0,
-        0, 0, 40, 0.4f, 0.55f, 0, 0, 0.88f, 0.25f, 0, 0, 0.92f, 1, 0.15f, 0.5f, 0.5f, 0.07f, 0.03f, 0.35f, 0.5f, 0.5f, 0.5f, 0, 0.62f,
-        0.9f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0, 0.35f, 0.5f, 1, 0, 0, 0, 1, 0, 0, 0, 41, 0.32f, 0.65f, 0, 0, 0.88f, 0.2f, 1,
+        0, 0, 44, 0.4f, 0.55f, 0, 0, 0.88f, 0.25f, 0, 0, 0.92f, 1, 0.15f, 0.5f, 0.5f, 0.07f, 0.03f, 0.35f, 0.5f, 0.5f, 0.5f, 0, 0.62f,
+        0.9f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0, 0.35f, 0.5f, 1, 0, 0, 0, 1, 0, 0, 0, 42, 0.32f, 0.65f, 0, 0, 0.88f, 0.2f, 1,
         0, 0.5f, 0.95f, 0.5f, 0.5f, 0.5f, 0.01f, 1, 0.6f, 0.5f, 0.5f, 0.5f, 0, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.7f, 0.5f, 0,
         0, 0.5f, 0.95f, 0.5f, 0.5f, 0.5f, 0.01f, 1, 0.6f, 0.5f, 0.5f, 0.5f, 0, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.7f, 0.5f, 0,
-        0.18f, 0.5f, 1, 0, 0, 0, 1, 0, 0, 0, 42, 0.6f, 0.5f, 0, 0, 0.88f, 0.5f, 0.02f, 0, 0.9f, 0.45f, 0.1f, 0.5f, 0.5f, 0.82f, 0.03f, 0,
-        0.5f, 0.5f, 0.5f, 0, 0.12f, 0.85f, 0.4f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0, 0.55f, 0.5f, 1, 0, 0, 0, 1, 0, 0, 0, 43, 0.36f,
+        0.18f, 0.5f, 1, 0, 0, 0, 1, 0, 0, 0, 36, 0.6f, 0.5f, 0, 0, 0.88f, 0.5f, 0.02f, 0, 0.9f, 0.45f, 0.1f, 0.5f, 0.5f, 0.82f, 0.03f, 0,
+        0.5f, 0.5f, 0.5f, 0, 0.12f, 0.85f, 0.4f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0, 0.55f, 0.5f, 1, 0, 0, 0, 1, 0, 0, 0, 49, 0.36f,
         0.4f, 0, 0, 0.88f, 0.2f, 0.2f, 0, 0.93f, 0.9f, 0.9f, 0.5f, 0.8f, 0.09f, 0.35f, 0.4f, 0.5f, 0.5f, 0.5f, 0, 0.5f, 0.5f, 0.5f, 0.5f,
         0.4f, 0, 0, 0.88f, 0.2f, 0.2f, 0, 0.93f, 0.9f, 0.9f, 0.5f, 0.8f, 0.09f, 0.35f, 0.4f, 0.5f, 0.5f, 0.5f, 0, 0.5f, 0.5f, 0.5f, 0.5f,
         0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0, 0.55f, 0.5f, 1, 0, 0, 0, 1, 0, 0, 0 }, { "kit", "physical" }));
         0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0, 0.55f, 0.5f, 1, 0, 0, 0, 1, 0, 0, 0 }, { "kit", "physical" }));
     b.push_back (make ("drumaxx", "Kit", "Industrial", { 36, 0.68f, 0.5f, 0, 0, 0.88f, 0.5f, 0.02f, 0, 0.9f, 0.45f, 0.1f, 0.5f, 0.5f,
     b.push_back (make ("drumaxx", "Kit", "Industrial", { 36, 0.68f, 0.5f, 0, 0, 0.88f, 0.5f, 0.02f, 0, 0.9f, 0.45f, 0.1f, 0.5f, 0.5f,
         0.82f, 0.03f, 0, 0.5f, 0.5f, 0.5f, 0, 0.12f, 0.85f, 0.4f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0, 0.55f, 0.5f, 1, 0, 0, 0, 1, 0,
         0.82f, 0.03f, 0, 0.5f, 0.5f, 0.5f, 0, 0.12f, 0.85f, 0.4f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0, 0.55f, 0.5f, 1, 0, 0, 0, 1, 0,
-        0, 0, 37, 0.48f, 0.45f, 0, 0, 0.88f, 0.2f, 0.2f, 0, 0.93f, 0.9f, 0.9f, 0.5f, 0.8f, 0.09f, 0.35f, 0.4f, 0.5f, 0.5f, 0.5f, 0, 0.5f,
-        0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0, 0.55f, 0.5f, 1, 0, 0, 0, 1, 0, 0, 0, 38, 0.56f, 0.55f, 0, 0, 0.88f, 0.45f,
+        0, 0, 38, 0.48f, 0.45f, 0, 0, 0.88f, 0.2f, 0.2f, 0, 0.93f, 0.9f, 0.9f, 0.5f, 0.8f, 0.09f, 0.35f, 0.4f, 0.5f, 0.5f, 0.5f, 0, 0.5f,
+        0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0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, 0, 0, 49, 0.4f, 0.5f, 0, 0,
         0.88f, 0.25f, 0, 0, 0.92f, 1, 0.15f, 0.5f, 0.5f, 0.07f, 0.03f, 0.35f, 0.5f, 0.5f, 0.5f, 0, 0.62f, 0.9f, 0.5f, 0.5f, 0.5f, 0.5f,
         0.88f, 0.25f, 0, 0, 0.92f, 1, 0.15f, 0.5f, 0.5f, 0.07f, 0.03f, 0.35f, 0.5f, 0.5f, 0.5f, 0, 0.62f, 0.9f, 0.5f, 0.5f, 0.5f, 0.5f,
         0.5f, 0.5f, 0.5f, 0, 0.35f, 0.5f, 1, 0, 0, 0, 1, 0, 0, 0 }, { "kit", "physical" }));
         0.5f, 0.5f, 0.5f, 0, 0.35f, 0.5f, 1, 0, 0, 0, 1, 0, 0, 0 }, { "kit", "physical" }));
     return b;
     return b;

+ 18 - 0
src/core/NativeEngines.cpp

@@ -186,6 +186,24 @@ std::vector<std::string> presetCandidates (const std::string& presetFolder, bool
         if (const auto path = resolveFlPath (folder + "\\" + name, access.roots); exists (path))
         if (const auto path = resolveFlPath (folder + "\\" + name, access.roots); exists (path))
             out.push_back (path);
             out.push_back (path);
 
 
+    // then the plugin's entry in FL's Plugin database (Generators\<category>\<plugin>.fst): the state FL itself adds
+    // when the plugin is picked (Drumaxx' "Default Kit", REA_rodada169e §1; FL ships no Default.fst for Drumaxx,
+    // Drumpad, BassDrum, Sakura...). Before any other preset of the folder.
+    if (generator && access.listPresets)
+    {
+        const auto wanted = lower (presetFolder + ".fst");
+        for (const auto& path : access.listPresets (resolveFlPath ("%FLStudioData%\\Patches\\Plugin database\\Generators", access.roots)))
+        {
+            const auto cut = path.find_last_of ("\\/");
+            if (lower (cut == std::string::npos ? path : path.substr (cut + 1)) == wanted
+                && std::find (out.begin(), out.end(), path) == out.end())
+            {
+                out.push_back (path);
+                break;
+            }
+        }
+    }
+
     if (access.listPresets)
     if (access.listPresets)
         for (const auto& path : access.listPresets (resolveFlPath (folder, access.roots)))
         for (const auto& path : access.listPresets (resolveFlPath (folder, access.roots)))
             if ((endsWith (path, ".fst") || endsWith (path, ".tbio") || endsWith (path, ".gmsynth") || endsWith (path, ".mrp"))
             if ((endsWith (path, ".fst") || endsWith (path, ".tbio") || endsWith (path, ".gmsynth") || endsWith (path, ".mrp"))

+ 196 - 0
tests/Drumaxx169eTests.inc

@@ -0,0 +1,196 @@
+// Round 169e: where a new Drumaxx (and LYNX's other drum banks) sound — FL's own key layout (REA_rodada169e)
+
+#include "core/BankStates.h"
+#include "core/Drumaxx.h"
+#include "core/DrumSynthLive.h"
+#include "core/LynxBanks.h"
+#include "core/NativeEngines.h"
+
+namespace drumaxx169e
+{
+// FL's fresh Drumaxx ("Default Kit"): the keys its pads sound on (pads 1–10 on 36 38 42 44 49 45 38 42 37 43)
+inline const std::vector<int>& flDefaultKitKeys()
+{
+    static const std::vector<int> keys { 36, 37, 38, 42, 43, 44, 45, 49 };
+    return keys;
+}
+
+// one channel in Pattern mode (120 BPM, 48 kHz): `steps` from the step sequencer (FL's steps play the channel's
+// root note, C5 = 60), `keys` as Piano roll notes, one every beat after them; the output's peak per beat
+inline std::vector<float> beatPeaks (const lynx::ChannelDef& channel, const std::vector<int>& steps, const std::vector<int>& keys)
+{
+    lynx::Song s;
+    s.mixer = lynx::Song::defaultMixer (2);
+    s.bpm = 120.0;
+    auto c = channel;
+    c.mixerTrack = 1;
+    s.channels.push_back (c);
+    s.patterns.emplace_back();
+    auto& p = s.patterns[0];
+    for (const auto step : steps)
+        p.toggleStep (0, step * lynx::stepsPerBeat); // (one step on each of these beats)
+    for (std::size_t i = 0; i < keys.size(); ++i)
+    {
+        lynx::Note n;
+        n.channel = 0;
+        n.key = keys[i];
+        n.start = (std::int64_t) ((steps.size() + i) * lynx::ppq);
+        n.length = lynx::ppq / 2;
+        p.notes.push_back (n);
+    }
+    p.sortNotes();
+    const auto beats = (int) (steps.size() + keys.size());
+    p.lengthTicks = (std::int64_t) (lynx::ppq * std::max (4, beats + 1));
+    s.mode = lynx::PlayMode::pattern;
+    auto state = lynx::RackState::build (s, nullptr, 48000.0, [] (const std::string&) { return std::shared_ptr<const lynx::SampleData>(); });
+    lynx::RackRenderer r;
+    r.prepare (48000.0, 512);
+    const auto tps = 120.0 / 60.0 * lynx::ppq / 48000.0;
+    const int perBeat = 24000; // samples per beat at 120 BPM, 48 kHz
+    std::vector<float> peaks ((std::size_t) beats, 0.0f);
+    for (int done = 0; done < beats * perBeat; done += 512)
+    {
+        std::vector<float> l (512), rr (512);
+        r.process (state.get(), true, done * tps, 512, l.data(), rr.data(), nullptr);
+        for (int i = 0; i < 512; ++i)
+        {
+            const auto beat = (done + i) / perBeat;
+            if (beat < beats)
+                peaks[(std::size_t) beat] = std::max ({ peaks[(std::size_t) beat], std::abs (l[(std::size_t) i]), std::abs (rr[(std::size_t) i]) });
+        }
+    }
+    return peaks;
+}
+
+inline std::vector<int> padKeys (const std::vector<std::uint8_t>& state)
+{
+    std::vector<int> keys;
+    for (int k = 0; k < 16; ++k)
+        if (lynx::drumaxxParam (state, 44 * k) > 0.0f && lynx::drumaxxParam (state, 44 * k + 2) == 0.0f
+            && lynx::drumaxxParam (state, 44 * k + 4) > 0.0f) // volume, not muted, a key (FL's spare pads sit on key 0)
+            keys.push_back ((int) lynx::drumaxxParam (state, 44 * k + 4));
+    std::sort (keys.begin(), keys.end());
+    keys.erase (std::unique (keys.begin(), keys.end()), keys.end());
+    return keys;
+}
+} // namespace drumaxx169e
+
+TEST (drumaxx169e_fresh_drumaxx_without_fl_sounds_on_fl_keys)
+{
+    using namespace lynx;
+    // without FL Studio: a new Drumaxx is LYNX's first kit, its pads on FL's Default Kit keys; like FL's, it is
+    // silent on the step sequencer's C5 (60) and on C4 (48) (FL's command-line render, REA_rodada169e §2)
+    natives::FlAccess none;
+    const auto c = natives::makeChannel (InstrumentKind::drumaxx, none);
+    CHECK (c.has_value() && c->instrument == InstrumentKind::drumaxx);
+    if (! c)
+        return;
+    CHECK (drumaxx169e::padKeys (c->pluginState) == drumaxx169e::flDefaultKitKeys());
+    const auto peaks = drumaxx169e::beatPeaks (*c, { 0 }, { 60, 48, 36, 37, 38, 42, 43, 44, 45, 49 });
+    CHECK (peaks.size() == 11u);
+    if (peaks.size() != 11u)
+        return;
+    CHECK (peaks[0] < 1.0e-5f); // the step (C5)
+    CHECK (peaks[1] < 1.0e-5f); // C5 from the Piano roll
+    CHECK (peaks[2] < 1.0e-5f); // C4
+    for (std::size_t i = 3; i < peaks.size(); ++i)
+    {
+        CHECK (peaks[i] > 1.0e-3f && peaks[i] < 0.95f);
+        if (! (peaks[i] > 1.0e-3f && peaks[i] < 0.95f))
+            std::printf ("  pad key %d: peak %g\n", drumaxx169e::flDefaultKitKeys()[i - 3], (double) peaks[i]);
+    }
+
+    // every LYNX kit sounds exactly on those keys (each key one pad role: kick 36, snare 38, hats 42 / 44...)
+    const auto& bank = banks::bankOf (InstrumentKind::drumaxx);
+    CHECK (bank.size() >= 3);
+    for (int i = 0; i < (int) bank.size(); ++i)
+    {
+        ChannelDef d;
+        d.instrument = InstrumentKind::drumaxx;
+        const auto kit = banks::withPreset (d, i);
+        CHECK (kit && drumaxx169e::padKeys (kit->pluginState) == drumaxx169e::flDefaultKitKeys());
+        if (kit)
+            for (int k = 8; k < 16; ++k) // the unused pads: silent, on key 0 like FL's
+                CHECK (drumaxxParam (kit->pluginState, 44 * k) == 0.0f && drumaxxParam (kit->pluginState, 44 * k + 4) == 0.0f);
+    }
+}
+
+TEST (drumaxx169e_lynx_drum_banks_play_from_the_step_sequencer)
+{
+    using namespace lynx;
+    // the single-voice LYNX banks (Fruit Kick, Drumpad, Sakura, Plucked!) play any key: a fresh one sounds from the
+    // step sequencer's C5, as FL's does
+    natives::FlAccess none;
+    for (const auto kind : { InstrumentKind::fruitkick, InstrumentKind::drumpad, InstrumentKind::sakura, InstrumentKind::plucked })
+    {
+        const auto c = natives::makeChannel (kind, none);
+        CHECK (c.has_value());
+        if (! c)
+            continue;
+        const auto peaks = drumaxx169e::beatPeaks (*c, { 0 }, { 48 });
+        CHECK (peaks.size() == 2u && peaks[0] > 1.0e-3f && peaks[1] > 1.0e-3f);
+        if (peaks.size() == 2u && ! (peaks[0] > 1.0e-3f))
+            std::printf ("  silent step: kind %d (%g)\n", (int) kind, (double) peaks[0]);
+    }
+
+    // DrumSynth Live: LYNX's one-octave kits repeat every 12 keys over the 120 keys (FL's kits fill every key:
+    // its default repeats its 24 patches), so C5 plays the kit's C
+    const auto& bank = banks::bankOf (InstrumentKind::drumsynth);
+    CHECK (bank.size() >= 2);
+    for (int i = 0; i < (int) bank.size(); ++i)
+    {
+        ChannelDef d;
+        d.instrument = InstrumentKind::drumsynth;
+        const auto kit = banks::withPreset (d, i);
+        CHECK (kit.has_value() && kit->modelParams.size() == (std::size_t) drumSynthParamCount);
+        if (! kit || kit->modelParams.size() != (std::size_t) drumSynthParamCount)
+            continue;
+        const auto at = [&kit] (int key, int param) { return kit->modelParams[(std::size_t) (drumSynthPatchParams * drumSynthKeyToSlot (key) + param)]; };
+        for (int key = 0; key < 120; ++key)
+            for (int param = 0; param < drumSynthPatchParams; ++param)
+                if (at (key, param) != at (48 + key % 12, param))
+                {
+                    CHECK (false);
+                    std::printf ("  %s: key %d param %d differs from key %d\n", bank[(std::size_t) i].name.c_str(), key, param, 48 + key % 12);
+                    key = 120;
+                    break;
+                }
+        CHECK (at (60, 0) > 0.0f); // C5: the kit's kick level
+        const auto peaks = drumaxx169e::beatPeaks (*kit, { 0 }, { 48, 36, 72 });
+        CHECK (peaks.size() == 4u);
+        for (const auto p : peaks)
+            CHECK (p > 1.0e-3f && p < 0.95f);
+    }
+    // a patch on its own key wins over another's repeat; keys with no patch in the octave stay silent
+    std::vector<bankstates::DrumSynthPatch> patches (2);
+    patches[0].key = 48, patches[0].values.assign (38, 10);
+    patches[1].key = 60, patches[1].values.assign (38, 20);
+    const auto m = bankstates::drumSynthParams (patches);
+    const auto level = [&m] (int key) { return m[(std::size_t) (drumSynthPatchParams * drumSynthKeyToSlot (key))]; };
+    CHECK (level (48) == 10.0f && level (60) == 20.0f && level (36) == 10.0f && level (72) == 10.0f && level (49) == 0.0f);
+}
+
+TEST (drumaxx169e_fresh_drumaxx_with_fl_is_fl_default_kit)
+{
+    using namespace lynx;
+    if (realFlpDir.empty())
+        return;
+    // with FL Studio: a new Drumaxx is FL's own fresh one, the Plugin database's "Default Kit" (FL ships no
+    // Default.fst for it); it plays where FL's does (FL's render: silent on 60 and 48, the kit on its keys)
+    const auto fl = natives142::flAccess();
+    const auto c = natives::makeChannel (InstrumentKind::drumaxx, fl);
+    CHECK (c.has_value());
+    if (! c)
+        return;
+    CHECK (drumaxxKitName (c->pluginState) == "Default Kit");
+    CHECK (drumaxx169e::padKeys (c->pluginState) == drumaxx169e::flDefaultKitKeys());
+    const auto peaks = drumaxx169e::beatPeaks (*c, { 0 }, { 48, 36, 38, 42 });
+    CHECK (peaks.size() == 5u);
+    if (peaks.size() == 5u)
+        CHECK (peaks[0] < 1.0e-5f && peaks[1] < 1.0e-5f && peaks[2] > 1.0e-3f && peaks[3] > 1.0e-3f && peaks[4] > 1.0e-3f);
+    // the Plugin database entry comes right after a Default preset and before the folder's other presets
+    const auto list = natives::presetCandidates ("Drumaxx", true, fl);
+    CHECK (! list.empty() && list.front().find ("Plugin database") != std::string::npos);
+    const auto kick = natives::presetCandidates ("Fruit Kick", true, fl);
+    CHECK (kick.size() >= 2 && kick[0].find ("Default.fst") != std::string::npos && kick[1].find ("Plugin database") != std::string::npos);
+}

+ 1 - 1
tests/Natives142Tests.inc

@@ -191,7 +191,7 @@ TEST (natives142_engines_from_the_fl_installation)
         CHECK (c->instrument == e.kind && c->name == e.name);
         CHECK (c->instrument == e.kind && c->name == e.name);
         if (e.kind == InstrumentKind::granulizer || e.kind == InstrumentKind::wavetraveller) // (play the channel's sample: none yet)
         if (e.kind == InstrumentKind::granulizer || e.kind == InstrumentKind::wavetraveller) // (play the channel's sample: none yet)
             continue;
             continue;
-        const auto rms = natives142::renderChannel (*c, fl, e.kind == InstrumentKind::drumaxx ? 48 : 60);
+        const auto rms = natives142::renderChannel (*c, fl, e.kind == InstrumentKind::drumaxx ? 36 : 60); // (FL's Default Kit: the kick on 36, round 169e)
         CHECK (rms > 1.0e-3 && std::isfinite (rms));
         CHECK (rms > 1.0e-3 && std::isfinite (rms));
         if (! (rms > 1.0e-3))
         if (! (rms > 1.0e-3))
         {
         {

+ 1 - 0
tests/tests.cpp

@@ -17016,3 +17016,4 @@ TEST (fl_low_lifter_matches_fl_engine)
 #include "Mixer168hTests.inc"
 #include "Mixer168hTests.inc"
 #include "Mute53fTests.inc"
 #include "Mute53fTests.inc"
 #include "Issue32cTests.inc"
 #include "Issue32cTests.inc"
+#include "Drumaxx169eTests.inc"