Selaa lähdekoodia

Save a copy for 0.1.30: round 190ok's engine revision 2 written as 1 (0.1.30 plays 2 as 1) and smartDisable dropped, both without a line; --selftest rollup031s5_copy_for_0130 covers them (rollup 0.1.31 step 5)

Ka1-S 2 viikkoa sitten
vanhempi
sitoutus
5fac4db1af
2 muutettua tiedostoa jossa 21 lisäystä ja 2 poistoa
  1. 9 2
      src/Main.cpp
  2. 12 0
      src/engine/ProjectDowngrade.cpp

+ 9 - 2
src/Main.cpp

@@ -8393,6 +8393,7 @@ private:
             synth.plugin.id = "VST3:old-synth";
             synth.plugin.name = "Old Synth";
             synth.plugin.dpiAware = false;
+            synth.smartDisable = true; // (merge 6, 190ok D2: dropped without a line)
             song.channels.push_back (synth);
             const auto synthIndex = (int) song.channels.size() - 1;
             lynx::EffectSlot fx;
@@ -8401,6 +8402,8 @@ private:
             fx.plugin.name = "Tiny EQ";
             fx.plugin.scaleEditorDimensions = true;
             song.mixer[2].effects.push_back (fx);
+            auto ember = lynx::makeEffectSlot (lynx::EffectKind::ember); // (merge 6, 190ok D3: engine revision 2 -> 1 in the copies)
+            song.mixer[2].effects.push_back (ember);
             // gap190og: a key mapped to Arrangement Overdub (newer) and one to Play (0.1.30 has it)
             lynx::RemoteMapping overdub, play;
             overdub.source = play.source = lynx::RemoteMapping::Source::key;
@@ -8437,7 +8440,7 @@ private:
             };
             auto expected = keysOf (juce::JSON::parse (json));
             const auto hadKeys = expected.erase ("/arrangements[]/sections") == 1 && expected.erase ("/channels[]/plugin/dpiAware") == 1
-                                 && expected.erase ("/mixer[]/effects[]/plugin/scaleEditorDimensions") == 1;
+                                 && expected.erase ("/mixer[]/effects[]/plugin/scaleEditorDimensions") == 1 && expected.erase ("/channels[]/smartDisable") == 1;
             const auto countOf = [] (const lynx::olderlynx::Copy& c, const char* start) {
                 return (int) std::count_if (c.lost.begin(), c.lost.end(), [start] (const lynx::olderlynx::Loss& l) { return juce::String (l.text).startsWith (start); });
             };
@@ -8474,7 +8477,8 @@ private:
                             ++sectionMarkers;
                 const auto bars = song.barsBetween (0, 400 * lynx::ppq);
                 const auto backBars = back ? back->barsBetween (0, 400 * lynx::ppq) : std::vector<lynx::Bar> {};
-                const auto backFx = back && back->mixer.size() > 2 && ! back->mixer[2].effects.empty() ? back->mixer[2].effects.back().plugin : lynx::PluginRef {};
+                const auto backFx = back && back->mixer.size() > 2 && back->mixer[2].effects.size() >= 2 ? back->mixer[2].effects[back->mixer[2].effects.size() - 2].plugin : lynx::PluginRef {};
+                const auto backEmberRev = back && back->mixer.size() > 2 && ! back->mixer[2].effects.empty() ? back->mixer[2].effects.back().engineRev : -1;
                 if (! copy.ok || ! back)
                     rollup031s5Result = juce::String ("ERROR copy ") + release + " " + copy.error + why;
                 else if (copy.json.contains ("\"sections\"") || ! back->sections().empty() || sectionMarkers != 2
@@ -8497,6 +8501,9 @@ private:
                 else if (back->remoteMappings.size() != 1 || back->remoteMappings[0].action != lynx::RemoteAction::play
                          || countOf (copy, "{0} key / MIDI mapping(s) of Overdub") != 1 || detailOf (copy, "{0} key / MIDI mapping(s) of Overdub") != "1")
                     rollup031s5Result = juce::String ("ERROR gap190og's transport mappings in the copy for ") + release;
+                else if (copy.json.contains ("smartDisable") || back->channels[(std::size_t) synthIndex].smartDisable || song.mixer[2].effects.back().engineRev != 2
+                         || backEmberRev != (is130 ? 1 : 0))
+                    rollup031s5Result = juce::String ("ERROR 190ok's smart disable / engine revision in the copy for ") + release + " (rev " + juce::String (backEmberRev) + ")";
                 else if (back->automations != song.automations)
                     rollup031s5Result = juce::String ("ERROR 190ob's volume automation in the copy for ") + release;
                 else if (is130 && (copy.lost.size() != 3 || keysOf (juce::JSON::parse (copy.json)) != expected))

+ 12 - 0
src/engine/ProjectDowngrade.cpp

@@ -1647,6 +1647,18 @@ void toRelease0130 (juce::var& root, Losses& lost)
                               listOf (editors), false });
     }
 
+    // round 190ok (D3): EffectSlot::engineRev 2 = LYNX's own devices (Ember, Prism, Crest, Echoform...) compute their
+    // per-sample tanh / exp / log / pow / sin with core/FastMath.h. 0.1.30 knows revisions 0 and 1 (Maximus: ">= 1"), so it
+    // plays a slot at 2 as at 1, with the C library's maths (190ok's nulls: at most -135 dBFS apart). The copy says 1, so
+    // the copy opened again in a newer LYNX plays what 0.1.30 plays, bit for bit; nothing audible to report.
+    // Round 190ok (D2): ChannelDef::smartDisable (FL's generator smart disable of a hosted instrument): 0.1.30 runs the
+    // plugin all the time, the same sound: dropped without a line (as 190ok's own 0.1.28 step). Rollup 0.1.31 step 5
+    forEachEffect (root, [] (juce::DynamicObject& e, const juce::String&) {
+        if ((int) e.getProperty ("engineRev", 0) > 1)
+            e.setProperty ("engineRev", 1);
+    });
+    forEachChannel (root, [] (juce::DynamicObject& c, int) { drop (c, "smartDisable"); });
+
     // round gap190og (coverage live4:mapping-0028): key and MIDI mappings of Live's Arrangement Overdub, Loop switch,
     // Punch-In and Punch-Out (RemoteAction values after launchSelectedClip). 0.1.30 skips an action it does not know when
     // it reads the project, so they go here with a line instead of vanishing silently. Rollup 0.1.31 step 5