DetailsShot190mf.inc 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. // --details190mfshot <prefix> <project.flp> (round 190mf, details pass 5): FL's normal meter law as the Pattern
  2. // layout's default mixer meter scale (the Clip-launch / Simple straight axis and FL's alternate law beside it), Gross
  3. // Beat's Step / Slide / Freeze switches and its mapping options menu. <prefix>-checks.txt lists the checks. Included
  4. // in the app class of Main.cpp.
  5. bool runDetailsShot190mf (const juce::String& prefix, const juce::String& project)
  6. {
  7. juce::LookAndFeel::setDefaultLookAndFeel (&lookAndFeel);
  8. const juce::ScopedValueSetter<bool> shown (lynx::ui::showingForShots(), true);
  9. juce::String checks;
  10. bool allOk = true;
  11. const auto check = [&checks, &allOk] (const juce::String& what, bool ok) {
  12. checks << (ok ? "ok " : "FAIL ") << what << "\n";
  13. allOk = allOk && ok;
  14. };
  15. const auto line = [&checks] (const juce::String& what) { checks << " " << what << "\n"; };
  16. const auto write = [&prefix] (juce::Component& c, const juce::String& name) { savePng (lynx::shot::snapshot (c), prefix + "-" + name + ".png"); };
  17. const auto zoomShot = [&prefix] (juce::Component& c, juce::Rectangle<int> r, float k, const juce::String& name) {
  18. savePng (c.createComponentSnapshot (r.getIntersection (c.getLocalBounds()), true, k), prefix + "-" + name + ".png");
  19. };
  20. using namespace lynx;
  21. if (project.isNotEmpty())
  22. {
  23. // ---- the mixer meters: the same levels in the Pattern layout (FL's normal law), the other layouts' straight
  24. // axis and FL's alternate law
  25. AudioEngine offline (false);
  26. MainComponent ui (offline, false);
  27. ui.setSize (1920, 1080);
  28. ui.openFile (juce::File (project));
  29. offline.dispatchPendingMessages();
  30. ui.selectTabForSnapshot (3);
  31. offline.dispatchPendingMessages();
  32. auto& strips = ui.getMixerForSnapshot().getStripsForSnapshot();
  33. const auto feed = [&] {
  34. offline.getTransport().playing.store (true);
  35. double ms = 1000.0;
  36. for (int f = 0; f < 30; ++f)
  37. {
  38. for (int k = 0; k < 8; ++k)
  39. offline.getMeters().accumulate (k, 0.5f + 0.06f * (float) k, 0.45f + 0.06f * (float) k);
  40. strips.frameForSnapshot (ms += 1000.0 / 60.0);
  41. }
  42. offline.getTransport().playing.store (false);
  43. };
  44. const auto wells = strips.meterAreaForSnapshot (0).getUnion (strips.meterAreaForSnapshot (5)).expanded (6);
  45. line ("meter wells " + wells.toString() + ", master meter " + strips.meterAreaForSnapshot (0).toString());
  46. check ("Pattern layout: FL's normal meter law", meterscale::current() == meterscale::Law::flNormal);
  47. // FL's Master meter (capture 190lx A1): 0 dB at (555 - 262) / 346 = 84.7 %, -6 dB at 69.7 %
  48. check ("Pattern layout: 0 dB at 85 % of the meter, -6 dB at 70 % (FL)",
  49. std::abs (meters::scalePosition (0.0f) - 0.847f) < 0.004f && std::abs (meters::scalePosition (-6.0f) - 0.697f) < 0.004f);
  50. const auto marks = meters::scaleMarks ((float) strips.meterAreaForSnapshot (0).getHeight(), 11.0f);
  51. juce::StringArray markText;
  52. for (auto m : marks)
  53. markText.add (juce::String (m));
  54. line ("Pattern master marks: " + markText.joinIntoString (" "));
  55. feed();
  56. zoomShot (strips, wells, 3.0f, "mixer-meters-fl-normal@3x");
  57. zoomShot (strips, wells, 1.0f, "mixer-meters-fl-normal");
  58. write (strips, "mixer-pattern");
  59. layoutstyle::setCurrent (layoutstyle::Style::clipLaunch);
  60. strips.repaint();
  61. feed();
  62. check ("Clip-launch / Simple look: the straight -60 … +6 dB axis", meterscale::current() == meterscale::Law::straight
  63. && std::abs (meters::scalePosition (0.0f) - 60.0f / 66.0f) < 1.0e-5f);
  64. zoomShot (strips, wells, 3.0f, "mixer-meters-straight@3x");
  65. layoutstyle::setCurrent (layoutstyle::Style::pattern);
  66. meterscale::alternate() = true;
  67. strips.repaint();
  68. feed();
  69. check ("Alternate meter scale wins in every layout", meterscale::current() == meterscale::Law::flAlternate);
  70. zoomShot (strips, wells, 3.0f, "mixer-meters-alternate@3x");
  71. meterscale::alternate() = false;
  72. strips.repaint();
  73. // the hint bar's reading under the pointer is the law's inverse (FL: "-4.81dB 0.58" at y 304 of 209…555)
  74. const auto db = meterscale::dbAtPosition ((555.0f - 304.0f) / 346.0f, meterscale::current());
  75. line ("reading at FL's y 304: " + juce::String (db, 2) + " dB (FL: -4.81)");
  76. check ("the meter's hint reads FL's dB", std::abs (db + 4.81f) < 0.1f);
  77. }
  78. {
  79. // ---- Gross Beat: the tool column's Step / Slide / Freeze switches (DP-6) and the mapping options menu (DP-7)
  80. AudioEngine offline (false);
  81. Song gb;
  82. gb.mixer.resize (2);
  83. gb.mixer[0].name = "Master";
  84. gb.mixer[1].name = "Insert 1";
  85. gb.mixer[1].effects.push_back (makeEffectSlot (EffectKind::grossBeat));
  86. offline.setSong (std::move (gb));
  87. offline.dispatchPendingMessages();
  88. auto editor = makeNativeEffectEditor (offline, 1, 0, 1.0f, 0);
  89. showGrossBeatEnvelopeForSnapshot (*editor, 1);
  90. juce::PopupMenu menu;
  91. check ("Gross Beat: the switches (all off by default, as FL's)", grossBeatToolsForSnapshot (*editor, false, false, false, &menu));
  92. write (*editor, "plug-grossbeat-tools");
  93. juce::StringArray items;
  94. for (juce::PopupMenu::MenuItemIterator it (menu); it.next();)
  95. if (! it.getItem().text.isEmpty())
  96. items.add (it.getItem().text);
  97. line ("mapping menu: " + items.joinIntoString (" | "));
  98. check ("mapping menu: FL's State and Tools items", items.contains (tr ("Copy state")) && items.contains (tr ("Scale levels..."))
  99. && items.contains (tr ("Decimate points...")) && items.contains (tr ("Turn all points smooth"))
  100. && items.contains (tr ("Create sequence...")) && items.contains (tr ("Insert point at locator"))
  101. && items.contains (tr ("Select all")) && items.contains (tr ("Invert")));
  102. saveMenus (juce::StringArray { "Gross Beat: mapping options" }, { menu }, prefix + "-menu-grossbeat-mapping.png");
  103. grossBeatToolsForSnapshot (*editor, true, false, true, nullptr);
  104. write (*editor, "plug-grossbeat-frozen");
  105. grossBeatToolsForSnapshot (*editor, false, false, false, nullptr);
  106. auto big = makeNativeEffectEditor (offline, 1, 0, 1.5f, 0);
  107. showGrossBeatEnvelopeForSnapshot (*big, 1);
  108. write (*big, "plug-grossbeat-tools@150");
  109. }
  110. {
  111. // ---- Fruity Limiter: KNEE held draws the compressor's transfer at the display's bottom-left (DP-26); FL's
  112. // capture settings (threshold at 10 % of the axis, ratio slope 0.23)
  113. AudioEngine offline (false);
  114. Song song;
  115. song.mixer.resize (2);
  116. song.mixer[0].name = "Master";
  117. song.mixer[1].name = "Insert 1";
  118. auto lim = makeEffectSlot (EffectKind::fruityLimiter);
  119. lim.params[8] = 0.284f; // Comp. threshold
  120. lim.params[9] = 0.79f; // Ratio
  121. lim.params[10] = 0.5f; // Knee 0 %
  122. song.mixer[1].effects.push_back (lim);
  123. offline.setSong (std::move (song));
  124. offline.dispatchPendingMessages();
  125. const auto out = fldyn::limiterCompTransfer (offline.getSong().mixer[1].effects[0].params, 1.0f);
  126. line ("transfer at 0 dB in: " + juce::String (juce::Decibels::gainToDecibels (out), 2) + " dB out");
  127. check ("Fruity Limiter: the transfer compresses above the threshold, 1:1 under it",
  128. out < 0.6f && std::abs (fldyn::limiterCompTransfer (offline.getSong().mixer[1].effects[0].params, 0.01f) - 0.01f) < 1.0e-4f);
  129. auto editor = makeNativeEffectEditor (offline, 1, 0, 1.0f, 1);
  130. check ("Fruity Limiter: KNEE held", limiterKneeHeldForSnapshot (*editor, true));
  131. write (*editor, "plug-limiter-knee-held");
  132. auto big = makeNativeEffectEditor (offline, 1, 0, 1.5f, 1);
  133. limiterKneeHeldForSnapshot (*big, true);
  134. write (*big, "plug-limiter-knee-held@150");
  135. }
  136. {
  137. // ---- Fruity Multiband Compressor's band meters (DP-29): IN (left / right) and C per band
  138. AudioEngine offline (false);
  139. Song song;
  140. song.mixer.resize (2);
  141. song.mixer[0].name = "Master";
  142. song.mixer[1].name = "Insert 1";
  143. song.mixer[1].effects.push_back (makeEffectSlot (EffectKind::fruityMultiband));
  144. offline.setSong (std::move (song));
  145. offline.dispatchPendingMessages();
  146. auto editor = makeNativeEffectEditor (offline, 1, 0, 1.0f, 0);
  147. check ("Multiband: band meters", multibandMetersForSnapshot (*editor));
  148. write (*editor, "plug-multiband-meters");
  149. auto big = makeNativeEffectEditor (offline, 1, 0, 1.5f, 0);
  150. multibandMetersForSnapshot (*big);
  151. write (*big, "plug-multiband-meters@150");
  152. }
  153. {
  154. // ---- Live's velocity marker hover / drag in the Clip View's Live look (DL-80)
  155. AudioEngine offline (false);
  156. Song song;
  157. song.channels.resize (1);
  158. song.channels[0].name = "Keys";
  159. auto& pat = song.activePattern();
  160. for (int k = 0; k < 4; ++k)
  161. {
  162. Note n;
  163. n.start = (std::int64_t) k * 4 * ticksPerStep;
  164. n.length = 3 * ticksPerStep;
  165. n.key = 60 + k * 2;
  166. n.velocity = 0.27f + 0.15f * (float) k;
  167. n.channel = 0;
  168. pat.notes.push_back (n);
  169. }
  170. offline.setSong (std::move (song));
  171. offline.setSelectedChannel (0);
  172. offline.dispatchPendingMessages();
  173. layoutstyle::setCurrent (layoutstyle::Style::clipLaunch);
  174. for (int dragging = 0; dragging < 2; ++dragging)
  175. {
  176. PianoRollComponent roll (offline);
  177. roll.setSize (760, 420);
  178. offline.dispatchPendingMessages();
  179. const auto value = roll.liveVelocityHoverForSnapshot (dragging == 1);
  180. line ("velocity readout " + juce::String (value));
  181. check (dragging == 0 ? "Live look: the hovered note's velocity marker (value " + juce::String (value) + ")" : "Live look: a velocity being dragged", value > 0);
  182. write (roll, dragging == 0 ? "live-velocity-hover" : "live-velocity-drag");
  183. }
  184. layoutstyle::setCurrent (layoutstyle::Style::pattern);
  185. }
  186. juce::File (prefix + "-checks.txt").replaceWithText (checks + (allOk ? "result=OK\n" : "result=FAIL\n"));
  187. return allOk;
  188. }