IssuesShot190nq.inc 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460
  1. // --issuesshot190nq <prefix> (round 190nq, issues #193, #225, #226, #227, #228, #229, #230), offscreen through the real
  2. // components: a narrow Channel rack's title bar, the Mixer's Left / Right, the action search ("?"), FL's "Show fade
  3. // previews", the ruler click with every tool (LYNX extra), an automation clip whose insert was deleted, and (with
  4. // LYNX_193_ALS=<set.als>) issue #193's Live set as LYNX opens it. <prefix>-checks.txt lists the checks; pictures @100
  5. // and @150. Included in the app class of Main.cpp.
  6. bool runIssuesShot190nq (const juce::String& prefix)
  7. {
  8. juce::LookAndFeel::setDefaultLookAndFeel (&lookAndFeel);
  9. const juce::ScopedValueSetter<bool> shown (lynx::ui::showingForShots(), true);
  10. juce::String checks;
  11. bool allOk = true;
  12. const auto check = [&checks, &allOk] (const juce::String& what, bool ok) {
  13. checks << (ok ? "ok " : "FAIL ") << what << "\n";
  14. allOk = allOk && ok;
  15. };
  16. const auto line = [&checks] (const juce::String& what) { checks << " " << what << "\n"; };
  17. const auto write = [&prefix] (juce::Component& c, juce::Rectangle<int> area, const juce::String& name) {
  18. area = area.getIntersection (c.getLocalBounds());
  19. if (area.isEmpty())
  20. return;
  21. savePng (c.createComponentSnapshot (area, true, 1.0f), prefix + "-" + name + ".png");
  22. savePng (c.createComponentSnapshot (area, true, 1.5f), prefix + "-" + name + "@150.png");
  23. };
  24. using namespace lynx;
  25. using workspace::Panel;
  26. ui::motion::enabled() = false;
  27. layoutstyle::setCurrent (layoutstyle::Style::pattern);
  28. const auto bar = (std::int64_t) 4 * ppq;
  29. // a test sound: 4 s of a decaying 220 Hz tone, pulsed every half second (a waveform with shape)
  30. const auto wav = juce::File::getSpecialLocation (juce::File::tempDirectory).getChildFile ("lynx190nq-fade.wav");
  31. {
  32. wav.deleteFile();
  33. juce::WavAudioFormat format;
  34. std::unique_ptr<juce::OutputStream> out (wav.createOutputStream().release());
  35. std::unique_ptr<juce::AudioFormatWriter> writer (format.createWriterFor (out.get(), 44100.0, 1, 16, {}, 0));
  36. if (writer != nullptr)
  37. {
  38. out.release();
  39. juce::AudioBuffer<float> b (1, 44100 * 4);
  40. for (int i = 0; i < b.getNumSamples(); ++i)
  41. {
  42. const auto t = (double) (i % 22050) / 44100.0;
  43. b.setSample (0, i, (float) (0.8 * std::exp (-t * 6.0) * std::sin (2.0 * juce::MathConstants<double>::pi * 220.0 * (double) i / 44100.0)));
  44. }
  45. writer->writeFromAudioSampleBuffer (b, 0, b.getNumSamples());
  46. }
  47. }
  48. AudioEngine engine (false);
  49. {
  50. auto song = Song::makeDefault();
  51. song.playlist.clear();
  52. song.mixer.resize (std::max<std::size_t> (song.mixer.size(), 12)); // (std::max: juce::jmax<std::size_t> instantiates juce::dsp::SIMDRegister on macOS arm64)
  53. song.mixer[1].name = "BEAT BUS";
  54. song.mixer[2].name = "VERB";
  55. song.mixer[1].sends.push_back ({ 2, 0.5f });
  56. ChannelDef vox;
  57. vox.name = "Vocal";
  58. vox.instrument = InstrumentKind::audioClip;
  59. vox.samplePath = wav.getFullPathName().toStdString();
  60. song.channels.push_back (vox);
  61. song.playlistTracks.resize (12);
  62. Clip take;
  63. take.kind = ClipKind::audio;
  64. take.channel = (int) song.channels.size() - 1;
  65. take.track = 0;
  66. take.start = 0;
  67. take.length = 2 * bar; // (the 4 s sound at 120 BPM)
  68. take.fadeIn = bar / 4;
  69. take.fadeOut = bar;
  70. song.playlist.push_back (take);
  71. Automation send;
  72. send.name = "BEAT BUS \xe2\x86\x92 VERB - Send level";
  73. send.target = { AutomationTargetKind::mixerSend, 1, 2, 0 };
  74. send.points = { { 0, 0.1f, 0.0f }, { 2 * bar, 0.9f, 0.0f }, { 4 * bar, 0.3f, 0.0f } };
  75. song.automations.push_back (send);
  76. Clip a;
  77. a.kind = ClipKind::automation;
  78. a.automation = 0;
  79. a.track = 2;
  80. a.start = 0;
  81. a.length = 4 * bar;
  82. song.playlist.push_back (a);
  83. engine.setSong (std::move (song));
  84. }
  85. MainComponent ui (engine, false);
  86. ui.setSize (1600, 900);
  87. engine.dispatchPendingMessages();
  88. auto& ws = ui.workspaceForTest();
  89. // ================= #229: a narrow Channel rack =================
  90. {
  91. ui.showPanelsForSnapshot ({ Panel::channelRack });
  92. ws.show (Panel::channelRack);
  93. auto& frame = ws.getFrame (Panel::channelRack);
  94. for (const auto width : { 760, 560, 470, 330 })
  95. {
  96. frame.setSize (width, 300);
  97. engine.dispatchPendingMessages();
  98. // the buttons at the right of the title bar, and every visible title tool's right edge
  99. int buttonsLeft = width;
  100. for (auto* c : frame.getChildren())
  101. if (auto* b = dynamic_cast<juce::Button*> (c); b != nullptr && b->isVisible() && c->getY() < Workspace::titleHeight && c->getX() > width / 2)
  102. buttonsLeft = juce::jmin (buttonsLeft, c->getX());
  103. int toolsRight = 0, hidden = 0, toolCount = 0;
  104. juce::Component* tools = nullptr;
  105. for (auto* c : frame.getChildren())
  106. if (c->getNumChildComponents() >= 8 && c->getY() <= 2) // (the rack's title tools)
  107. tools = c;
  108. if (tools != nullptr)
  109. for (auto* t : tools->getChildren())
  110. {
  111. ++toolCount;
  112. if (t->isVisible())
  113. toolsRight = juce::jmax (toolsRight, tools->getX() + t->getRight());
  114. else
  115. ++hidden;
  116. }
  117. check ("Channel rack " + juce::String (width) + " px wide: no title tool under the buttons (tools end at " + juce::String (toolsRight)
  118. + ", buttons start at " + juce::String (buttonsLeft) + ", " + juce::String (hidden) + " of " + juce::String (toolCount) + " hidden)",
  119. tools != nullptr && toolsRight <= buttonsLeft);
  120. write (frame, { 0, 0, width, Workspace::titleHeight + 40 }, "229-rack-" + juce::String (width));
  121. }
  122. frame.setSize (760, 300);
  123. }
  124. // ================= #225: Left / Right in the Mixer =================
  125. {
  126. ui.showPanelsForSnapshot ({ Panel::mixer });
  127. ws.show (Panel::mixer);
  128. ws.activate (Panel::mixer);
  129. auto& mixer = ui.getMixerForSnapshot();
  130. mixer.selectTrack (3);
  131. const auto key = [&] (int code, juce::ModifierKeys mods = {}) { ui.keyPressed (juce::KeyPress (code, mods, 0)); engine.dispatchPendingMessages(); };
  132. key (juce::KeyPress::rightKey);
  133. check ("Mixer: Right selects the next insert (3 -> 4)", mixer.getSelectedTrack() == 4);
  134. key (juce::KeyPress::leftKey);
  135. key (juce::KeyPress::leftKey);
  136. check ("Left, Left -> 2", mixer.getSelectedTrack() == 2);
  137. key (juce::KeyPress::rightKey, juce::ModifierKeys::ctrlModifier);
  138. check ("Ctrl+Right -> 3 (FL)", mixer.getSelectedTrack() == 3);
  139. key (juce::KeyPress::rightKey, juce::ModifierKeys::shiftModifier);
  140. check ("Shift+Right -> 4, one track selected (FL)", mixer.getSelectedTrack() == 4 && mixer.getStripsForSnapshot().getSelection().size() == 1);
  141. const auto names = [&] { juce::String s; for (int t = 1; t < 6; ++t) s << engine.getSong().mixer[(std::size_t) t].name << ","; return s; };
  142. const auto before = names();
  143. key (juce::KeyPress::rightKey);
  144. check ("selecting moves nothing", names() == before && mixer.getSelectedTrack() == 5);
  145. mixer.selectTrack (0);
  146. key (juce::KeyPress::leftKey);
  147. check ("Left on the Master stays there", mixer.getSelectedTrack() == 0);
  148. key (juce::KeyPress::rightKey, juce::ModifierKeys::altModifier); // (Alt still moves: from the Master nothing happens)
  149. mixer.selectTrack (4);
  150. write (ws.getFrame (Panel::mixer), { 0, 0, juce::jmin (1000, ws.getFrame (Panel::mixer).getWidth()), 240 }, "225-mixer-4");
  151. key (juce::KeyPress::rightKey);
  152. write (ws.getFrame (Panel::mixer), { 0, 0, juce::jmin (1000, ws.getFrame (Panel::mixer).getWidth()), 240 }, "225-mixer-5");
  153. }
  154. // ================= #228: the action search =================
  155. {
  156. ui.showPanelsForSnapshot ({ Panel::playlist });
  157. ws.activate (Panel::playlist);
  158. ui.keyPressed (juce::KeyPress ('/', juce::ModifierKeys::shiftModifier, '?'));
  159. engine.dispatchPendingMessages();
  160. auto* search = ui.actionSearchForSnapshot();
  161. check ("? opens the action search (Pattern layout)", search != nullptr && search->isVisible());
  162. if (search != nullptr)
  163. {
  164. const auto all = search->matchCount();
  165. line ("actions listed: " + juce::String (all));
  166. // (round 190on: the command palette lists the menus, extras, settings and recent projects too)
  167. check ("every action of the key map is listed", all >= (int) keys::actions().size());
  168. write (ui, ui.getLocalBounds(), "228-search-all");
  169. search->setQuery ("metro");
  170. line ("\"metro\": " + juce::String (search->matchCount()) + " actions, first " + juce::String (search->selectedId()));
  171. check ("\"metro\" finds the metronome actions", search->matchCount() >= 1 && juce::String (search->selectedId()).containsIgnoreCase ("metronome"));
  172. write (ui, ui.getLocalBounds(), "228-search-metro");
  173. search->setQuery ("next mixer");
  174. check ("\"next mixer\": Select the next mixer track first", search->selectedId() == "mixer.selectNext");
  175. auto& mixer = ui.getMixerForSnapshot();
  176. mixer.selectTrack (6);
  177. const auto ran = search->runSelected();
  178. engine.dispatchPendingMessages();
  179. // (the box goes away on the next message loop turn: it is hidden at once)
  180. check ("Enter runs it (insert 6 -> 7) and closes the search", ran && mixer.getSelectedTrack() == 7
  181. && (ui.actionSearchForSnapshot() == nullptr || ! ui.actionSearchForSnapshot()->isVisible()));
  182. }
  183. }
  184. // ================= #230: FL's "Show fade previews" =================
  185. {
  186. ui.showPanelsForSnapshot ({ Panel::playlist });
  187. ui.selectTabForSnapshot (2);
  188. engine.dispatchPendingMessages();
  189. auto& pl = ui.getPlaylistForSnapshot();
  190. pl.setSize (juce::jmax (pl.getWidth(), 1100), juce::jmax (pl.getHeight(), 500));
  191. pl.setViewForSnapshot (220.0, 0, 0);
  192. ui::WaveformCache::getInstance()->find (wav.getFullPathName(), [&engine, &wav] { return engine.getSampleLibrary().load (wav.getFullPathName()); });
  193. ui::WaveformCache::getInstance()->waitUntilIdle (20000);
  194. pl.repaint();
  195. engine.dispatchPendingMessages();
  196. const auto row = pl.trackRowForSnapshot (0);
  197. const auto x0 = (int) std::lround (pl.xOfTickForSnapshot (0.0)), x1 = (int) std::lround (pl.xOfTickForSnapshot ((double) (2 * bar)));
  198. const auto area = juce::Rectangle<int> (0, 0, juce::jmin (pl.getWidth(), x1 + 60), row.getBottom() + 4);
  199. check ("FL's default: Show fade previews on", PlaylistComponent::showFadePreviews);
  200. const auto on = pl.createComponentSnapshot (area, true, 1.0f);
  201. write (pl, area, "230-fade-preview-on");
  202. PlaylistComponent::showFadePreviews = false;
  203. pl.repaint();
  204. const auto off = pl.createComponentSnapshot (area, true, 1.0f);
  205. write (pl, area, "230-fade-preview-off");
  206. PlaylistComponent::showFadePreviews = true;
  207. pl.repaint();
  208. // the pictures differ inside the fades only (the middle of the clip is the same)
  209. const auto differs = [&] (int from, int to) {
  210. int n = 0;
  211. for (int x = juce::jmax (0, from); x < juce::jmin (area.getWidth(), to); ++x)
  212. for (int y = row.getY() + 2; y < row.getBottom() - 2; ++y)
  213. n += on.getPixelAt (x, y) != off.getPixelAt (x, y) ? 1 : 0;
  214. return n;
  215. };
  216. const auto inEnd = (int) std::lround (pl.xOfTickForSnapshot ((double) (bar / 4))), outStart = (int) std::lround (pl.xOfTickForSnapshot ((double) bar));
  217. const auto inFade = differs (x0 + 2, inEnd - 2), middle = differs (inEnd + 3, outStart - 3), outFade = differs (outStart + 2, x1 - 2);
  218. line ("pixels that change with the option: fade in " + juce::String (inFade) + ", middle " + juce::String (middle) + ", fade out " + juce::String (outFade));
  219. check ("the waveform follows the fades (it changes under the fades, nowhere else)", inFade > 20 && outFade > 50 && middle == 0);
  220. // the View menu has FL's item
  221. auto menu = ui.getPanelMenuForSnapshot (Panel::playlist);
  222. bool listed = false;
  223. std::function<void (const juce::PopupMenu&)> walk = [&] (const juce::PopupMenu& m) {
  224. for (juce::PopupMenu::MenuItemIterator it (m); it.next();)
  225. {
  226. listed = listed || (it.getItem().text == tr ("Show fade previews") && it.getItem().isTicked);
  227. if (it.getItem().subMenu != nullptr)
  228. walk (*it.getItem().subMenu);
  229. }
  230. };
  231. walk (menu);
  232. check ("Playlist menu › View › Show fade previews, ticked", listed);
  233. // ================= #227: a click on the ruler with the Select tool =================
  234. auto source = juce::Desktop::getInstance().getMainMouseSource();
  235. const auto now = juce::Time::getCurrentTime();
  236. const auto rulerY = PlaylistComponent::rulerTop + PlaylistComponent::timelineHeight / 2;
  237. const auto click = [&] (int x) {
  238. const juce::Point<float> p ((float) x, (float) rulerY);
  239. const juce::ModifierKeys left (juce::ModifierKeys::leftButtonModifier);
  240. pl.mouseDown (juce::MouseEvent (source, p, left, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, &pl, &pl, now, p, now, 1, false));
  241. pl.mouseUp (juce::MouseEvent (source, p, {}, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, &pl, &pl, now, p, now, 1, false));
  242. engine.dispatchPendingMessages();
  243. return (std::int64_t) std::llround (pl.playheadTickForSnapshot());
  244. };
  245. pl.setToolForSnapshot (EditTool::pencil);
  246. const auto x2 = (int) std::lround (pl.xOfTickForSnapshot ((double) (2 * bar)));
  247. const auto x3 = (int) std::lround (pl.xOfTickForSnapshot ((double) (3 * bar)));
  248. const auto drawTool = click (x2);
  249. line ("Draw tool: ruler click at bar 3 -> tick " + juce::String (drawTool));
  250. pl.setToolForSnapshot (EditTool::lasso);
  251. const auto selectOff = click (x3);
  252. check ("Select tool, extra off (FL): the song position stays", selectOff == drawTool && drawTool > 0);
  253. workflowextras::setExtra ("playlist.rulerSeeksAnyTool", true);
  254. const auto selectOn = click (x3);
  255. check ("Select tool, extra on: the song position moves to the click", selectOn > drawTool);
  256. workflowextras::setExtra ("playlist.rulerSeeksAnyTool", false);
  257. pl.setToolForSnapshot (EditTool::pencil);
  258. check ("the extra is saved with the UI options", workflowextras::uiOptionsText().contains ("rulerSeeksAnyTool=0"));
  259. auto page = makeExtrasPage (engine, {}, false);
  260. page->setSize (680, 4200);
  261. juce::Component* found = nullptr;
  262. std::function<void (juce::Component&)> find = [&] (juce::Component& c) {
  263. if (auto* b = dynamic_cast<juce::ToggleButton*> (&c); b != nullptr && b->getButtonText() == tr ("A click on the ruler moves the song position with every tool"))
  264. found = b;
  265. for (auto* child : c.getChildren())
  266. find (*child);
  267. };
  268. find (*page);
  269. check ("Settings › LYNX extras lists it, off", found != nullptr && ! dynamic_cast<juce::ToggleButton*> (found)->getToggleState());
  270. if (found != nullptr)
  271. {
  272. const auto r = page->getLocalArea (found, found->getLocalBounds());
  273. write (*page, juce::Rectangle<int> (0, r.getY() - 40, page->getWidth(), 120), "227-extras");
  274. }
  275. // ================= #226: the automation of a deleted insert =================
  276. const auto clipArea = juce::Rectangle<int> (0, pl.trackRowForSnapshot (2).getY() - 2, juce::jmin (pl.getWidth(), x1 + 60), pl.trackRowForSnapshot (2).getHeight() + 4);
  277. write (pl, clipArea, "226-before");
  278. engine.editSongStructural ([] (Song& s) { mixerops::deleteTrack (s, 2); });
  279. engine.dispatchPendingMessages();
  280. pl.repaint();
  281. const auto& a = engine.getSong().automations.front();
  282. check ("deleting VERB: the send's clip controls nothing and says so (\"" + juce::String::fromUTF8 (a.name.c_str()) + "\")",
  283. a.target.kind == AutomationTargetKind::none && juce::String::fromUTF8 (a.name.c_str()).endsWith ("(target deleted)"));
  284. write (pl, clipArea, "226-after");
  285. engine.undo();
  286. engine.dispatchPendingMessages();
  287. check ("undo brings the track and the clip's target and name back",
  288. engine.getSong().mixer[2].name == "VERB" && engine.getSong().automations.front().target.kind == AutomationTargetKind::mixerSend
  289. && ! juce::String::fromUTF8 (engine.getSong().automations.front().name.c_str()).contains ("deleted"));
  290. }
  291. // ================= #218 follow-up: Enter with the Browser focused =================
  292. {
  293. ui.showPanelsForSnapshot ({ Panel::playlist, Panel::browser });
  294. ws.show (Panel::browser);
  295. auto& browser = ui.getBrowserForSnapshot();
  296. browser.waitForListing (5000);
  297. // a click inside the Browser (its tree) focuses the Browser panel, as FL's window
  298. auto& frame = ws.getFrame (Panel::browser);
  299. juce::Component* inside = &browser;
  300. while (inside->getNumChildComponents() > 0 && inside->getChildComponent (0)->isVisible())
  301. inside = inside->getChildComponent (0);
  302. auto source = juce::Desktop::getInstance().getMainMouseSource();
  303. const auto now = juce::Time::getCurrentTime();
  304. const auto p = juce::Point<float> (6.0f, 6.0f);
  305. ws.activate (Panel::playlist);
  306. frame.mouseDown (juce::MouseEvent (source, p, juce::ModifierKeys (juce::ModifierKeys::leftButtonModifier), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, inside, inside, now, p, now, 1, false));
  307. check ("a click in the docked Browser makes it the focused panel", ws.getFocused() == Panel::browser);
  308. line ("Browser selection: " + browser.getSelectedFile().getFullPathName() + " (row " + juce::String (browser.selectedRowForSnapshot()) + ")");
  309. const auto maxBefore = ws.isMaximised (Panel::playlist);
  310. const auto rowsBefore = browser.rowCountForSnapshot();
  311. browser.selectRowIndexForSnapshot (0); // "Current project", a folder
  312. const auto open = browser.rowCountForSnapshot();
  313. ui.keyPressed (juce::KeyPress (juce::KeyPress::returnKey));
  314. engine.dispatchPendingMessages();
  315. const auto afterFirst = browser.rowCountForSnapshot();
  316. ui.keyPressed (juce::KeyPress (juce::KeyPress::returnKey));
  317. engine.dispatchPendingMessages();
  318. const auto afterSecond = browser.rowCountForSnapshot();
  319. line ("Browser rows: " + juce::String (rowsBefore) + ", selected folder: " + juce::String (open) + ", Enter: " + juce::String (afterFirst) + ", Enter: " + juce::String (afterSecond));
  320. check ("Enter in the Browser opens / closes the selected folder (FL 2026)", afterFirst != open && afterSecond == open);
  321. check ("Enter in the Browser leaves the Playlist as it was (not maximised / restored)", ws.isMaximised (Panel::playlist) == maxBefore);
  322. ws.activate (Panel::playlist);
  323. ui.keyPressed (juce::KeyPress (juce::KeyPress::returnKey));
  324. check ("Enter with the Playlist focused still maximises / restores it (FL)", ws.isMaximised (Panel::playlist) != maxBefore);
  325. ui.keyPressed (juce::KeyPress (juce::KeyPress::returnKey));
  326. write (ws.getFrame (Panel::browser), ws.getFrame (Panel::browser).getLocalBounds().withHeight (300), "218-browser");
  327. }
  328. // ================= #222 follow-up: the big track icon with the insert effects column =================
  329. {
  330. AudioEngine e2 (false);
  331. {
  332. auto song = Song::makeDefault();
  333. song.linkTracksToMixer = true;
  334. song.playlistTracks.resize (6);
  335. for (int t = 0; t < 3; ++t)
  336. {
  337. auto& tr = song.playlistTracks[(std::size_t) t];
  338. tr.mode = PlaylistTrackMode::audio;
  339. tr.mixerTrack = t + 1;
  340. tr.icon = 5; // FL's kick icon
  341. tr.height = 112;
  342. tr.name = "Drums " + std::to_string (t + 1);
  343. }
  344. e2.setSong (std::move (song));
  345. }
  346. MainComponent u2 (e2, false);
  347. u2.setSize (1600, 900);
  348. u2.showPanelsForSnapshot ({ Panel::playlist });
  349. u2.selectTabForSnapshot (2);
  350. e2.dispatchPendingMessages();
  351. auto& pl = u2.getPlaylistForSnapshot();
  352. pl.setSize (juce::jmax (pl.getWidth(), 1100), juce::jmax (pl.getHeight(), 500));
  353. for (const auto inserts : { false, true })
  354. {
  355. if (PlaylistComponent::showTrackInserts != inserts)
  356. u2.runActionForSnapshot ("playlist.trackInserts");
  357. e2.dispatchPendingMessages();
  358. const auto header = pl.headerWidthForSnapshot();
  359. write (pl, { 0, pl.trackRowForSnapshot (0).getY(), header + 4, pl.trackRowForSnapshot (1).getBottom() - pl.trackRowForSnapshot (0).getY() },
  360. inserts ? "222-icon-inserts" : "222-icon-plain");
  361. line ("header width " + juce::String (header) + (inserts ? " with" : " without") + " the insert effects column");
  362. }
  363. u2.runActionForSnapshot ("playlist.trackInserts");
  364. }
  365. // ================= Discord 11-18: the Missing files window of a project that is not from FL =================
  366. for (const auto fromFl : { true, false })
  367. {
  368. MissingFilesInfo info;
  369. info.projectName = fromFl ? "Imported.flp" : "try_lynx_its_cool";
  370. info.fromFlStudio = fromFl;
  371. info.plugins = { MissingPlugin { "TR5 Saturator X", { "Master" }, "Nothing: the slot keeps the plugin's settings until it is installed", {} } };
  372. auto panel = makeMissingFilesPanel (info, 1);
  373. panel->setSize (760, 420);
  374. juce::String text;
  375. std::function<void (juce::Component&)> walk = [&] (juce::Component& c) {
  376. if (auto* l = dynamic_cast<juce::Label*> (&c))
  377. text << l->getText() << "\n";
  378. for (auto* child : c.getChildren())
  379. walk (*child);
  380. };
  381. walk (*panel);
  382. const auto says = text.contains ("as in FL Studio");
  383. check (fromFl ? "Missing files, an FL project: \"will not sound as in FL Studio\" (as before)" : "Missing files, a LYNX project: no \"as in FL Studio\"",
  384. fromFl ? says : ! says && text.contains ("when the project was saved"));
  385. write (*panel, panel->getLocalBounds().withHeight (140), fromFl ? "d1120-missing-flp" : "d1120-missing-lynx");
  386. }
  387. // ================= #193: the reporter's Live set =================
  388. // (and with LYNX_PROJECT_190NQ=<file>: any other project the same way, Discord 11-18's .lynx, tag "d1120")
  389. for (const auto& [als, tag] : { std::pair { juce::File (juce::SystemStats::getEnvironmentVariable ("LYNX_193_ALS", {})), juce::String ("193") },
  390. std::pair { juce::File (juce::SystemStats::getEnvironmentVariable ("LYNX_PROJECT_190NQ", {})), juce::String ("d1120") } })
  391. {
  392. if (! als.existsAsFile())
  393. continue;
  394. AudioEngine liveEngine (false);
  395. MainComponent live (liveEngine, false);
  396. live.setSize (1920, 1080);
  397. live.openFile (als);
  398. liveEngine.dispatchPendingMessages();
  399. ui::WaveformCache::getInstance()->waitUntilIdle (60000);
  400. const auto& s = liveEngine.getSong();
  401. line (tag + ": tempo " + juce::String (s.bpm, 2) + ", " + juce::String ((int) s.playlistTracks.size()) + " Playlist tracks, " + juce::String ((int) s.playlist.size())
  402. + " clips, " + juce::String ((int) s.automations.size()) + " automations, " + juce::String ((int) s.videoTracks.size()) + " video tracks");
  403. for (const auto& v : s.videoTracks)
  404. for (const auto& c : v.clips)
  405. line (tag + " video clip: start " + juce::String (c.start, 3) + " s, file offset " + juce::String (c.offset, 3) + " s, length " + juce::String (c.length, 3)
  406. + " s, file " + juce::String (c.duration, 3) + " s: " + juce::File (juce::String::fromUTF8 (c.path.c_str())).getFileName());
  407. for (const auto& a : s.automations)
  408. line (tag + " automation: " + juce::String::fromUTF8 (a.name.c_str()) + " (" + juce::String ((int) a.points.size()) + " points)");
  409. const auto& report = liveEngine.getImportReport();
  410. for (const auto* group : { &report.notReproduced, &report.approximated, &report.unsupported, &report.droppedEffects, &report.partialEffects })
  411. for (const auto& [what, count] : *group)
  412. line (tag + " report: " + juce::String::fromUTF8 (what.c_str()) + " x" + juce::String (count));
  413. if (tag == "193")
  414. check ("193: the set opens with its video track", ! s.videoTracks.empty());
  415. line (tag + ": missing samples " + juce::String (report.missingSamples));
  416. live.showPanelsForSnapshot ({ Panel::playlist });
  417. live.selectTabForSnapshot (2);
  418. liveEngine.dispatchPendingMessages();
  419. savePng (live.createComponentSnapshot (live.getLocalBounds(), true, 1.0f), prefix + "-" + tag + "-set.png");
  420. auto& pl = live.getPlaylistForSnapshot();
  421. // (rollup 0.1.31 step 3: the settle step waits for the video lanes' thumbnails too, as for the waveforms: under load
  422. // they were still arriving when the scroll's pictures were taken, 547-12 484 px apart; after both, a few px)
  423. const auto settle = [&live, &liveEngine] {
  424. ui::WaveformCache::getInstance()->waitUntilIdle (60000);
  425. live.createComponentSnapshot (live.getLocalBounds(), true, 1.0f); // (a paint asks for the strips it shows)
  426. VideoLanesView::waitForThumbnails (60000);
  427. liveEngine.dispatchPendingMessages();
  428. };
  429. settle();
  430. const auto cache = pl.cacheSelfTest (settle, juce::File (prefix).getParentDirectory());
  431. // (the video lanes' thumbnails arrive in the background, so a picture taken while they come in differs there; the
  432. // scroll is what #193 is about: the old shift area moved the pinned lanes, ~190 000 px off on this set)
  433. int scrollOff = -1;
  434. for (const auto& l : juce::StringArray::fromLines (cache))
  435. if (l.startsWith ("scroll down"))
  436. scrollOff = l.contains (": match") ? 0 : l.fromFirstOccurrenceOf ("MISMATCH, ", false, false).getIntValue();
  437. check (tag + ": after a scroll down the cached picture matches an exact paint (under 100 px apart; " + juce::String (scrollOff) + ")",
  438. scrollOff < 0 || scrollOff < 100);
  439. for (const auto& l : juce::StringArray::fromLines (cache))
  440. if (l.contains ("scroll") || l.contains ("MISMATCH") || l.contains ("result="))
  441. line (tag + " cachetest: " + l);
  442. }
  443. wav.deleteFile();
  444. checks << "result=" << (allOk ? "OK" : "FAIL") << "\n";
  445. juce::File (prefix + "-checks.txt").replaceWithText (checks);
  446. return allOk;
  447. }