|
|
@@ -0,0 +1,274 @@
|
|
|
+ // Round 190to (QUEUE 0.1.33 item 96, issue #361 follow-up; FL 2026 live check 12-01, raw a02-a16): FL's per-insert effects
|
|
|
+ // switch (MixerTrack::effectsOn: the strip's plug icon and the Effects panel's FX button; the slots keep their own
|
|
|
+ // switches; .lynx "effectsOn", the 0.1.32 copy, FL's .flp bit 0x04), the Master's and the Current column's icons, and
|
|
|
+ // FL's Extra large icon places. Through the real components, off screen; no window is opened.
|
|
|
+ // Included in the app class of Main.cpp; --round190totest <report> [<shot prefix>] and --selftest "round190to".
|
|
|
+ juce::String round190toCheck (juce::String& log, const juce::String& shots = {})
|
|
|
+ {
|
|
|
+ using namespace lynx;
|
|
|
+ juce::String result = "OK";
|
|
|
+ const auto check = [&] (const juce::String& what, bool ok, const juce::String& detail = {}) {
|
|
|
+ log << (ok ? "ok " : "FAIL ") << what << (detail.isNotEmpty() ? " (" + detail + ")" : juce::String()) << "\n";
|
|
|
+ if (! ok && result == "OK")
|
|
|
+ result = "ERROR " + what;
|
|
|
+ };
|
|
|
+
|
|
|
+ // ---- the project file and the copy for LYNX 0.1.32 (no UI)
|
|
|
+ {
|
|
|
+ auto s = Song::makeDefault();
|
|
|
+ s.mixer = Song::defaultMixer (3);
|
|
|
+ s.mixer[1].name = "Drums";
|
|
|
+ EffectSlot eq, delay;
|
|
|
+ eq.kind = EffectKind::eq;
|
|
|
+ delay.kind = EffectKind::delay;
|
|
|
+ delay.enabled = false;
|
|
|
+ s.mixer[1].effects.push_back (eq);
|
|
|
+ s.mixer[1].effects.push_back (delay);
|
|
|
+ const auto plainJson = ProjectFile::toJson (s);
|
|
|
+ check (".lynx: nothing written while the switch is on", ! plainJson.contains ("effectsOn"));
|
|
|
+ mixerops::setEffectsOn (s, 1, false);
|
|
|
+ const auto json = ProjectFile::toJson (s);
|
|
|
+ check (".lynx: \"effectsOn\": false on the insert", json.contains ("\"effectsOn\": false"));
|
|
|
+ juce::String error;
|
|
|
+ const auto back = ProjectFile::fromJson (json, error);
|
|
|
+ check (".lynx: read back, each slot's own switch kept", back && ! back->mixer[1].effectsOn && back->mixer[2].effectsOn
|
|
|
+ && back->mixer[1].effects.size() == 2 && back->mixer[1].effects[0].enabled
|
|
|
+ && ! back->mixer[1].effects[1].enabled,
|
|
|
+ error);
|
|
|
+ const auto copy = olderlynx::forRelease (json, "0.1.32");
|
|
|
+ int lines = 0;
|
|
|
+ for (const auto& l : copy.lost)
|
|
|
+ if (juce::String (l.text).startsWith ("Inserts with their effects switched off") && l.detail.contains ("Drums") && ! l.sound)
|
|
|
+ ++lines;
|
|
|
+ const auto reopened = copy.ok ? ProjectFile::fromJson (copy.json, error) : std::nullopt;
|
|
|
+ check ("the copy for 0.1.32: every slot of the insert off (the same sound), the key dropped, one view line",
|
|
|
+ copy.ok && lines == 1 && ! copy.json.contains ("effectsOn") && reopened && reopened->mixer[1].effectsOn
|
|
|
+ && reopened->mixer[1].effects.size() == 2 && ! mixerops::anyEffectEnabled (*reopened, 1),
|
|
|
+ juce::String (lines) + " line(s)");
|
|
|
+ check ("the copy for 0.1.27 too (every step after it)", olderlynx::forRelease (json, "0.1.27").ok);
|
|
|
+ const auto plainCopy = olderlynx::forRelease (plainJson, "0.1.32");
|
|
|
+ check ("no line for a project without it", std::none_of (plainCopy.lost.begin(), plainCopy.lost.end(), [] (const olderlynx::Loss& l) {
|
|
|
+ return juce::String (l.text).startsWith ("Inserts with their effects");
|
|
|
+ }));
|
|
|
+ }
|
|
|
+
|
|
|
+ // ---- an FL project with an insert's effects switched off (FL 2026's demo "LeriQ - SHINE": insert 12, its four
|
|
|
+ // effects with their own LEDs on, on, on, off; FL's mixer: the plug grey, raw a02 / a03)
|
|
|
+ std::optional<Song> shine;
|
|
|
+ {
|
|
|
+ const auto fl = juce::SystemStats::getEnvironmentVariable ("LYNX_FL_INSTALL", "");
|
|
|
+#if JUCE_WINDOWS
|
|
|
+ const juce::String installed = "C:\\Program Files\\Image-Line\\FL Studio 2026";
|
|
|
+#else
|
|
|
+ const juce::String installed = "/mnt/c/Program Files/Image-Line/FL Studio 2026";
|
|
|
+#endif
|
|
|
+ const auto file = juce::File (fl.isNotEmpty() ? fl : installed)
|
|
|
+ .getChildFile ("Data/Demo projects/Demo songs/LeriQ - SHINE.flp");
|
|
|
+ if (file.existsAsFile() && juce::SystemStats::getEnvironmentVariable ("LYNX_NO_FL", "").isEmpty())
|
|
|
+ {
|
|
|
+ juce::MemoryBlock bytes;
|
|
|
+ file.loadFileAsData (bytes);
|
|
|
+ const auto* data = static_cast<const std::uint8_t*> (bytes.getData());
|
|
|
+ shine = importFlp (flp::parseProject (std::vector<std::uint8_t> (data, data + bytes.getSize())));
|
|
|
+ int off = 0;
|
|
|
+ for (const auto& m : shine->mixer)
|
|
|
+ off += m.effectsOn ? 0 : 1;
|
|
|
+ const auto& fx = shine->mixer.size() > 12 ? shine->mixer[12].effects : CowVector<EffectSlot> {};
|
|
|
+ juce::String leds;
|
|
|
+ for (const auto& e : fx)
|
|
|
+ leds << (e.enabled ? "1" : "0");
|
|
|
+ check ("SHINE (FL demo): insert 12's effects switched off, the only one", shine->mixer.size() > 12 && ! shine->mixer[12].effectsOn && off == 1,
|
|
|
+ juce::String (off) + " off");
|
|
|
+ check ("SHINE: insert 12's slots keep their own switches (FL's LEDs: on, on, on, off)", leds == "1110", leds);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ log << " (FL Studio's SHINE demo not here: its import check skipped)\n";
|
|
|
+ }
|
|
|
+
|
|
|
+#if ! (JUCE_LINUX || JUCE_WINDOWS)
|
|
|
+ log << "the UI part skipped on this platform (the check pumps the message queue)\n";
|
|
|
+ return result;
|
|
|
+#else
|
|
|
+ const auto settle = [] (int ms) {
|
|
|
+ const auto end = juce::Time::getMillisecondCounter() + (juce::uint32) ms;
|
|
|
+ while (juce::Time::getMillisecondCounter() < end)
|
|
|
+ {
|
|
|
+ for (int i = 0; i < 256 && juce::detail::dispatchNextMessageOnSystemQueue (true); ++i) {}
|
|
|
+ juce::Thread::sleep (2);
|
|
|
+ }
|
|
|
+ };
|
|
|
+ const auto closeModals = [&settle] {
|
|
|
+ for (int k = 0; k < 20; ++k)
|
|
|
+ if (auto* modal = juce::Component::getCurrentlyModalComponent())
|
|
|
+ modal->exitModalState (0);
|
|
|
+ juce::PopupMenu::dismissAllActiveMenus();
|
|
|
+ settle (50);
|
|
|
+ };
|
|
|
+ const auto shotScale = (float) juce::jlimit (1.0, 3.0, juce::SystemStats::getEnvironmentVariable ("LYNX_SHOT_SCALE", "1").getDoubleValue());
|
|
|
+ const auto shotSuffix = juce::SystemStats::getEnvironmentVariable ("LYNX_SHOT_SUFFIX", "");
|
|
|
+ const auto shoot = [&] (juce::Component& c, juce::Rectangle<int> area, const juce::String& name) {
|
|
|
+ if (shots.isEmpty())
|
|
|
+ return;
|
|
|
+ const auto picture = c.createComponentSnapshot (area, true, shotScale);
|
|
|
+ const juce::File file (shots + "-" + name + shotSuffix + ".png");
|
|
|
+ file.deleteFile();
|
|
|
+ juce::FileOutputStream stream (file);
|
|
|
+ juce::PNGImageFormat().writeImageToStream (picture, stream);
|
|
|
+ };
|
|
|
+ const auto layoutBefore = layoutstyle::current();
|
|
|
+ layoutstyle::setCurrent (layoutstyle::Style::pattern);
|
|
|
+ const juce::ScopedValueSetter<bool> shown (ui::showingForShots(), true);
|
|
|
+
|
|
|
+ AudioEngine offline (false);
|
|
|
+ {
|
|
|
+ auto s = Song::makeDefault();
|
|
|
+ s.mixer = Song::defaultMixer (4);
|
|
|
+ for (const int t : { 1, 2 })
|
|
|
+ {
|
|
|
+ EffectSlot eq, delay;
|
|
|
+ eq.kind = EffectKind::eq;
|
|
|
+ delay.kind = EffectKind::delay;
|
|
|
+ delay.enabled = t != 1; // (insert 1: the second one off on its own)
|
|
|
+ s.mixer[(std::size_t) t].effects.push_back (eq);
|
|
|
+ s.mixer[(std::size_t) t].effects.push_back (delay);
|
|
|
+ }
|
|
|
+ offline.setSong (std::move (s));
|
|
|
+ }
|
|
|
+ MainComponent mainUi (offline, false);
|
|
|
+ mainUi.setSize (1600, 900);
|
|
|
+ closeModals();
|
|
|
+ mainUi.selectTabForSnapshot (3);
|
|
|
+ settle (60);
|
|
|
+ auto& mixer = mainUi.getMixerForSnapshot();
|
|
|
+ auto& strips = mixer.getStripsForSnapshot();
|
|
|
+ auto source = juce::Desktop::getInstance().getMainMouseSource();
|
|
|
+ const auto press = [&source] (juce::Component& c, juce::Point<int> p, juce::ModifierKeys mods) {
|
|
|
+ const auto now = juce::Time::getCurrentTime();
|
|
|
+ const juce::MouseEvent e (source, p.toFloat(), mods, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, &c, &c, now, p.toFloat(), now, 1, false);
|
|
|
+ c.mouseMove (e);
|
|
|
+ c.mouseDown (e);
|
|
|
+ c.mouseUp (e);
|
|
|
+ };
|
|
|
+ const juce::ModifierKeys left (juce::ModifierKeys::leftButtonModifier);
|
|
|
+ const auto slotsOf = [&offline] (int t) {
|
|
|
+ juce::String leds;
|
|
|
+ for (const auto& e : offline.getSong().mixer[(std::size_t) t].effects)
|
|
|
+ leds << (e.enabled ? "1" : "0");
|
|
|
+ return leds;
|
|
|
+ };
|
|
|
+
|
|
|
+ // ---- the strip's plug: FL's per-insert flag, one undo step named as FL's History ("enable/disable effect plugins")
|
|
|
+ strips.setLayout (mixerlayout::Layout::wide);
|
|
|
+ settle (30);
|
|
|
+ press (strips, strips.effectSlotsIconForSnapshot (1).getCentre(), left);
|
|
|
+ settle (30);
|
|
|
+ check ("the plug switches the insert's effects off, the slots keep their own switches (FL raw a03)",
|
|
|
+ ! offline.getSong().mixer[1].effectsOn && slotsOf (1) == "10", slotsOf (1));
|
|
|
+ const auto label = offline.getHistoryLabel (offline.getHistoryPosition());
|
|
|
+ const auto flName = undonames::inLayout (label.action, label.actionArg, layoutstyle::Style::pattern, false);
|
|
|
+ check ("one undo step, FL's name", offline.canUndo() && flName == "enable/disable effect plugins", juce::String (flName));
|
|
|
+ // the Effects panel's FX button drives the same flag
|
|
|
+ auto& panel = mixer.getEffectsForSnapshot();
|
|
|
+ panel.setTrack (1);
|
|
|
+ settle (30);
|
|
|
+ const auto fxButton = panel.fxSwitchForCheck();
|
|
|
+ check ("the Effects panel shows its FX button", ! fxButton.isEmpty() && panel.getWidth() > 0, fxButton.toString());
|
|
|
+ press (panel, fxButton.getCentre(), left);
|
|
|
+ settle (30);
|
|
|
+ check ("the Effects panel's FX button switches the same flag back on", offline.getSong().mixer[1].effectsOn && slotsOf (1) == "10", slotsOf (1));
|
|
|
+ press (panel, fxButton.getCentre(), left);
|
|
|
+ settle (30);
|
|
|
+ check ("... and off again", ! offline.getSong().mixer[1].effectsOn && slotsOf (1) == "10");
|
|
|
+ offline.undo();
|
|
|
+ settle (20);
|
|
|
+ check ("undo: on again, the slots as they were", offline.getSong().mixer[1].effectsOn && slotsOf (1) == "10");
|
|
|
+ offline.redo();
|
|
|
+ settle (20);
|
|
|
+ check ("redo: off", ! offline.getSong().mixer[1].effectsOn);
|
|
|
+
|
|
|
+ // ---- the Master's arm (FL 2026: "Arm disk recording" on the Master too, raw a09)
|
|
|
+ const auto masterArm = strips.armAreaForSnapshot (0);
|
|
|
+ check ("the Master has the arm under its clock", ! masterArm.isEmpty() && masterArm.getY() > strips.latencyIconForSnapshot (0).getY(),
|
|
|
+ masterArm.toString());
|
|
|
+ press (strips, masterArm.getCentre(), left);
|
|
|
+ settle (30);
|
|
|
+ const auto masterArmed = offline.isInsertArmed (0);
|
|
|
+ closeModals();
|
|
|
+ press (strips, masterArm.getCentre(), left);
|
|
|
+ settle (30);
|
|
|
+ closeModals();
|
|
|
+ check ("a click arms the Master, a second one disarms it", masterArmed && ! offline.isInsertArmed (0));
|
|
|
+
|
|
|
+ // ---- the Current column (FL raw a02 / a10): the plug (dim, inert) and the Current track's arm, in FL's rows
|
|
|
+ const auto curPlug = strips.currentPlugIconForSnapshot(), curArm = strips.currentArmAreaForSnapshot();
|
|
|
+ check ("Wide: the Current column has the plug and the arm in the Master's rows",
|
|
|
+ ! curPlug.isEmpty() && ! curArm.isEmpty() && curPlug.getY() == strips.effectSlotsIconForSnapshot (0).getY()
|
|
|
+ && curArm.getY() == masterArm.getY() && curPlug.getRight() <= strips.effectSlotsIconForSnapshot (0).getX(),
|
|
|
+ curPlug.toString() + " / " + curArm.toString());
|
|
|
+ const auto historyBefore = offline.getHistorySize();
|
|
|
+ press (strips, curPlug.getCentre(), left);
|
|
|
+ settle (30);
|
|
|
+ check ("the Current column's plug switches nothing (FL: no History step, raw a05)", offline.getHistorySize() == historyBefore);
|
|
|
+ press (strips, curArm.getCentre(), left);
|
|
|
+ settle (30);
|
|
|
+ const auto current = mixerops::currentTrack (offline.getSong());
|
|
|
+ const auto currentArmed = current > 0 && offline.isInsertArmed (current);
|
|
|
+ closeModals();
|
|
|
+ if (current > 0)
|
|
|
+ press (strips, strips.currentArmAreaForSnapshot().getCentre(), left);
|
|
|
+ settle (30);
|
|
|
+ closeModals();
|
|
|
+ check ("its arm arms the Current track (made at the first click), again: disarmed", currentArmed && ! offline.isInsertArmed (current),
|
|
|
+ juce::String (current));
|
|
|
+ if (shots.isNotEmpty())
|
|
|
+ shoot (strips, strips.getLocalBounds().withWidth (juce::jmin (strips.getWidth(), 900)), "mixer-wide");
|
|
|
+
|
|
|
+ // ---- Extra large (FL raw a12): latency and arm under the fader, the slots' names, the plug, the route arrow; the
|
|
|
+ // Current column: the plug only; an insert whose effects are off: its names dimmed, no darker cells
|
|
|
+ strips.setLayout (mixerlayout::Layout::extraLarge);
|
|
|
+ settle (40);
|
|
|
+ {
|
|
|
+ const auto clock = strips.latencyIconForSnapshot (1), arm = strips.armAreaForSnapshot (1), plug = strips.effectSlotsIconForSnapshot (1);
|
|
|
+ const auto list = strips.insertsAreaForSnapshot (1);
|
|
|
+ check ("Extra large: latency, arm, the slots' names, then the plug (FL's places)",
|
|
|
+ ! list.isEmpty() && clock.getY() < arm.getY() && arm.getBottom() <= list.getY() + 1 && list.getBottom() <= plug.getY() + 1,
|
|
|
+ clock.toString() + " / " + arm.toString() + " / " + list.toString() + " / " + plug.toString());
|
|
|
+ check ("Extra large: the Current column has the plug only", strips.currentArmAreaForSnapshot().isEmpty()
|
|
|
+ && strips.currentPlugIconForSnapshot().getY() == plug.getY());
|
|
|
+ const auto picture = strips.createComponentSnapshot (strips.getLocalBounds(), true, 1.0f);
|
|
|
+ const auto brightest = [&picture] (juce::Rectangle<int> r) {
|
|
|
+ float best = 0.0f;
|
|
|
+ for (int y = r.getY(); y < r.getBottom(); ++y)
|
|
|
+ for (int x = r.getX(); x < r.getRight(); ++x)
|
|
|
+ best = juce::jmax (best, picture.getPixelAt (x, y).getBrightness());
|
|
|
+ return best;
|
|
|
+ };
|
|
|
+ const auto row = [&strips] (int t) { const auto a = strips.insertsAreaForSnapshot (t); return a.withHeight (juce::jmin (a.getHeight(), 22)); };
|
|
|
+ const auto off = brightest (row (1)), on = brightest (row (2));
|
|
|
+ check ("Extra large: the switched-off insert's names dimmed (FL)", on > 0.5f && off < on * 0.8f,
|
|
|
+ juce::String (off, 3) + " vs " + juce::String (on, 3));
|
|
|
+ if (shots.isNotEmpty())
|
|
|
+ shoot (strips, strips.getLocalBounds().withWidth (juce::jmin (strips.getWidth(), 900)), "mixer-xl");
|
|
|
+ }
|
|
|
+
|
|
|
+ // ---- the shots beside FL's (SHINE in Wide and Extra large; FL raw a02 / a12)
|
|
|
+ if (shine && shots.isNotEmpty())
|
|
|
+ {
|
|
|
+ offline.setSong (std::move (*shine));
|
|
|
+ settle (200);
|
|
|
+ strips.setLayout (mixerlayout::Layout::wide);
|
|
|
+ settle (60);
|
|
|
+ shoot (strips, strips.getLocalBounds(), "shine-wide");
|
|
|
+ strips.setLayout (mixerlayout::Layout::extraLarge);
|
|
|
+ settle (60);
|
|
|
+ shoot (strips, strips.getLocalBounds(), "shine-xl");
|
|
|
+ strips.setLayout (mixerlayout::Layout::wide);
|
|
|
+ settle (30);
|
|
|
+ }
|
|
|
+
|
|
|
+ strips.setLayout (mixerlayout::Layout::wide);
|
|
|
+ closeModals();
|
|
|
+ layoutstyle::setCurrent (layoutBefore);
|
|
|
+ return result;
|
|
|
+#endif
|
|
|
+ }
|