#include #include #include "engine/AraHost.h" #include "engine/FileSort.h" #include "platform/Paths.h" #include "core/SectionOps.h" // round 190ol (P1: the Sections lane) #include "core/SignatureEdit.h" // round 190ol (P6) #include "ui/SectionsLane190ol.h" // round 190ol (P1: the shot route drives the lane) #include "ui/ChordLane190pf.h" // round 190pf (P13: the shot route drives the lane) #include "ui/SmartTempo190pf.h" // round 190pf (P12) #include "core/SmartTempo.h" #include "core/Offline.h" #include "core/GrooveAudio.h" #include "core/SmartDisableTip.h" // (round 190ok: --smarttipshot190ok) #include "core/SimpleTracks.h" // (round 190ot: --simpleduck190otshot) #include "core/TrackImport.h" // (round 190pe: --tracks190peshot, --selftest tracks190pe) #include "core/TrackVersions.h" #include "ui/TrackImportDialog.h" #include "core/EditorScale.h" #include "core/SimplePads.h" #include "core/SimSynth.h" // (round 190om: the selftest's SimSynth channel) #include "core/ClipEnvelope.h" #include "core/ClipWarp.h" #include "core/KeyGuess.h" #include "core/EditorPolish.h" #include "core/FlpExport.h" #include "core/FruityBasicFx.h" // (round 190my: Fruity Balance in --details190myshot) #include "core/TrackClips.h" #include "core/TrackStates.h" #include "core/RangeEdit.h" // round 190pa (P14) #include "core/AutomationModes.h" // round 190pa (P21) #include "core/Groove.h" #include "core/DrawMode.h" #include "core/SessionOps.h" #include "ui/ClipGridComponent.h" #include "ui/ArticulatorTools.h" #include "ui/ExternalDrag.h" #include "ui/LabelFont.h" #include "ui/SessionMixer.h" #include "core/FlSamplers.h" #include "core/ArrangeOps.h" #include "core/ClipSample.h" #include "core/WarpModes.h" #include "ui/ClipAudioPanel.h" #include "core/DetailChain.h" #include "core/SessionMixer.h" #include "core/PlaylistOps.h" #include "core/LastTweaked.h" #include "core/ClipOps.h" #include "core/TransportEdit.h" // (round 190jz: --issueshot190jz) #include "core/SamplerPage.h" #include "core/FlTrackMenus.h" #include "core/FlClipMenu.h" #include "core/OneClickRec.h" #include "core/WarpTools.h" #include "core/Comping.h" #include "core/ExportSilence.h" #include "core/Drumaxx.h" #include "core/PatternBlocks.h" #include "core/LoadTrace.h" #include "core/ProjectSafety.h" #include "core/Patcher.h" #include "core/Rack.h" #include "ui/RackEditor.h" #include "ui/HelixEditor.h" #include "ui/LynxModelEditor.h" #include "core/physmod/LynxModel.h" #include "core/PluginCatalog.h" #include "engine/GeneratorCatalog.h" #include "core/AlsDevices.h" #include "core/XmlLite.h" #include "ui/DrumRackShot.h" #include "ui/GroovePoolComponent.h" #include "core/Patcherize.h" #include "core/Performance.h" #include "core/VideoPlayer.h" #include "core/Effects.h" #include "core/MixSuite.h" #include "core/LowLifterFl.h" // (rollup step 12: the 0.1.28 copy item) #include "core/HardwareInsert.h" #include "core/EchoSuite.h" #include "core/LuxeVerb.h" #include "core/LynxVerbs.h" #include "core/LynxTune.h" #include "core/FlEffects.h" #include "core/FlpImport.h" #include "core/NoteEdit.h" #include "core/PlaylistTrackOps.h" // round 190jf (FoldersShot190jf.inc) #include "ui/DawProjectExport.h" // round 190jf (--dawprojcheck190jf) #include "ui/FlmExportDialog.h" // round 190og (--export-flm, --flmexportshot) #include "core/NoteNames.h" #include "core/MaximusFx.h" #include "core/ChainPresets.h" #include "core/GoalKnobs.h" #include "core/MasterLooks.h" #include "core/Harmor.h" #include "core/KiloheartsDsp.h" // (rollup step 14: the copy for 0.1.28 self-test) #include "core/ThreeOsc.h" // (rollup 0.1.32 step 1: the copy for 0.1.31 self-test) #include "core/WavetableSynth.h" // (round 190oc: the copy for 0.1.30 self-test) #include "core/AutoLook.h" // (rollup 0.1.31 step 4: the copy for 0.1.30 self-test) #include "flp/Flp.h" #include "flp/FlpWrite.h" // round 190qs (issue #282 self-test) #include "core/DemoSongs.h" #include "core/FirstSongTour.h" #include "core/PerfProjects.h" #include "core/ShowcaseSong.h" #include "core/RenderAhead.h" #include "core/SynthPresets.h" #include "core/FlWrapper.h" #include "engine/AudioEngine.h" #include "engine/ProjectDowngrade.h" #include "engine/RemoteNotes.h" // (round 190pm: --selftest repeats190pm) #include "core/NoteConditions.h" // (round 190pm) #include "ui/TouchInput.h" // (round 190pm) #include "ui/TrackerComponent.h" #include "core/ClipLauncher.h" #include "core/SimpleSteps.h" #include "core/DirectWaveState.h" #include "core/MixSnapshots.h" #include "core/VoiceShift.h" #include "core/PeakShapes.h" // rollup step 7: the copy for 0.1.28 self-test #include "core/DynamicsSuite.h" #include "core/TempoMarkers.h" #include "engine/RemoteControl.h" #include "engine/RemoteError.h" #include "ui/RemoteControlSettings.h" #include "engine/PreviewPlayer.h" #include "engine/Metronome.h" #include "engine/AudioLogger.h" #include "engine/DllAsioDevice.h" #include "engine/PipeWireDevice.h" #include "platform/LinuxRealtime.h" #include "engine/PowerHints.h" #include "engine/Exporter.h" #include "engine/AacEncoder.h" #include "engine/FlStudioExport.h" #include "engine/MidiFileIo.h" #include "core/MidiPreview.h" // round 190qi #include "core/PluginPicks.h" // round 190qi #include "engine/PluginHost.h" #include "engine/Vst3NoteTuning.h" #include "engine/PluginSandbox.h" #include "engine/Bridge32Test.h" #include "engine/ClapFormat.h" #include "engine/JsfxFormat.h" #include "engine/ClapTeardownTest.h" #include "engine/RenderAgainTest.h" #include "engine/Determinism190poTest.h" #include "ui/TiltViewport.h" #if JUCE_LINUX #include // (round 190ou: --hwheel254test presses X11 buttons through XTest) #include // (round 190ou: --multieditor255test LYNX_ME_PTRACE=1) #include // (round 190rf: --qa190rfchild display) #include #endif #include "engine/HostingTests.h" #include "engine/Modulators190oxTest.h" #include "ui/ModRing.h" #include "core/EdisonFx.h" #include "engine/ProjectFile.h" #include "ui/RemoteControl.h" #include "core/FlControlMenus.h" #include "core/PlaylistOps.h" #include "core/Sha256.h" #include "engine/SessionPack.h" #include "engine/LiveSessions.h" #include "engine/LiveTest.h" #include "engine/ShortExportTest.h" #include "core/SessionIds.h" #include "core/SessionParts.h" #include "engine/SampleLibrary.h" #include "engine/Text.h" #include "platform/FileTypes.h" #include "platform/Package.h" #include "core/AlsExport.h" #include "core/AlsImport.h" #include "core/LiveScaleControl.h" // round 190oo (--design190ooshot) #include "core/PlaylistViewOptions.h" #include "core/PianoRollScript.h" #include "ui/ScriptPanel.h" #include "ui/AlsExportDialog.h" #include "ui/LiveRemoteUi.h" #include "ui/GamepadInput.h" #include "ui/SettingsPages.h" #include "core/ExtrasDefaults.h" // round 190qk (--selftest extras190qk) #include "ui/ExtendedHintPanel.h" #include "core/FlSettings.h" #include "ui/OtherAppsExport.h" #include "ui/TimerWhileShowing.h" #include "ui/MixerBasicsCheck.h" #include "ui/VideoPlayerView.h" #include "ui/VideoMedia.h" #include "ui/VideoTracks.h" #include "ui/AdrWindow.h" #include "ui/PluginPicker.h" #include "ui/PlaylistComponent.h" #include "ui/PictureCheck.h" #include "ui/PatternBlocksView.h" #include "ui/PaintAB.h" #include #include "ui/PatcherEditor.h" #include "ui/VisualEditors.h" #include "ui/FlExtraEditors.h" #include "ui/VisualGl.h" #include "ui/DanceView.h" #include "ui/PluginPresetMenu.h" #include "ui/GeneratorPresetMenu.h" #include "core/GeneratorPresets.h" #include "ui/PluginWindow.h" #include "platform/NativeEmbed.h" #include "ui/Motion.h" #include "ui/ShotShowing.h" #include "ui/SimpleLook.h" #include "ui/NativeChild.h" #include "ui/FrameTicker.h" #include "ui/DockPaintCheck.h" #include "ui/Workspace.h" #include "ui/PluginThumbs.h" #include "ui/ClipProperties.h" #include "ui/NewProjectDialog.h" #include "ui/PluginMonitorWindow.h" #include "ui/TouchKeyboard.h" #include "ui/AutomationUi.h" #include "core/GrossBeatLocator.h" #include "ui/PluginSkin.h" #include "ui/ChannelSettings.h" #include "ui/TempoDetectionDialog.h" #include "ui/AudioClipboard.h" #include "ui/FlVoicePanel.h" #include "ui/SlicexEditor.h" #include "ui/DirectWaveEditor.h" #include "ui/FruitySlicerEditor.h" #include "core/GrossBeat.h" #include "core/LynxBanks.h" #include "core/NativeEngines.h" #include "ui/ControllerEditors.h" #include "ui/NewtoneEditor.h" #include "core/NewtoneFx.h" #include "core/FormulaController.h" #include "core/MidiControls.h" #include "core/FlSynths.h" #include "core/SoundFont.h" #include "core/Sfz.h" #include "core/Slicex.h" #include "ui/Dialogs.h" #include "ui/DialogFrame.h" #include "ui/FileChoosers.h" #include "ui/TrackIcons.h" #include "core/MeterScale.h" #include "core/RackOps.h" #include "core/RackAutomation.h" // round 190oo (PAT-7, --selftest rackauto190oo) #include "core/Layer.h" #include "core/XyController.h" #include "core/FlCurve.h" #include "core/ControlSurface.h" #include "core/VoltageController.h" #include "ui/Controllers164.h" #include "core/StandIns.h" #include "ui/ExportDialog.h" #include "ui/QuickAddPalette.h" #include "ui/I18n.h" #include "ui/KeyFocus.h" #include "core/TrackIconScale.h" #include "core/EscClose.h" #include "ui/MainComponent.h" #include "ui/LynxWindows.h" // --tabs2test190nz (issue #232 stage 2) #include "ui/WindowClipboard.h" #include "ui/SimpleDock.h" #include "core/ScaleKeys.h" #include "core/KeyFollow.h" #include "core/SoundLibrary.h" #include "ui/MidiToolsPanel.h" #include "ui/FrameProbe.h" #include "ui/MotionOverlay.h" #include "ui/UiTrace.h" #include "core/MixerOps.h" #include "ui/QuickPick.h" #include "core/FolderWatcher.h" #include "core/FruityDynamics.h" #include "core/PluginDbFolder.h" #include "core/NoteTools.h" #include "engine/ProjectPackage.h" #include "ui/SetupWizard.h" #include "ui/DemoMode.h" // (round 190np) #if JUCE_LINUX || JUCE_WINDOWS // (rollup 0.1.31 step 2: Windows too, so --onboard190npshot runs its async callbacks there) namespace juce::detail { bool dispatchNextMessageOnSystemQueue (bool returnIfNoPendingMessages); } // juce_Messaging_linux / _windows.cpp (--onboard190npshot) #endif #include "ui/Onboarding.h" #include "engine/FlStudio.h" #include "ui/HistoryPanel.h" #include "ui/VersionsPanel.h" #include "ui/CleanVoiceMenu.h" #include "ui/LyricsPanel.h" #include "ui/ReferenceMatchPanel.h" #include "ui/StartFromPanel.h" #include "ui/FirstSongTour.h" #include "ui/PluginsOffPanel.h" #include "ui/MissingFilesDialog.h" #include "ui/SettingsDialog.h" #include "ui/PluginManager.h" #include "ui/ShortcutManager.h" #include "ui/NoteToolDialogs.h" #include "ui/ChordStripView.h" // round 190kd (--prchord190kd) #include "ui/ChordHelper.h" // round 190mc (--modal190mc) #include "core/KeyRegions.h" // round chord2_190nu (--selftest, --keys190nu) #include "core/TransistorBass.h" // round 190mc (--modal190mc) #include "core/ModelParams.h" // round 190mc (--modal190mc) #include "ui/EventEditor.h" #include "ui/AudioEditor.h" #include "ui/SampleProperties.h" #include "ui/TempoTapper.h" #include "ui/ProjectPickerView.h" // (round 190my) #include "ui/WindowPlaces.h" // (round 190oa) #include "ui/HintBar.h" // (round 190oa) #include "core/EventEdit.h" #include "core/FacetEq.h" #include "core/LimiterLaw.h" // (rollup step 9: the copy for 0.1.28 self-test) #include "core/ApexLimiter.h" // (rollup step 10: likewise) #include "core/Reeverb2.h" #include "core/VoiceTools.h" #include "platform/ThreadInstructions.h" // (rollup step 9: --paintbench counts instructions) #include "ui/FacetEqEditor.h" #include "core/RackRenderer.h" #include "ui/ProEditors.h" #include "ui/ParametricEqEditor.h" #include "ui/PluginEditors.h" #include "core/PluginLayout.h" #include "core/EffectPresets.h" #include "ui/PluginHeader.h" #include "core/Vfx.h" #include "core/TransistorBass.h" #include "ui/Splash.h" #include "core/ExportDone.h" // round 190qr (#280) #include "core/StartupSound.h" // round 190qr (#280) #include "core/ClipHandle.h" // round 190qr (#274) #include "core/ZoomAnchor.h" // round 190qr (#276) #include "ui/Theme.h" #include "ui/ThemeSettings.h" #include "ui/AutoLookEditor.h" // (round 190od, issue #239) #include "core/StartPage.h" // (round 190oq, issue #252) #include "core/MuteKeys.h" #include "core/AraRegions.h" #include "ui/StartPage.h" #include "ui/DeleteFade.h" #include "ui/AraMenu.h" #include "ui/WaveformView.h" #include "ui/WindowOwner.h" #include "ui/PluginKeysTest.h" #include "ui/ZOrder191Test.h" #include "ui/Toolbar.h" #include "ui/ToolWindow.h" #include "core/Details190mv.h" // (round 190mv) #include "platform/CrashGuard.h" #include "ui/CrashReporter.h" #include "ui/Updater.h" #include "ui/AudioCheck.h" #include "ui/StemExtract.h" #include "core/RegionLoop.h" // round 190jr: --bandlab190jrshot #include "core/FactoryContent.h" // round 190ke: --simplegb190keshot #include "core/KeyFollow.h" // round 190kx: --loopinfo190kxshot #include "core/LoopAnalysis.h" #include "../tests/LoopCorpus190kx.h" // (LYNX's own synthetic loops, written for the shot) #include "core/SongFade.h" #include "core/SoundLibrary.h" #include "core/SynthParams.h" #include "core/GoalKnobs.h" #include "core/DetailChain.h" #include "ui/FinishDock.h" #include "ui/SimpleDock.h" #include "ui/SimpleTuner.h" #include "ui/AudioToMidi.h" #include "ui/PolyEditor.h" #include "core/PolyEdit.h" #include "ui/ShotScale.h" #include "core/LaneView.h" // round 190iu #include "core/PlaylistTrackOps.h" #include "core/MidiDrop.h" #include "core/TakeCleanup.h" #include "core/TrackOnly.h" #include "core/WheelZones.h" #include "ui/WorkflowExtras.h" #include "core/Links.h" #include #include // (round 190jf: --dawprojcheck190jf) #include #include #include #include #include #include #include #include #include namespace { lynx::AudioEngine* crashEngine = nullptr; // Startup trace (REA round 116): with LYNX_TRACE_STARTUP set, the time of each startup step since the C++ runtime // started is written to %APPDATA%\LYNX\startup.log (the loader's own time before that is not included). struct StartupTrace { using clock = std::chrono::steady_clock; const clock::time_point t0 = clock::now(); // static initialisation: no JUCE yet, standard library only const std::chrono::system_clock::time_point t0System = std::chrono::system_clock::now(); // (round 190hd: vs the process's creation) // (round 190go: always kept, as a field-readable start-up timeline; written to startup.log 5 s and 15 s after the // window — with LYNX_TRACE_STARTUP set, at every step as before, so a start that hangs still leaves its last step) const bool on = true; const bool eachStep = std::getenv ("LYNX_TRACE_STARTUP") != nullptr; juce::String text; clock::time_point last = t0; std::int64_t lastPrivate = 0; double seconds() const { return std::chrono::duration (clock::now() - t0).count(); } // since the process started void mark (const char* step) { if (! on) return; const auto now = clock::now(); const auto ms = [] (clock::duration d) { return std::chrono::duration (d).count(); }; // (round 190gd: the process's memory after each step too, so the log says where the megabytes of a start go) const auto mb = [] (std::int64_t bytes) { return juce::String ((double) bytes / 1048576.0, 1).paddedLeft (' ', 7); }; const auto priv = lynx::toolbar::PerformanceMeter::processPrivateBytes(); const auto ws = lynx::toolbar::PerformanceMeter::processMemoryBytes(); text << juce::String (ms (now - t0), 1).paddedLeft (' ', 8) << " ms +" << juce::String (ms (now - last), 1).paddedLeft (' ', 7) << " private " << mb (priv) << " MB (+" << mb (priv - lastPrivate).trim() << ") ws " << mb (ws) << " MB " << step << "\n"; lastPrivate = priv; last = now; if (eachStep) write(); } void write() const { lynx::platform::settingsFile ("startup.log").replaceWithText (text); } }; StartupTrace startupTrace; void startupMarkHook (const char* step) { startupTrace.mark (step); } // Round 190rb: a sanitizer build (-DLYNX_SANITIZE) leaves SIGSEGV / SIGBUS / SIGFPE / SIGABRT to ASan and UBSan (their // report names the bad access and where the memory came from); LYNX_CRASHGUARD=1 installs LYNX's handlers anyway bool sanitizerOwnsSignals() { #if defined(LYNX_SANITIZER_BUILD) return juce::SystemStats::getEnvironmentVariable ("LYNX_CRASHGUARD", {}) != "1"; #else return false; #endif } juce::File crashFolderForTest; // --faulttest: where the crash file goes instead of the settings' autosave folder // Crashed: try to save the project and write the backtrace (like FL's "emergency save"). void onCrash (void* exceptionPointers) { // round 190oh (Windows): a fault on a hosted plugin's own thread that nothing handled — that thread waits for good // inside this call and the main window's timer switches the plugin off (crashguard::parkFaultingPluginThread) if (lynx::crashguard::parkFaultingPluginThread (exceptionPointers)) return; // (round 190ci: once. The hook for stacks Windows cannot walk, crashguard::setUnwalkableFaultHandler, may have run // this before the top-level filter does) static std::atomic reported { false }; if (reported.exchange (true)) return; // rollup 0.1.30 step 12 (owner decision after round 190mo): whatever follows, the process ends within the watchdog's // time (60 s): after a heap corruption everything below that allocates can wait for ever on the allocator's lock lynx::crashguard::armCrashWatchdog (exceptionPointers); // ... and after the C library's (or Windows') heap-corruption abort, nothing that allocates runs at all: a crash file // written without the heap, no session note, no emergency save (the project in memory may be what was broken) if (lynx::crashguard::heapCorruptionCrash (exceptionPointers)) { lynx::crashguard::writeHeapCrashFile (exceptionPointers); return; } const auto folder = crashFolderForTest != juce::File() ? crashFolderForTest : lynx::platform::settingsFile ("autosave"); folder.createDirectory(); const auto stamp = juce::Time::getCurrentTime().formatted ("%Y-%m-%d %H-%M-%S"); // JUCE's backtrace (named frames only), then every frame of the faulting thread as module+offset (round 157a: a // release LYNX.exe has no symbols, so its own frames were missing from the file) folder.getChildFile ("crash " + stamp + ".txt").replaceWithText (juce::SystemStats::getStackBacktrace() + "\n--- frames (module+offset)\n" + juce::String::fromUTF8 (lynx::crashguard::exceptionBacktrace (exceptionPointers).c_str())); lynx::crashguard::note (("crashed: backtrace in autosave\\crash " + stamp + ".txt").toStdString()); if (lynx::crashguard::hangInCrashHandlerForTest()) // (--faulttest hang: a handler that never returns; the watchdog ends it) for (;;) std::this_thread::sleep_for (std::chrono::seconds (1)); if (crashEngine != nullptr) { juce::String error; lynx::ProjectFile::save (crashEngine->getSong(), folder.getChildFile ("recovered " + stamp + lynx::ProjectFile::extension), error); } } // Round 190rf (Linux): the X server went away (crashguard::watchDisplayConnection): the project in memory is saved as a // recovered project, as after a crash, before the process ends (it cannot go on without a display) void onDisplayLost() { if (crashEngine == nullptr) return; const auto folder = lynx::platform::settingsFile ("autosave"); folder.createDirectory(); juce::String error; lynx::ProjectFile::save (crashEngine->getSong(), folder.getChildFile ("recovered " + juce::Time::getCurrentTime().formatted ("%Y-%m-%d %H-%M-%S") + lynx::ProjectFile::extension), error); } juce::File sessionsFolder() { return lynx::PluginHost::settingsFolder().getChildFile ("sessions"); } // Sessions of earlier runs whose process is gone without closing (a fail-fast, a crash, a forced end): each is appended // to %APPDATA%\LYNX\crash-history.log and its file removed. Returns the last step of the newest one ("" when none). juce::StringArray uncleanSteps; // the newest unclean session's steps (without their times) juce::String uncleanSessionText; // the newest unclean session's whole file (round 159: the crash report reads it) // What the newest unclean session tells (round 157a): the plugin whose editor was opening / shown when it ended, and // whether its crash file blames a graphics driver struct UncleanCause { juce::String editorPlugin; // the last steps were that plugin's editor bool gpuDriver = false; // the crash file's top frames are in a GPU driver / Direct3D / Direct2D module juce::String driverModule; }; UncleanCause uncleanCause() { UncleanCause cause; juce::File crashFile; for (int i = uncleanSteps.size(); --i >= 0 && i >= uncleanSteps.size() - 4;) { const auto& step = uncleanSteps[i]; if (step.startsWith ("crashed: backtrace in ")) crashFile = lynx::platform::settingsFolder().getChildFile (step.fromFirstOccurrenceOf ("backtrace in ", false, false).replaceCharacter ('\\', '/')); for (const auto* prefix : { "opening the editor of ", "editor open: ", "editor shown: " }) if (cause.editorPlugin.isEmpty() && step.startsWith (prefix)) cause.editorPlugin = step.fromFirstOccurrenceOf (prefix, false, false).trim(); if (step.startsWith ("closing the editor of ") || step.startsWith ("loaded plugin") || step.startsWith ("opening project")) break; // older steps than these did not end the session } // issue #32 (round 174a): a plugin whose editor already faulted in this session (caught, LYNX went on) is the // likely cause when the session then ended without a word: offer it a separate process too for (int i = uncleanSteps.size(); --i >= 0 && cause.editorPlugin.isEmpty();) if (const auto editor = lynx::crashreport::parseEditorCrashStep (uncleanSteps[i].toStdString()); ! editor.plugin.empty()) cause.editorPlugin = juce::String::fromUTF8 (editor.plugin.c_str()); if (crashFile.existsAsFile()) { // the first frames after the crash handler's own (the "--- frames" part lists the faulting thread) auto text = crashFile.loadFileAsString(); if (text.contains ("--- frames")) text = text.fromFirstOccurrenceOf ("--- frames", false, false); auto lines = juce::StringArray::fromLines (text); int looked = 0; for (const auto& line : lines) { const auto module = line.fromFirstOccurrenceOf (": ", false, false).upToFirstOccurrenceOf ("+", false, false).trim().toLowerCase(); if (module.isEmpty() || ! module.endsWith (".dll")) continue; if (++looked > 12) break; for (const auto* driver : { "igd", "ig9icd", "ig7icd", "igxelp", "nvwgf2um", "nvoglv", "nvd3dum", "atidxx", "atio6axx", "amdxx", "aticfx", "d3d11.dll", "d3d10warp", "dxgi.dll", "d2d1.dll", "opengl32.dll", "dcomp.dll" }) if (module.startsWith (driver)) { cause.gpuDriver = true; cause.driverModule = module; break; } if (cause.gpuDriver) break; } } return cause; } juce::String collectUncleanSessions() { juce::String lastStep; juce::Time newest; for (const auto& file : sessionsFolder().findChildFiles (juce::File::findFiles, false, "session-*.txt")) { const auto text = file.loadFileAsString(); juce::StringPairArray values; juce::StringArray steps; for (const auto& line : juce::StringArray::fromLines (text)) { if (line.startsWith ("step=")) steps.add (line.fromFirstOccurrenceOf ("=", false, false)); else if (line.contains ("=")) values.set (line.upToFirstOccurrenceOf ("=", false, false), line.fromFirstOccurrenceOf ("=", false, false)); } const auto pid = (std::uint32_t) values["pid"].getLargeIntValue(); const auto start = (std::uint64_t) values["start"].getLargeIntValue(); if (pid == lynx::crashguard::processId() || lynx::crashguard::processRunning (pid, start)) continue; // this run, or another LYNX window still open lynx::PluginHost::settingsFolder().getChildFile ("crash-history.log") .appendText (juce::Time::getCurrentTime().toISO8601 (true) + " previous session ended without closing\n" + text + "\n"); file.deleteFile(); if (const auto modified = file.getLastModificationTime(); lastStep.isEmpty() || modified > newest) { newest = modified; lastStep = steps.isEmpty() ? juce::String ("start-up") : steps[steps.size() - 1].fromFirstOccurrenceOf (" ", false, false); uncleanSessionText = text; uncleanSteps.clear(); for (const auto& step : steps) uncleanSteps.add (step.fromFirstOccurrenceOf (" ", false, false)); } } return lastStep; } } // namespace // --uiperf (round 173f, discussion #10): a mixer fader dragged up and down with the mouse while the pattern plays. A // high-resolution timer delivers 125 moves a second to the message thread through the window's own mouse path // (ComponentPeer::handleMouseEvent), at most one waiting at a time as Windows does with WM_MOUSEMOVE; every frame the // window paints tells whether it covered the fader. Measured: how long a move waited for the message thread, the time // from a move to the first frame that shows the fader after it (input → paint), and whether the value stays put when // the mouse is released. #if JUCE_WINDOWS namespace juce { extern int lynxD2DPresents; // (cmake/LynxPatchJuce.cmake, round 190gv: every Direct2D window present) } #endif // round 190jy: --uiperf's presents per second (190kb's cycles line reads it too) static int uiPerfPresents() { #if JUCE_WINDOWS return juce::lynxD2DPresents; #else return 0; #endif } struct UiPerfDrag final : public std::enable_shared_from_this, private juce::HighResolutionTimer { ~UiPerfDrag() override { stopTimer(); } void start (juce::Component& windowIn, juce::Component& strips, juce::Rectangle rail, lynx::AudioEngine* engineIn, int trackIn) { window = &windowIn; engine = engineIn; track = trackIn; railInWindow = window->getLocalArea (&strips, rail); watch = railInWindow.expanded (6, 40); // the cap, its tip above and the dB read-out below visible = strips.isShowing() && window->getLocalArea (&strips, strips.getLocalBounds()).contains (railInWindow.getCentre()); const auto volume = engine->getSong().mixer[(std::size_t) track].volume; x = (float) railInWindow.getCentreX(); startY = (float) railInWindow.getBottom() - volume * (float) railInWindow.getHeight(); // on the cap: no jump amplitude = 0.4f * (float) railInWindow.getHeight(); centreY = juce::jlimit ((float) railInWindow.getY() + amplitude, (float) railInWindow.getBottom() - amplitude, startY); t0 = juce::Time::getMillisecondCounterHiRes(); inject (x, startY, false); juce::ModifierKeys::currentModifiers = juce::ModifierKeys (juce::ModifierKeys::leftButtonModifier); inject (x, startY, true); active = true; startTimer (8); } // message thread void framePainted (double now, juce::Rectangle area) { if (pending.empty() || ! area.intersects (watch)) return; for (const auto t : pending) latencies.push_back (now - t); pending.clear(); ++framesOverFader; } // the moves end; as in the reporter's clip, the song is stopped while the button is still down juce::String stop() { stopTimer(); active = false; valueAtRelease = engine->getSong().mixer[(std::size_t) track].volume; engine->stop(); juce::String text; text << " drag of insert " << track << "'s fader" << (visible ? "" : " (NOT VISIBLE)") << ": " << moves << " moves handled, " << dropped << " folded into the next (the message thread still busy with the previous one)\n" << " move waited for the message thread: " << describe (queueDelays) << "\n" << " input -> paint (move to the first frame over the fader): " << describe (latencies) << ", " << framesOverFader << " frames over the fader\n"; return text; } juce::String release() { const auto now = engine->getSong().mixer[(std::size_t) track].volume; juce::ModifierKeys::currentModifiers = {}; inject (x, lastY, false); return " song stopped, button still down: fader " + juce::String (now, 4) + " (" + juce::String (valueAtRelease, 4) + " at the last move) " + (std::abs (now - valueAtRelease) < 1.0e-4f ? "kept" : "CHANGED") + "\n"; } juce::String released() const { const auto now = engine->getSong().mixer[(std::size_t) track].volume; return " after the release: fader " + juce::String (now, 4) + " (" + juce::String (valueAtRelease, 4) + " when released) " + (std::abs (now - valueAtRelease) < 1.0e-4f ? "kept" : "CHANGED") + "\n"; } private: juce::Component* window = nullptr; lynx::AudioEngine* engine = nullptr; int track = 1; juce::Rectangle railInWindow, watch; bool visible = false; float x = 0.0f, startY = 0.0f, centreY = 0.0f, amplitude = 0.0f, lastY = 0.0f; double t0 = 0.0; std::atomic active { false }, posted { false }; std::atomic dropped { 0 }; int moves = 0, framesOverFader = 0; float valueAtRelease = 0.0f; std::vector pending, latencies, queueDelays; static juce::String describe (std::vector v) { if (v.empty()) return "none"; std::sort (v.begin(), v.end()); const auto at = [&v] (double q) { return v[std::min (v.size() - 1, (std::size_t) (q * (double) v.size()))]; }; return "p50 " + juce::String (at (0.5), 1) + " / p95 " + juce::String (at (0.95), 1) + " / p99 " + juce::String (at (0.99), 1) + " / max " + juce::String (v.back(), 1) + " ms"; } void inject (float px, float py, bool down) { lastY = py; if (auto* peer = window != nullptr ? window->getPeer() : nullptr) { const auto local = peer->globalToLocal (window->localPointToGlobal (juce::Point (px, py))); peer->handleMouseEvent (juce::MouseInputSource::InputSourceType::mouse, local, down ? juce::ModifierKeys (juce::ModifierKeys::leftButtonModifier) : juce::ModifierKeys(), juce::MouseInputSource::defaultPressure, juce::MouseInputSource::defaultOrientation, juce::Time::currentTimeMillis()); } } void hiResTimerCallback() override { if (! active.load()) return; if (posted.exchange (true)) { ++dropped; return; } const auto postedAt = juce::Time::getMillisecondCounterHiRes(); juce::MessageManager::callAsync ([self = shared_from_this(), postedAt] { self->posted = false; if (! self->active.load()) return; const auto now = juce::Time::getMillisecondCounterHiRes(); self->queueDelays.push_back (now - postedAt); // up and down ~1.3 times a second, like the reporter's hand const auto y = self->centreY + self->amplitude * (float) std::sin (2.0 * juce::MathConstants::pi * 1.3 * (now - self->t0) / 1000.0); self->inject (self->x, y, true); self->pending.push_back (postedAt); ++self->moves; }); } }; class LynxApplication final : public juce::JUCEApplication { public: const juce::String getApplicationName() override { return JUCE_APPLICATION_NAME_STRING; } const juce::String getApplicationVersion() override { return JUCE_APPLICATION_VERSION_STRING; } // the plugin scan runs copies of LYNX as child processes bool moreThanOneInstanceAllowed() override { return true; } // A file handed to the running application. macOS does this for every Finder double-click, "Open With" and Dock drop, // also the one that starts LYNX (its argv has no file). On Windows and Linux a second start is a second process // (moreThanOneInstanceAllowed) with the file as an argument, so this is not called there. Only the first file of a // multiple selection opens: a project replaces the one before it. (D#92, round 180a) void anotherInstanceStarted (const juce::String& commandLine) override { const auto files = lynx::safety::filesInCommandLine (commandLine.toStdString()); if (files.empty()) return; const auto file = juce::File::getCurrentWorkingDirectory().getChildFile (juce::String::fromUTF8 (files.front().c_str())); if (! startupFileHandled) // still starting: openStartupFile takes it, nothing to ask about yet { fileToOpen = file; return; } if (mainWindow != nullptr) { mainWindow->toFront (true); mainWindow->getContent().openFileRequest (file); } } void initialise (const juce::String& commandLine) override { // round 190nx: --offline (or LYNX_OFFLINE=1) = no network connection of LYNX's own, before anything can start one if (juce::StringArray::fromTokens (commandLine, true).contains ("--offline")) lynx::offline::set (true); // round 166b: the copy of LYNX.exe that installs an update (ui/Updater.h) waits, installs, starts LYNX again if (commandLine.contains ("--apply-update") && lynx::updater::runApplyHelper (juce::StringArray::fromTokens (commandLine, true))) { updateHelper = true; quit(); return; } // Windows, LYNX.exe in a folder with accents: run again from its ASCII short path (Waves editors crash otherwise) if (int code = 0; lynx::platform::relaunchFromAsciiPath (code)) { relaunched = true; setApplicationReturnValue (code); quit(); return; } // a crash in any mode (UI, command line) writes its backtrace to %APPDATA%\LYNX\autosave. A sanitizer build // (-DLYNX_SANITIZE, round 190rb) leaves the fault signals to ASan / UBSan, whose reports name the bad access, // unless LYNX_CRASHGUARD=1 asks for LYNX's own handlers (their tests) if (! sanitizerOwnsSignals()) juce::SystemStats::setApplicationCrashHandler (onCrash); // rollup step 12: the crash handler's watchdog and its allocation-free crash file (platform/CrashGuard.h) lynx::crashguard::prepareCrashWatchdog (lynx::platform::settingsFile ("autosave").getFullPathName().toStdString()); // rollup 0.1.28 (REA 190hb action 4, FL's "Init DWM"): the compositor on MMCSS, steadier frames under CPU load // (Windows; LYNX_DWM_MMCSS=0 leaves it off) lynx::powerhints::enableCompositorMmcss(); // round als190ka (issue #193): a video's sound track for the sample library (a Live set's video clips) lynx::SampleLibrary::setVideoSoundDecoder ([] (const juce::File& video) { return lynx::videotracks::soundTrackWav (video); }); // round 190ci: also for a fault on a stack Windows cannot walk, which never reaches that handler (Windows) lynx::crashguard::setUnwalkableFaultHandler (onCrash); if (const auto args = juce::StringArray::fromTokens (commandLine, true); args.contains ("--faulttest")) { // LYNX.exe --faulttest plain|unwalkable (round 190ci): ends by an access violation on purpose, // before any window, so that --selftest can check that the crash file gets written (into ) const auto i = args.indexOf ("--faulttest"); crashFolderForTest = juce::File (args[i + 2].unquoted()); lynx::crashguard::setCrashFolder (crashFolderForTest.getFullPathName().toStdString()); lynx::crashguard::quietCrashReports(); // rollup step 12: heap = the C library's heap-corruption abort (no recovered project may be written: an // engine is set for the emergency save on purpose); hang = a crash handler that never returns (the watchdog // must end the process: LYNX_CRASH_WATCHDOG_S makes the test short) if (args[i + 1] == "heap" || args[i + 1] == "hang") { static lynx::AudioEngine* engine = new lynx::AudioEngine (false); crashEngine = engine; if (args[i + 1] == "heap") lynx::crashguard::heapCorruptionForTest(); lynx::crashguard::setHangInCrashHandlerForTest(); lynx::crashguard::faultForTest (false); } // round 190dt: guarded / guarded-libc = LYNX's own fault inside a guarded plugin call (Linux / macOS): it must // reach the crash handler like any other; a return means the guard swallowed it // round 190gg: thread / thread-libc = a fault on a thread of LYNX's own, with LYNX's executable watched as // a plugin's module: it must not be parked as a plugin's thread if (args[i + 1].startsWith ("thread")) { lynx::crashguard::faultOnOwnThreadForTest (args[i + 1] == "thread-libc"); crashFolderForTest.getChildFile ("swallowed.txt").replaceWithText ("parked"); lynx::crashguard::exitNow (4); } if (args[i + 1].startsWith ("guarded")) { const auto code = lynx::crashguard::faultInGuardedCallForTest (args[i + 1] == "guarded-libc"); crashFolderForTest.getChildFile ("swallowed.txt").replaceWithText (lynx::crashguard::describe (code)); lynx::crashguard::exitNow (4); } lynx::crashguard::faultForTest (args[i + 1] == "unwalkable"); } if (! sanitizerOwnsSignals()) lynx::crashguard::hardenSignals(); // issue #115: stack overflows and SIGTERM / SIGHUP leave a trace (Linux / macOS) // SFZ instruments (round 167o): their FLAC / OGG / AIFF / MP3 samples through JUCE's readers lynx::sfz::setDecoder ([] (const std::string& path, lynx::sfz::Audio& out) { juce::AudioFormatManager formats; formats.registerBasicFormats(); std::unique_ptr reader (formats.createReaderFor (juce::File (juce::String::fromUTF8 (path.c_str())))); if (reader == nullptr || reader->lengthInSamples <= 0 || reader->lengthInSamples > (1 << 28) || reader->numChannels == 0) return false; const auto frames = (int) reader->lengthInSamples; juce::AudioBuffer buffer ((int) std::min (2u, reader->numChannels), frames); if (! reader->read (&buffer, 0, frames, 0, true, buffer.getNumChannels() > 1)) return false; out.channels.clear(); for (int ch = 0; ch < buffer.getNumChannels(); ++ch) out.channels.emplace_back (buffer.getReadPointer (ch), buffer.getReadPointer (ch) + frames); out.sampleRate = reader->sampleRate; out.loopStart = out.loopEnd = -1; return true; }); // child process of a sandboxed plugin: no window or audio of its own if (lynx::runPluginSandboxWorker (commandLine)) { lynx::crashguard::quietCrashReports(); sandboxChild = true; return; } // --shot-scale / --shot-suffix (round 190bi, ui/ShotScale.h): the pixel scale and file-name suffix of every // picture route, taken out here so the routes' own arguments keep their places const auto args = lynx::shot::takeArguments (juce::StringArray::fromTokens (commandLine, true)); // round 190np: whether this profile already had LYNX's UI settings before this start (an upgrade keeps what it had: // no welcome card), and --demo (ui/DemoMode.h: the tutorial-video pipeline's automation mode) lynx::onboardui::profileExistedAtStart() = lynx::PluginHost::settingsFolder().getChildFile ("ui-options.txt").existsAsFile(); if (args.contains ("--demo")) lynx::demo::setActive (true); // interface language: saved in %APPDATA%\LYNX\language.txt; --lang pt-BR overrides it for this run lynx::i18n::initialise (args); // interface font: saved in Settings › General; --uifont "Name" overrides it for this run const auto uiFontArg = args.indexOf ("--uifont"); lookAndFeel.applyInterfaceFont (lynx::i18n::current(), uiFontArg >= 0 ? args[uiFontArg + 1].unquoted() : juce::String()); // text size (issue #189): saved in Settings › General; --textsize 125 overrides it for this run const auto textSizeArg = args.indexOf ("--textsize"); lynx::theme::setTextSize (textSizeArg >= 0 ? args[textSizeArg + 1].getIntValue() : lynx::theme::savedTextSize()); // bold text (round 190jp): saved in Settings › General; --boldtext 1 (labels) or 2 (all) overrides it for this run const auto boldTextArg = args.indexOf ("--boldtext"); lynx::theme::setBoldText (boldTextArg >= 0 ? args[boldTextArg + 1].getIntValue() : lynx::theme::savedBoldText()); // round 190je: FL-style condensed labels (Settings › General); --condensedlabels for one run. --menustyle flClassic: FL's // light menus for one run (Settings › Theme keeps the saved choice) lynx::theme::setCondensedLabels (args.contains ("--condensedlabels") || lynx::theme::savedCondensedLabels()); if (const auto menuStyleArg = args.indexOf ("--menustyle"); menuStyleArg >= 0) { lynx::theme::menus::setStyle (lynx::themes::menuStyleFromId (args[menuStyleArg + 1].unquoted().toStdString())); lookAndFeel.refreshColours(); } if (args.contains ("--showcase")) { // LYNX's own demo project (README screenshots): --showcase output.lynx [pattern] const auto i = args.indexOf ("--showcase"); runShowcase (args[i + 1].unquoted(), args[i + 2].getIntValue()); return; } if (args.contains ("--demosongs")) { // round 190dv: LYNX's two short genre demos (core/DemoSongs.h) as .lynx files: --demosongs // (resources/demos/ in the repository) const auto i = args.indexOf ("--demosongs"); runDemoSongs (args[i + 1].unquoted()); return; } if (args.contains ("--perfgen")) { // round perfgate190id: the big-project performance gate's synthetic projects (core/PerfProjects.h) as .lynx // files with their WAVs: --perfgen [report.txt] [name,name...]; the save and load times in the report const auto i = args.indexOf ("--perfgen"); const auto report = i + 2 < args.size() && ! args[i + 2].startsWith ("--") ? args[i + 2].unquoted() : juce::String(); const auto only = i + 3 < args.size() && ! args[i + 3].startsWith ("--") ? args[i + 3].unquoted() : juce::String(); runPerfGen (args[i + 1].unquoted(), report, only); return; } if (args.contains ("--sandboxtest")) { const auto i = args.indexOf ("--sandboxtest"); runSandboxTest (args[i + 1].unquoted(), args[i + 2].unquoted()); return; } // round 190jg (BUILD-LIST 11 + 18, engine/HostingTests.h): grouped plugin processes, CLAP extensions, timing if (args.contains ("--sandboxgrouptest") || args.contains ("--sandboxbench") || args.contains ("--clapext") || args.contains ("--automationtimingtest") || args.contains ("--pluginbench")) { const auto value = [&args] (const char* name, int fallback) { return args.contains (name) ? args[args.indexOf (name) + 1].getIntValue() : fallback; }; auto code = 1; if (const auto i = args.indexOf ("--sandboxgrouptest"); i >= 0) code = lynx::runSandboxGroupTest (args[i + 1].unquoted(), args[i + 2].unquoted(), args.contains ("--crash") ? args[args.indexOf ("--crash") + 1].unquoted() : juce::String()); else if (const auto b = args.indexOf ("--sandboxbench"); b >= 0) code = lynx::runSandboxBench (args[b + 1].unquoted(), args[b + 2].unquoted(), value ("--plugins", 8), value ("--block", 256), args.contains ("--seconds") ? args[args.indexOf ("--seconds") + 1].getDoubleValue() : 5.0); else if (const auto pb = args.indexOf ("--pluginbench"); pb >= 0) // round 190of: per-plugin cost (engine/HostingTests.h) code = lynx::runPluginBench (args[pb + 1].unquoted(), args[pb + 2].unquoted(), value ("--block", 256), args.contains ("--rate") ? args[args.indexOf ("--rate") + 1].getDoubleValue() : 48000.0, args.contains ("--seconds") ? args[args.indexOf ("--seconds") + 1].getDoubleValue() : 4.0, value ("--types", 8), args.contains ("--names") ? args[args.indexOf ("--names") + 1].unquoted() : juce::String(), args.contains ("--editors")); else if (const auto c = args.indexOf ("--clapext"); c >= 0) code = lynx::runClapExtTest (args[c + 1].unquoted(), args[c + 2].unquoted()); else if (const auto t = args.indexOf ("--automationtimingtest"); t >= 0) code = lynx::runAutomationTimingTest (args[t + 1].unquoted(), args[t + 2].unquoted()); setApplicationReturnValue (code); quit(); return; } if (args.contains ("--bridge32test")) { // LYNX.exe --bridge32test "LYNX Test Synth 32.dll" report.txt [--compare "LYNX Test Synth.dll"] (round 176a): // the 32-bit plugin bridge (engine/Bridge32Test.cpp) const auto i = args.indexOf ("--bridge32test"); const auto compare = args.contains ("--compare") ? args[args.indexOf ("--compare") + 1].unquoted() : juce::String(); setApplicationReturnValue (lynx::runBridge32Test (args[i + 1].unquoted(), args[i + 2].unquoted(), compare)); quit(); return; } if (args.contains ("--rtstress")) { // LYNX.exe --rtstress project.(flp|lynx) report.txt [seconds] [--buffer N] [--type "driver type"] [--device "output"] // [--no-window] [--record take.wav]: the real app (window, audio device) plays the project and reports the callbacks // that missed their deadline (REA round 87); --type/--device pick another driver for this run only (round 97); // --record also records the input during the run, like Rec + Play, and moves the take to take.wav (round 106) const auto i = args.indexOf ("--rtstress"); const auto seconds = args[i + 3].getDoubleValue(); const auto buffer = args.contains ("--buffer") ? args[args.indexOf ("--buffer") + 1].getIntValue() : 0; juce::LookAndFeel::setDefaultLookAndFeel (&lookAndFeel); const auto option = [&args] (const char* name) { return args.contains (name) ? args[args.indexOf (name) + 1].unquoted() : juce::String(); }; runRealtimeStress (juce::File (args[i + 1].unquoted()), juce::File (args[i + 2].unquoted()), seconds > 0.0 ? seconds : 30.0, buffer, option ("--type"), option ("--device"), option ("--record")); return; } if (args.contains ("--renderaheadtest")) { // LYNX --renderaheadtest report.txt [project.flp|.lynx ...] [--buffer N] [--seconds S] (round 190gq): the engine's // own device callback (a stand-in device driven block by block, as --cliplooptest) plays the showcase song (from // the start, round a loop region that wraps mid-block, in Pattern mode) and each project with Options › Audio // settings › "Render ahead" off, then on. The two outputs must be the same to the bit, nothing rendered ahead // may be dropped, and most blocks must come from the ring. No window, no audio device. const auto i = args.indexOf ("--renderaheadtest"); juce::StringArray projects; for (int k = i + 2; k < args.size() && ! args[k].startsWith ("--"); ++k) projects.add (args[k].unquoted()); const auto buffer = args.contains ("--buffer") ? args[args.indexOf ("--buffer") + 1].getIntValue() : 128; const auto seconds = args.contains ("--seconds") ? args[args.indexOf ("--seconds") + 1].getDoubleValue() : 12.0; runRenderAheadTest (juce::File (args[i + 1].unquoted()), projects, juce::jlimit (16, 2048, buffer), seconds > 0.0 ? seconds : 12.0); return; } if (args.contains ("--cliplooptest")) { // LYNX --cliplooptest report.txt [export.wav] (round 167q, issue #25: 0.1.21 drew the repeats of a stretched // pattern clip but played the pattern once). The real engine's device callback (a stand-in device, driven // block by block) plays a synth's 1-bar pattern in a 4-bar clip: every repeat must sound as bar 1, also // starting inside a repeat, after a jump mid-clip and in a loop region; the WAV export (written to // export.wav and read back) the same. With the LYNX extra off, bars 2-4 must be silent (FL's behaviour). const auto i = args.indexOf ("--cliplooptest"); runClipLoopTest (juce::File (args[i + 1].unquoted()), args.size() > i + 2 && ! args[i + 2].startsWith ("--") ? juce::File (args[i + 2].unquoted()) : juce::File()); return; } if (args.contains ("--devicechangetest")) { // LYNX --devicechangetest report.txt [switches] [--plugin file]... (round 190c, issue #134: changing the // output device with a project open crashed LYNX). The engine plays a project of every instrument and effect // it can make here on stand-in devices with real callback threads, while the output device, its sample // rate and its buffer size change the way Settings > Audio changes them (8 kHz mono to 192 kHz, buffers of // 32 to 16384 samples, a device plugged in, the open one unplugged, one that refuses to open). After every // change the song must sound, finite, at the new rate. No window, no real audio or MIDI device. const auto i = args.indexOf ("--devicechangetest"); const juce::File report (args[i + 1].unquoted()); const auto switches = args.size() > i + 2 && ! args[i + 2].startsWith ("--") ? args[i + 2].getIntValue() : 0; juce::StringArray plugins; for (int k = 0; k + 1 < args.size(); ++k) if (args[k] == "--plugin") plugins.add (args[k + 1].unquoted()); auto text = std::make_shared(); // --quick: the selftest's handful of instruments and effects instead of every one const auto result = lynx::AudioEngine::deviceChangeSelfTest (switches > 0 ? switches : 40, ! args.contains ("--quick"), plugins, [report, text] (const juce::String& line) { *text << line << "\n"; report.replaceWithText (*text + "(running)\n"); // what was reached, if it crashes }); *text << "device_change=" << result << "\nresult=" << (result.startsWith ("OK") ? "OK" : "FAILED") << "\n"; report.replaceWithText (*text); setApplicationReturnValue (result.startsWith ("OK") ? 0 : 1); quit(); return; } if (args.contains ("--exportlivetest")) { // LYNX --exportlivetest report.txt [--plugin file]... (round 190jb): exports with the live plugin instances (as // FL renders) against playback on a stand-in device, the plugins given back afterwards. No window. const auto i = args.indexOf ("--exportlivetest"); const juce::File report (args[i + 1].unquoted()); juce::StringArray files; for (int k = 0; k + 1 < args.size(); ++k) if (args[k] == "--plugin") files.add (args[k + 1].unquoted()); juce::String text; const auto result = lynx::AudioEngine::exportLiveSelfTest ([&text] (const juce::String& line) { text << line << "\n"; }, files); text << "export_live=" << result << "\nresult=" << (result.startsWith ("OK") ? "OK" : "FAILED") << "\n"; report.replaceWithText (text); setApplicationReturnValue (result.startsWith ("OK") ? 0 : 1); quit(); return; } if (args.contains ("--sharetest")) { // LYNX --sharetest report.txt (round 190ks): the memory 8 identical SoundFont / Sampler channels // cost (LYNX_CONTENT_SHARE=0: byte copies held separately, as before). No window. const auto i = args.indexOf ("--sharetest"); const auto result = lynx::AudioEngine::shareMemorySelfTest (juce::File (args[i + 1].unquoted()), args[i + 2].unquoted()); juce::File (args[i + 3].unquoted()).replaceWithText ("share=" + result + "\nresult=" + (result.startsWith ("OK") ? "OK" : "FAILED") + "\n"); setApplicationReturnValue (result.startsWith ("OK") ? 0 : 1); quit(); return; } if (args.contains ("--padrectest")) { // LYNX --padrectest "" report.txt (round 190ks, GitHub #198): a take records the notes a // hosted plugin plays from its own window (the live engine on a stand-in device). No window. const auto i = args.indexOf ("--padrectest"); const auto result = lynx::AudioEngine::padRecordSelfTest (args[i + 1].unquoted()); juce::File (args[i + 2].unquoted()).replaceWithText ("pad_record=" + result + "\nresult=" + (result.startsWith ("OK") ? "OK" : "FAILED") + "\n"); setApplicationReturnValue (result.startsWith ("OK") ? 0 : 1); quit(); return; } if (args.contains ("--midiouttest")) { // LYNX --midiouttest report.txt (round 190jl): MIDI Out channels to the hardware MIDI outputs on their port // (the sender's dry run and the live engine on a stand-in device). No window. const auto i = args.indexOf ("--midiouttest"); const auto result = lynx::AudioEngine::midiOutPortSelfTest(); juce::File (args[i + 1].unquoted()).replaceWithText ("midi_out_ports=" + result + "\nresult=" + (result.startsWith ("OK") ? "OK" : "FAILED") + "\n"); setApplicationReturnValue (result.startsWith ("OK") ? 0 : 1); quit(); return; } if (args.contains ("--aratest")) { // LYNX --aratest [project.lynx] (round 190kx, engine/AraTest.cpp): ARA 2 // hosting end to end (a plain clip vs the clip in the ARA plugin, the document archived and restored). No window. const auto i = args.indexOf ("--aratest"); const juce::File out (args[i + 3].unquoted()); juce::String text; const auto result = lynx::araSelfTest (juce::File (args[i + 1].unquoted()), juce::File (args[i + 2].unquoted()), out, args.size() > i + 4 ? juce::File (args[i + 4].unquoted()) : juce::File(), [&text, out] (const juce::String& line) { text << line << "\n"; out.getChildFile ("aratest.txt").replaceWithText (text + "(running)\n"); }); text << "ara=" << result << "\nresult=" << (result.startsWith ("OK") ? "OK" : "FAILED") << "\n"; out.getChildFile ("aratest.txt").replaceWithText (text); setApplicationReturnValue (result.startsWith ("OK") ? 0 : 1); quit(); return; } if (args.contains ("--exportparitytest") || args.contains ("--midihotplugtest")) { // LYNX --exportparitytest report.txt (round 190gh, B7): the export against playback through a stand-in audio // device, stems adding up to the mix with one length, the PDC trim. LYNX --midihotplugtest report.txt (B8): // MIDI devices plugged in and out (stand-in device lists) while messages arrive. No window. const auto parity = args.contains ("--exportparitytest"); const auto i = args.indexOf (parity ? "--exportparitytest" : "--midihotplugtest"); const juce::File report (args[i + 1].unquoted()); juce::String text; const auto result = parity ? lynx::AudioEngine::exportParitySelfTest ([&text] (const juce::String& line) { text << line << "\n"; }) : lynx::AudioEngine::midiHotplugSelfTest(); text << (parity ? "export_parity=" : "midi_hotplug=") << result << "\nresult=" << (result.startsWith ("OK") ? "OK" : "FAILED") << "\n"; report.replaceWithText (text); setApplicationReturnValue (result.startsWith ("OK") ? 0 : 1); quit(); return; } if (args.contains ("--shortexportstress")) { // LYNX --shortexportstress report.txt [count] [--seed N] [--no-realtime] [--plugin file] (round 190hn, issue #138): `count` // random export settings over short sounds at the very start of the song, each exported again a bar later; a // file that comes out silent or quieter fails (engine/ShortExportTest.h). No window. const auto i = args.indexOf ("--shortexportstress"); const juce::File report (args[i + 1].unquoted()); const auto count = args.size() > i + 2 && ! args[i + 2].startsWith ("--") ? args[i + 2].getIntValue() : 200; const auto s = args.indexOf ("--seed"); const auto seed = s >= 0 && s + 1 < args.size() ? args[s + 1].getLargeIntValue() : juce::Time::currentTimeMillis(); auto text = std::make_shared(); const auto pl = args.indexOf ("--plugin"); lynx::shortexport::stress (count, seed, ! args.contains ("--no-realtime"), pl >= 0 && pl + 1 < args.size() ? args[pl + 1].unquoted() : juce::String(), [report, text] (const juce::String& line) { *text << line << "\n"; report.replaceWithText (*text + "(running)\n"); }, [this, report, text] (juce::String result) { *text << "short_export_stress=" << result << "\nresult=" << (result.startsWith ("OK") ? "OK" : "FAILED") << "\n"; report.replaceWithText (*text); setApplicationReturnValue (result.startsWith ("OK") ? 0 : 1); quit(); }); return; } if (args.contains ("--shortexporttest")) { // LYNX --shortexporttest report.txt [repeats] [--plugin file]... (round 190c, issue #138: a short note at // the very start of the Playlist exported quiet). Every instrument LYNX can make here, and a synth with // effects, tail modes, normalising and other rates, exported through the Export window's path (the job // made on the message thread, run on its own thread, the message loop running) with a 2-second note at // tick 0 and again with it at bar 2: the note must come out the same. No window. const auto i = args.indexOf ("--shortexporttest"); const juce::File report (args[i + 1].unquoted()); const auto repeats = args.size() > i + 2 && ! args[i + 2].startsWith ("--") ? args[i + 2].getIntValue() : 0; juce::StringArray plugins; for (int k = 0; k + 1 < args.size(); ++k) if (args[k] == "--plugin") plugins.add (args[k + 1].unquoted()); auto text = std::make_shared(); lynx::shortexport::run (! args.contains ("--quick"), repeats > 0 ? repeats : 3, plugins, // (--quick: a handful of instruments, round 190hn) [report, text] (const juce::String& line) { *text << line << "\n"; report.replaceWithText (*text + "(running)\n"); }, [this, report, text] (juce::String result) { *text << "short_export=" << result << "\nresult=" << (result.startsWith ("OK") ? "OK" : "FAILED") << "\n"; report.replaceWithText (*text); setApplicationReturnValue (result.startsWith ("OK") ? 0 : 1); quit(); }); return; } if (args.contains ("--slicexedittest")) { // LYNX --slicexedittest project script.txt report.txt [png-prefix] (round 190aj): the Slicex editor of the // project's first Slicex channel, off screen, driven by the script's commands (ui/SlicexEditor.h; mouse // gestures at fractions of the deck's width, the menu entries, shortcuts). The report holds each command // and what the state held after it; "shot " writes .png. const auto i = args.indexOf ("--slicexedittest"); runSlicexEditTest (juce::File (args[i + 1].unquoted()), juce::File (args[i + 2].unquoted()), juce::File (args[i + 3].unquoted()), args.size() > i + 4 ? args[i + 4].unquoted() : juce::String()); return; } if (args.contains ("--dwedittest")) { // LYNX --dwedittest project script.txt report.txt [png-prefix] (round 190hz): the DirectWave editor of the // project's first DirectWave channel, off screen, driven by the script's commands (ui/DirectWaveEditor.h); // "shot " writes .png. A project path "new" makes a new DirectWave channel. const auto i = args.indexOf ("--dwedittest"); runDirectWaveEditTest (args[i + 1].unquoted(), juce::File (args[i + 2].unquoted()), juce::File (args[i + 3].unquoted()), args.size() > i + 4 ? args[i + 4].unquoted() : juce::String()); return; } if (args.contains ("--slicexkeytest")) { // LYNX --slicexkeytest report.txt (round 190ac): what a click on the Slicex editor's keyboard sends // (AudioEngine::sendLiveNote on the channel, velocity 100/128) through the real engine's device callback // (a stand-in device, driven block by block): the key's region must sound, on the channel's mixer meter // too, another key must play another region, and the note-off must end it. runSlicexKeyTest (juce::File (args[args.indexOf ("--slicexkeytest") + 1].unquoted())); return; } if (args.contains ("--countinrectest")) { // LYNX --countinrectest report.txt (round 170d, the Busy Works video: the chord on the downbeat after the // pre-count was lost). The real engine's device callback (a stand-in device: 48 kHz, blocks of 512, 256 // samples of output latency) records a Song-mode take from bar 3 with a 1-bar count-in. Pass 1 finds where // the metronome's bar-3 click is heard; pass 2 plays MIDI notes stamped at the times they are heard around // it (a chord 15 ms early, a note in the count-in, one 3 ms after beat 2, one a bar for 6 bars) through // LYNX's MIDI input. Every note must land on the tick it was heard at (the chord on bar 3). const auto i = args.indexOf ("--countinrectest"); runCountInRecordTest (juce::File (args[i + 1].unquoted())); return; } if (args.contains ("--bendrectest")) { // LYNX --bendrectest report.txt [song|pattern] (round 167a, issue #12): pitch bend recording end to end. A // controller's pitch wheel is injected into LYNX's MIDI input (as a device would send it) while recording // plays: a held note and a wheel sweep 0 → full up → full down → centre. The recorded lane (pattern mode) or // automation clip (song mode) of the channel's pitch bend must follow the sweep. const auto i = args.indexOf ("--bendrectest"); const auto songMode = args.size() > i + 2 && args[i + 2] == "song"; runBendRecordTest (juce::File (args[i + 1].unquoted()), songMode); return; } if (args.contains ("--rectest")) { // LYNX --rectest report.txt [seconds] [--type T] [--device D] [--input I] [--loop] [--buffer N] // (round 163): records a click track through a loopback (cable, interface loopback or PipeWire's // pw-loopback): pings the round trip, plays a click on every beat from an audio clip, records it on Insert 1, // stops, and checks every recorded click's song position on the Playlist against its beat (samples). // --loop: loop recording over bars 2-4 (take lanes). --punch: punch in/out on bars 3-4 with 1 bar of pre-roll // and 1 of post-roll (playback stops by itself after the post-roll). const auto i = args.indexOf ("--rectest"); const auto option = [&args] (const char* name) { return args.contains (name) ? args[args.indexOf (name) + 1].unquoted() : juce::String(); }; const auto seconds = args.size() > i + 2 && ! args[i + 2].startsWith ("--") ? args[i + 2].getDoubleValue() : 20.0; runRecordTest (juce::File (args[i + 1].unquoted()), seconds > 0.0 ? seconds : 20.0, option ("--type"), option ("--device"), option ("--input"), args.contains ("--loop") ? 1 : args.contains ("--punch") ? 2 : 0, option ("--pdc").getIntValue(), option ("--buffer").getIntValue()); return; } if (args.contains ("--hwinserttest")) { // LYNX --hwinserttest report.txt [seconds] [--type T] [--device D] [--input I] [--buffer N] (round 164d): a // hardware insert through a loopback cable (output pair 1-2 -> input pair 1-2; the Master plays nowhere, so // the cable carries the send only). The same click track plays on two inserts: Insert 1 through the // hardware insert (panned left), Insert 2 dry (panned right). The insert's own ping measures the round // trip, PDC delays the dry path by it, and every click of the Master's left side must sit on the same // sample as the right side's. const auto i = args.indexOf ("--hwinserttest"); const auto option = [&args] (const char* name) { return args.contains (name) ? args[args.indexOf (name) + 1].unquoted() : juce::String(); }; const auto seconds = args.size() > i + 2 && ! args[i + 2].startsWith ("--") ? args[i + 2].getDoubleValue() : 10.0; // round 165c: --patcher puts the insert inside a Patcher on Insert 1; --bounce file.wav then exports the song in real // time through the device (Export › "Render through the hardware in real time") and offline, and compares them runHwInsertTest (juce::File (args[i + 1].unquoted()), seconds > 0.0 ? seconds : 10.0, option ("--type"), option ("--device"), option ("--input"), option ("--buffer").getIntValue(), args.contains ("--patcher"), args.contains ("--bounce") ? juce::File (option ("--bounce")) : juce::File()); return; } if (args.contains ("--uiperf")) { // LYNX --uiperf project.(flp|lynx) report.txt: the heavy UI cases in the real window, every frame timed (round 161) const auto i = args.indexOf ("--uiperf"); juce::LookAndFeel::setDefaultLookAndFeel (&lookAndFeel); runUiPerf (juce::File (args[i + 1].unquoted()), juce::File (args[i + 2].unquoted())); return; } if (args.contains ("--cachetest")) { // LYNX --cachetest project.(flp|lynx) report.txt (round 174f): the Playlist's cached picture against exact // paints after zooms, scrolls and repaints, off screen (no window) const auto i = args.indexOf ("--cachetest"); juce::LookAndFeel::setDefaultLookAndFeel (&lookAndFeel); runCacheTest (juce::File (args[i + 1].unquoted()), juce::File (args[i + 2].unquoted())); return; } if (args.contains ("--picturetest")) { // LYNX --picturetest report.txt [project.(flp|lynx)] (round 190bm): the Playlist and the Mixer drawn through // their cached pictures at 100-300 %, into native and software targets, against straight paints; off // screen (no window) const auto i = args.indexOf ("--picturetest"); juce::LookAndFeel::setDefaultLookAndFeel (&lookAndFeel); runPictureTest (juce::File (args[i + 1].unquoted()), i + 2 < args.size() ? juce::File (args[i + 2].unquoted()) : juce::File()); return; } if (args.contains ("--paintcachetest")) { // LYNX --paintcachetest report.txt (round 190ki): --selftest's paint_caches item alone (the shape tiles, the // cached FL toolbar tiles; LYNX_TILE_DEBUG= keeps the tiles' pictures as PNGs), off screen const auto i = args.indexOf ("--paintcachetest"); juce::LookAndFeel::setDefaultLookAndFeel (&lookAndFeel); auto result = lynx::theme::paintCacheSelfTest(); const auto tiles = lynx::flTileCacheSelfTest(); juce::File (args[i + 1].unquoted()).replaceWithText ("paint_caches=" + result + "\nfl_tiles=" + tiles + "\n"); setApplicationReturnValue (result.startsWith ("OK") && tiles == "OK" ? 0 : 1); quit(); return; } if (args.contains ("--timertest")) { // LYNX --timertest report.txt (round 174f): ui::TimerWhileShowing through hide / show / minimise (opens a small window) runTimerTest (juce::File (args[args.indexOf ("--timertest") + 1].unquoted())); return; } if (args.contains ("--livepeer")) { // LYNX --livepeer host|guest|rejoin [--relay URL] [--code CODE|@file]: one computer's side of a live // session between two real computers, no window (round 190ah) setApplicationReturnValue (lynx::livetest::runPeer (args)); quit(); return; } if (args.contains ("--offlinetest")) { // LYNX --offlinetest report.txt [--offline] (round 190nx): with LYNX_OFFLINE=1 or --offline every place that // would use the network refuses and says so. The test script runs it under `unshare -rn` with strace and counts // the connect() calls of internet sockets: zero (tests/offline-network-test.sh) const auto report = juce::File::getCurrentWorkingDirectory().getChildFile (args[args.indexOf ("--offlinetest") + 1].unquoted()); juce::String log; bool ok = true; auto check = [&] (bool good, const juce::String& what) { ok = ok && good; log << (good ? "ok " : "FAIL ") << what << "\n"; }; check (lynx::offline::enabled(), "offline mode is on"); { std::string why; check (! lynx::livelink::Connection::available (&why) && why.find ("offline") != std::string::npos, "live link unavailable: " + juce::String (why)); check (lynx::livelink::http ("GET", "https://relay.lynx-share.com/v1/health", {}, {}, "LYNX-test", 2).status == 0, "relay HTTP gives no answer, no connection tried"); } { lynx::AudioEngine offlineEngine (false); lynx::LiveSessionManager live (offlineEngine); lynx::LiveSessionManager::Options o; o.relay = "https://relay.lynx-share.com"; o.name = "Offline test"; o.inlineWork = true; live.start (o); check (live.getState() == lynx::LiveSessionManager::State::ended && ! live.isActive(), "Start live session refused: " + live.getStatus()); lynx::LiveSessionManager joiner (offlineEngine); joiner.join ("LYNX-AAAA-AAAA-AAAA-AAAA-AAAA", o); check (joiner.getState() == lynx::LiveSessionManager::State::ended && ! joiner.isActive(), "Join live session refused: " + joiner.getStatus()); } { const auto err = lynx::crashreporter::sendNow ("{\"offline\":\"test\"}"); check (err.containsIgnoreCase ("offline"), "crash report upload refused: " + err); } lynx::updater::startAutomaticCheck(); lynx::updater::checkNow(); lynx::updater::goBack(); check (true, "update check, update dialog and go-back opened no connection (see strace)"); log << (ok ? "RESULT OK\n" : "RESULT FAIL\n"); report.replaceWithText (log); setApplicationReturnValue (ok ? 0 : 1); quit(); return; } if (args.contains ("--livetest")) { // LYNX --livetest report.txt [--relay URL]: a live session of four peers over the relay (round 169b) setApplicationReturnValue (lynx::livetest::run (args)); quit(); return; } if (args.contains ("--selftest")) { const auto i = args.indexOf ("--selftest"); // round 190mo: a temp folder of this run alone (two runs at once shared the fixed temp names of its items), // and on Linux room for its main-thread stack (it reached 7.4 of the usual 8 MB: AudioEngines on the stack) selfTestTemp = lynx::platform::useOwnTempFolder ("lynx-selftest"); lynx::platform::allowMainThreadStack ((std::size_t) 64 << 20); runSelfTest (args[i + 1].unquoted(), args[i + 2].unquoted()); return; } if (args.contains ("--scan-one")) { // child process of the plugin scan (see PluginHost::scan) const auto i = args.indexOf ("--scan-one"); // no crash dialogs from the plugin being examined; and once the result is written, the process ends without // unloading it: a Waves shell crashed in its own teardown at exit (Intel GPU driver fail-fast, 0xC0000409), // which showed Windows' crash dialog and made the scan reject the whole shell (round 111) lynx::crashguard::quietCrashReports(); lynx::PluginHost::scanOneFile (args[i + 1].unquoted(), args[i + 2].unquoted(), juce::File (args[i + 3].unquoted())); lynx::crashguard::exitNow (0); } if (args.contains ("--splashshot")) { // LYNX --splashshot (round 190hd): the splash card drawn as the JUCE card is and as the card on its own // thread is (ui/Splash.h), side by side; no window const auto shots = lynx::writeSplashShots (juce::File (args[args.indexOf ("--splashshot") + 1].unquoted())); setApplicationReturnValue (shots.size() == 20 ? 0 : 1); quit(); return; } if (args.contains ("--browser-indexer")) { // round 190hd: the Browser's indexer, a low-priority child of the LYNX window (BrowserComponent.h): no window, // no session, no audio; it ends with its parent lynx::crashguard::quietCrashReports(); lynx::crashguard::exitNow (lynx::BrowserComponent::runIndexerProcess (args)); } if (args.contains ("--packageinfo")) { // round 165n: the Microsoft Store (MSIX) build's identity and folders (platform/Package.h); the release // workflow runs it inside the installed test package juce::File (args[args.indexOf ("--packageinfo") + 1].unquoted()).replaceWithText (lynx::platform::packageReport()); quit(); return; } if (args.contains ("--paths")) { // diagnostics: folders LYNX searches const auto programs = juce::File::getSpecialLocation (juce::File::globalApplicationsDirectory); juce::String report; report << "programs=" << programs.getFullPathName() << "\n"; for (const auto& dir : programs.getChildFile ("Image-Line").findChildFiles (juce::File::findDirectories, false, "FL Studio*")) report << "fl=" << dir.getFullPathName() << " packs=" << (int) dir.getChildFile ("Data").getChildFile ("Patches").getChildFile ("Packs").isDirectory() << "\n"; juce::File (args[args.indexOf ("--paths") + 1].unquoted()).replaceWithText (report); quit(); return; } if (args.contains ("--fldb")) { // diagnostics: LYNX.exe --fldb report.txt [project.flp]: the FL Studio installation, its plugin database, // the suggested plugin folders and, for a project, how each of its plugins resolves (read-only) const auto i = args.indexOf ("--fldb"); const auto fl = lynx::findFlStudio(); lynx::PluginHost host (false); juce::String report; report << "install=" << fl.installDir.getFullPathName() << "\nuserdata=" << fl.userData.getFullPathName() << "\n"; for (const auto& f : fl.vstFolders) report << "flvstfolder=" << f << "\n"; report << "dbfiles=" << host.flPluginDatabaseFiles() << " entries=" << (int) host.flPluginDatabase().entries().size() << "\n"; for (const auto& e : host.flPluginDatabase().entries()) report << " entry: " << juce::String::fromUTF8 (e.name.c_str()) << " | " << juce::String::fromUTF8 (e.path.c_str()) << " | role=" << e.role << "\n"; const auto suggested = host.suggestedFolders(); for (int k = 0; k < suggested.getNumPaths(); ++k) report << "folder=" << suggested[k].getFullPathName() << "\n"; if (const juce::File project (args[i + 2].unquoted()); project.existsAsFile()) { juce::MemoryBlock data; project.loadFileAsData (data); try { for (const auto& use : lynx::flpForeignPlugins (flp::parseProject ({ static_cast (data.getData()), data.getSize() }))) { juce::String how; const auto d = host.findForeign (use.plugin, use.instrument, &how); const auto* entry = host.flPluginDatabase().match (use.plugin, use.instrument); report << "plugin: " << juce::String::fromUTF8 (use.plugin.name.c_str()) << " -> " << (d ? d->fileOrIdentifier + " (" + how + ")" : juce::String ("not known")) << (entry != nullptr ? " | fl db: " + juce::String::fromUTF8 (entry->path.c_str()) : juce::String()) << "\n"; } const auto uses = lynx::flpForeignPlugins (flp::parseProject ({ static_cast (data.getData()), data.getSize() })); const auto candidates = host.filesToScanFor (uses); report << "scan_candidates=" << candidates.joinIntoString (";") << "\n"; if (args.contains ("--scan")) { // the targeted scan an open would run (child processes; the user's plugin list is not touched) report << "scanned_new=" << host.scanFiles (candidates, {}) << "\n"; for (const auto& use : uses) { juce::String how; const auto d = host.findForeign (use.plugin, use.instrument, &how); report << "after_scan: " << juce::String::fromUTF8 (use.plugin.name.c_str()) << " -> " << (d ? d->fileOrIdentifier + " (" + how + ")" : juce::String ("not known")) << "\n"; } } } catch (const flp::Error& e) { report << "error=" << e.what() << "\n"; } } juce::File (args[i + 1].unquoted()).replaceWithText (report); quit(); return; } if (args.contains ("--midisync-test")) { // LYNX --midisync-test report.txt ["output device"] ["input device"] (round 165f): MIDI clock timing const auto i = args.indexOf ("--midisync-test"); const auto out = args.size() > i + 2 && ! args[i + 2].startsWith ("--") ? args[i + 2].unquoted() : juce::String(); const auto in = args.size() > i + 3 && ! args[i + 3].startsWith ("--") ? args[i + 3].unquoted() : juce::String(); juce::File (args[i + 1].unquoted()).replaceWithText (lynx::MidiSyncIo::selfTest (out, in)); quit(); return; } if (args.contains ("--linktest")) { // LYNX --linktest report.txt [seconds] [peer] (round 190gl): Ableton Link with simulated audio callbacks; with // "peer" a second Link peer in this process, else a peer on the network (Ableton's LinkHut) is expected const auto i = args.indexOf ("--linktest"); const auto seconds = args.size() > i + 2 && ! args[i + 2].startsWith ("--") ? args[i + 2].getDoubleValue() : 20.0; const auto ownPeer = args.contains ("peer"); juce::File (args[i + 1].unquoted()).replaceWithText (juce::String (lynx::AbletonLink::selfTest (seconds > 0.0 ? seconds : 20.0, ownPeer))); quit(); return; } if (args.contains ("--devices") || args.contains ("--dispositivos")) // --dispositivos: legacy alias { // diagnostics: driver types and output devices JUCE offers (without opening any) juce::AudioDeviceManager manager; juce::String report; manager.getAvailableDeviceTypes(); if (auto pipeWire = lynx::makePipeWireDeviceType()) // Linux: LYNX's own PipeWire client (round 161) manager.addAudioDeviceType (std::move (pipeWire)); #if JUCE_LINUX report << lynx::describePipeWire() << "\n"; #endif for (auto* type : manager.getAvailableDeviceTypes()) { type->scanForDevices(); report << "type=" << type->getTypeName() << "\n"; for (const auto& name : type->getDeviceNames (false)) report << " output=" << name << "\n"; for (const auto& name : type->getDeviceNames (true)) report << " input=" << name << "\n"; } for (const auto& d : juce::MidiInput::getAvailableDevices()) report << "midi-in=" << d.name << "\n"; for (const auto& d : juce::MidiOutput::getAvailableDevices()) report << "midi-out=" << d.name << "\n"; const auto flag = args.contains ("--devices") ? args.indexOf ("--devices") : args.indexOf ("--dispositivos"); juce::File (args[flag + 1].unquoted()).replaceWithText (report); quit(); return; } if (args.contains ("--devicetest")) { // LYNX.exe --devicetest "type" "device" report.txt ["input device"] [--buffer N] [--roundtrip]: opens that output device (and, with the // 4th argument, an input: "*" = the same device / the driver's default input), receives 1 s of callbacks // writing silence, closes it and reports rate, block size, latency, callbacks and the input channels with // their peak level (driver check, no sound). --roundtrip: clicks out, found again on input 1 through a loopback // cable / PipeWire link: the round-trip latency (3 s) const auto i = args.indexOf ("--devicetest"); const auto typeName = args[i + 1].unquoted(), deviceName = args[i + 2].unquoted(); auto inputName = args.size() > i + 4 && ! args[i + 4].startsWith ("--") ? args[i + 4].unquoted() : juce::String(); const auto wantInput = inputName.isNotEmpty(); juce::String report; const juce::File reportFile (args[i + 3].unquoted()); auto step = [&] (const juce::String& line) { report << line << "\n"; reportFile.replaceWithText (report); }; // progress survives a driver that ends the process step ("step=start"); juce::AudioDeviceManager manager; manager.getAvailableDeviceTypes(); if (auto pipeWire = lynx::makePipeWireDeviceType()) manager.addAudioDeviceType (std::move (pipeWire)); std::unique_ptr device; for (auto* type : manager.getAvailableDeviceTypes()) if (type->getTypeName() == typeName) { type->scanForDevices(); if (wantInput && type->hasSeparateInputsAndOutputs()) { const auto inputs = type->getDeviceNames (true); if (inputName == "*" || ! inputs.contains (inputName)) { const auto index = type->getDefaultDeviceIndex (true); inputName = juce::isPositiveAndBelow (index, inputs.size()) ? inputs[index] : juce::String(); } for (const auto& n : inputs) step ("input_device=" + n); step ("input_chosen=" + inputName); } else if (wantInput) inputName = deviceName; step ("step=create"); device.reset (type->createDevice (deviceName, type->hasSeparateInputsAndOutputs() ? inputName : juce::String())); step ("step=created"); } struct Silence final : juce::AudioIODeviceCallback { std::atomic calls { 0 }, inputs { 0 }; std::array, 64> peaks {}; // --roundtrip (round 161): a click every quarter second on the outputs, found again on input 1 through a // loopback; the delays in samples bool roundtrip = false; int period = 12000; std::int64_t position = 0, lastClick = -1; std::vector delays; void audioDeviceIOCallbackWithContext (const float* const* in, int numIn, float* const* out, int channels, int n, const juce::AudioIODeviceCallbackContext&) override { for (int c = 0; c < channels; ++c) if (out[c] != nullptr) juce::FloatVectorOperations::clear (out[c], n); if (roundtrip) { for (int i = 0; i < n; ++i) { if (numIn > 0 && in[0] != nullptr && lastClick >= 0 && std::abs (in[0][i]) > 0.5f) { if (delays.size() < delays.capacity()) delays.push_back ((int) (position + i - lastClick)); lastClick = -1; } if ((position + i) % period == 0 && position + i > 0) { for (int c = 0; c < channels; ++c) if (out[c] != nullptr) out[c][i] = 0.9f; lastClick = position + i; } } position += n; } inputs.store (numIn); for (int c = 0; c < juce::jmin (numIn, 64); ++c) if (in[c] != nullptr) { const auto range = juce::FloatVectorOperations::findMinAndMax (in[c], n); const auto peak = juce::jmax (std::abs (range.getStart()), std::abs (range.getEnd())); if (peak > peaks[(std::size_t) c].load()) peaks[(std::size_t) c].store (peak); } ++calls; } void audioDeviceAboutToStart (juce::AudioIODevice*) override {} void audioDeviceStopped() override {} } silence; bool ok = false; if (device == nullptr) step ("error=device not found"); else { step ("step=open"); juce::BigInteger outputs; outputs.setRange (0, 2, true); const auto rates = device->getAvailableSampleRates(); const auto rate = device->getCurrentSampleRate() > 0 ? device->getCurrentSampleRate() : rates.contains (48000.0) ? 48000.0 : rates.isEmpty() ? 44100.0 : rates[0]; step ("rates=" + juce::String (rates.size()) + " chosen=" + juce::String (rate) + " default_block=" + juce::String (device->getDefaultBufferSize())); juce::BigInteger inputs; if (wantInput) { const auto names = device->getInputChannelNames(); step ("input_channels=" + juce::String (names.size())); for (int c = 0; c < names.size(); ++c) step (" in" + juce::String (c + 1) + "=" + names[c]); inputs.setRange (0, juce::jmin (64, names.size()), true); } // --buffer N: ask for that block size (REA round 97 latency survey); default: the driver's default const auto wantedBlock = args.contains ("--buffer") ? args[args.indexOf ("--buffer") + 1].getIntValue() : 0; const auto error = device->open (inputs, outputs, rate, wantedBlock > 0 ? wantedBlock : device->getDefaultBufferSize()); if (error.isNotEmpty()) step ("error=" + error); else { step ("step=start_callbacks"); silence.roundtrip = args.contains ("--roundtrip"); silence.period = juce::jmax (1, (int) (rate / 4)); silence.delays.reserve (64); device->start (&silence); juce::Thread::sleep (silence.roundtrip ? 3000 : 1000); device->stop(); if (silence.roundtrip) { auto d = silence.delays; std::sort (d.begin(), d.end()); report << "roundtrip_clicks=" << (int) d.size() << "\n"; if (! d.empty()) report << "roundtrip_samples=min " << d.front() << " median " << d[d.size() / 2] << " max " << d.back() << "\n" << "roundtrip_ms=" << juce::String (1000.0 * d[d.size() / 2] / device->getCurrentSampleRate(), 2) << "\n"; } report << "rate=" << device->getCurrentSampleRate() << "\n" << "block=" << device->getCurrentBufferSizeSamples() << "\n" << "output_latency=" << device->getOutputLatencyInSamples() << "\n" << "callbacks=" << silence.calls.load() << "\n"; if (wantInput) { report << "input_latency=" << device->getInputLatencyInSamples() << "\n" << "active_inputs=" << device->getActiveInputChannels().countNumberOfSetBits() << "\n" << "callback_inputs=" << silence.inputs.load() << "\n"; for (int c = 0; c < juce::jmin (64, silence.inputs.load()); ++c) report << " peak_in" << (c + 1) << "=" << juce::Decibels::gainToDecibels (silence.peaks[(std::size_t) c].load(), -150.0f) << " dB\n"; } ok = silence.calls.load() > 0 && (! wantInput || silence.inputs.load() > 0); device->close(); } } step (juce::String ("result=") + (ok ? "OK" : "FAILED")); setApplicationReturnValue (ok ? 0 : 1); quit(); return; } if (args.contains ("--pickertime")) { // LYNX.exe --pickertime report.txt (issue #209): the plugin lists' opening times with the profile's plugin // list (LYNX_PROFILE_MAIN samples the message thread meanwhile) const auto i = args.indexOf ("--pickertime"); juce::LookAndFeel::setDefaultLookAndFeel (&lookAndFeel); if (const auto profile = juce::SystemStats::getEnvironmentVariable ("LYNX_PROFILE_MAIN", {}); profile.isNotEmpty()) lynx::crashguard::startMainProfiler (profile.toStdString()); const auto t0 = juce::Time::getMillisecondCounterHiRes(); lynx::AudioEngine offline (false); const auto engineMs = juce::Time::getMillisecondCounterHiRes() - t0; const auto report = "engine_ms=" + juce::String (engineMs) + "\n" + lynx::pluginPickerTimings (offline); juce::File (args[i + 1].unquoted()).replaceWithText (report); lynx::crashguard::stopMainProfiler(); setApplicationReturnValue (0); quit(); return; } if (args.contains ("--plusmenutime")) { // LYNX --plusmenutime report.txt [watched] (round 190mf): the Channel rack "+" menu's build time (as // showAddChannelMenu builds it, without showing it) with the profile's plugin list and Plugin database // folder: the first one, then each one after the old two-second throttle ran out; then one after the // folder was marked changed. "watched": as the app (a folder watcher), else as before round 190mf. const auto i = args.indexOf ("--plusmenutime"); const auto watched = i + 2 < args.size() && args[i + 2] == "watched"; juce::LookAndFeel::setDefaultLookAndFeel (&lookAndFeel); lynx::AudioEngine offline (false); lynx::quickpick::installPluginDatabase (offline); std::unique_ptr watcher; if (watched) { const auto root = lynx::quickpick::pluginDatabaseFolder(); watcher = std::make_unique ( std::vector { root.getChildFile ("Effects").getFullPathName().toStdString(), root.getChildFile ("Generators").getFullPathName().toStdString() }, [] { juce::MessageManager::callAsync ([] { lynx::quickpick::markPluginDatabaseChanged(); }); }); lynx::quickpick::setPluginDatabaseWatched (true); } juce::String report; report << "types=" << offline.getPluginHost().getKnownPlugins().getNumTypes() << " watched=" << (watched ? 1 : 0) << "\n"; auto build = [&offline] (int& items) { const auto t0 = juce::Time::getMillisecondCounterHiRes(); juce::PopupMenu menu; auto picks = lynx::quickpick::renamedGenerators (offline, [] (lynx::ChannelDef) {}); lynx::quickpick::addPicks (menu, picks); lynx::quickpick::addGeneratorMenu (menu, offline, [] (lynx::ChannelDef) {}, [] {}, nullptr, nullptr); lynx::quickpick::addFolderViewItems (menu, offline); items = menu.getNumItems(); return juce::Time::getMillisecondCounterHiRes() - t0; }; auto line = [&report, &build] (const juce::String& what) { const auto readsBefore = lynx::quickpick::lastRefreshTimes().reads; int items = 0; const auto ms = build (items); const auto t = lynx::quickpick::lastRefreshTimes(); const auto read = t.reads != readsBefore; report << what << " menu_ms=" << juce::String (ms, 2) << " items=" << items << " folder_read=" << (read ? 1 : 0); if (read) report << " list_ms=" << juce::String (t.listMs, 2) << " read_ms=" << juce::String (t.readMs, 2); report << "\n"; }; line ("first"); for (int k = 1; k <= 5; ++k) { juce::Thread::sleep (2100); line ("again" + juce::String (k)); } for (int k = 1; k <= 3; ++k) line ("quick" + juce::String (k)); lynx::quickpick::markPluginDatabaseChanged(); line ("marked"); line ("after"); lynx::quickpick::setPluginDatabaseWatched (false); watcher.reset(); lynx::plugindb::finishInstalledWrites(); juce::File (args[i + 1].unquoted()).replaceWithText (report); setApplicationReturnValue (0); quit(); return; } if (args.contains ("--scantest")) { // LYNX.exe --scantest folder report.txt: scan (in child processes) without touching the user's list const auto i = args.indexOf ("--scantest"); lynx::PluginHost host (false); const auto found = host.scan (juce::FileSearchPath (args[i + 1].unquoted()), {}); juce::String report; report << "found=" << found << "\n"; for (const auto& t : host.getKnownPlugins().getTypes()) report << " " << (t.isInstrument ? "instrument: " : "effect: ") << t.name << "\n"; for (const auto& f : host.getKnownPlugins().getBlacklistedFiles()) report << " blacklisted: " << f << "\n"; juce::File (args[i + 2].unquoted()).replaceWithText (report); setApplicationReturnValue (found > 0 ? 0 : 1); quit(); return; } if (args.contains ("--wrappermiditest")) { // LYNX.exe --wrappermiditest plugin.dll report.txt (round 181c), with LYNX_TEST_VST2_MIDILOG set: what a // hosted plugin receives after a wrapper MIDI option changes while it runs const auto i = args.indexOf ("--wrappermiditest"); runWrapperMidiTest (args[i + 1].unquoted(), args[i + 2].unquoted()); return; } if (args.contains ("--wrappershot190oh")) { // LYNX --wrappershot190oh plugin [--open] (round 190oh, P3: FL's wrapper Settings › GUI): the // plugin (any format; an effect on insert 1) and its wrapper Settings tab drawn offscreen at 100 % and 150 %, // with FL's defaults and with "DPI aware" off + "Scale editor dimensions" on; --open also opens its editor // with each setting (a real window: Windows reports the editor windows' DPI awareness) -> report.txt const auto i = args.indexOf ("--wrappershot190oh"); runWrapperShot190oh (args[i + 1].unquoted(), args[i + 2].unquoted(), args.contains ("--open")); return; } if (args.contains ("--hotfixui190qp")) { // LYNX --hotfixui190qp [--plugin file]... (hotfix 0.1.31.1, round 190qp): the Clip-launch Arrangement's // track selection reaching the Device View, and channel / plugin windows opened and closed again and again // (src/HotfixUi190qp.inc); -checks.txt, result=OK const auto i = args.indexOf ("--hotfixui190qp"); juce::StringArray plugins; for (int k = 0; k + 1 < args.size(); ++k) if (args[k] == "--plugin") plugins.add (args[k + 1].unquoted()); runHotfixUi190qp (args[i + 1].unquoted(), plugins); return; } if (args.contains ("--pertabshot259")) { // LYNX --pertabshot259 [--plugin file]... [--shot-scale 1.5 --shot-suffix @150] (round 190pw, PR #259: // channel and plugin windows the size of the tab they show): src/PerTabShot259.inc const auto i = args.indexOf ("--pertabshot259"); juce::StringArray plugins; for (int k = 0; k + 1 < args.size(); ++k) if (args[k] == "--plugin") plugins.add (args[k + 1].unquoted()); runPerTabShot259 (args[i + 1].unquoted(), plugins); return; } if (args.contains ("--wrappershot")) { const auto i = args.indexOf ("--wrappershot"); runWrapperShot (args[i + 1].unquoted(), args[i + 2].unquoted()); return; } if (args.contains ("--multiouttest")) { const auto i = args.indexOf ("--multiouttest"); runMultiOutTest (args[i + 1].unquoted(), args[i + 2].unquoted()); return; } if (args.contains ("--vstitest")) { // LYNX --vstitest plugin folder [project.lynx] (round 190fw, issue #162): an instrument plugin (Image-Line's // "FL Studio VSTi") on a channel: notes in, audio out, its state through a saved project, its outputs and // the host tempo it follows. See runVstiTest. const auto i = args.indexOf ("--vstitest"); const auto project = i + 3 < args.size() && ! args[i + 3].startsWith ("--") ? args[i + 3].unquoted() : juce::String(); runVstiTest (args[i + 1].unquoted(), args[i + 2].unquoted(), project); return; } if (args.contains ("--vst2test")) { const auto i = args.indexOf ("--vst2test"); runVst2Test (args[i + 1].unquoted(), args[i + 2].unquoted()); return; } if (args.contains ("--issuesshot190qr")) { // --issuesshot190qr (round 190qr, issues #274-#281): src/IssuesShot190qr.inc setApplicationReturnValue (runIssuesShot190qr (args[args.indexOf ("--issuesshot190qr") + 1].unquoted()) ? 0 : 1); quit(); return; } if (args.contains ("--issuesshot190ll")) { // --issuesshot190ll (round 190ll, issues #200 / #203): src/IssuesShot190ll.inc setApplicationReturnValue (runIssuesShot190ll (args[args.indexOf ("--issuesshot190ll") + 1].unquoted()) ? 0 : 1); quit(); return; } if (args.contains ("--hostplaytest190ll")) { // LYNX --hostplaytest190ll report.txt "" [--buffer N] (round 190ll, issue #199): src/HostPlay190ll.inc const auto i = args.indexOf ("--hostplaytest190ll"); const auto buffer = args.contains ("--buffer") ? args[args.indexOf ("--buffer") + 1].getIntValue() : 1024; runHostPlayTest190ll (juce::File (args[i + 1].unquoted()), juce::File (args[i + 2].unquoted()), juce::jlimit (16, 4096, buffer)); return; } if (args.contains ("--vst3noteidtest")) { const auto i = args.indexOf ("--vst3noteidtest"); runVst3NoteIdTest (args[i + 1].unquoted(), args[i + 2].unquoted()); return; } if (args.contains ("--lv2scantest")) { runLv2ScanTest (args[args.indexOf ("--lv2scantest") + 1].unquoted()); return; } if (args.contains ("--wrappertest")) { const auto i = args.indexOf ("--wrappertest"); runWrapperTest (args[i + 1].unquoted(), args[i + 2].unquoted()); return; } if (args.contains ("--plugintest")) { const auto i = args.indexOf ("--plugintest"); // optional 3rd argument: the plugin's name inside a shell (e.g. "CLA-2A Stereo" in a WaveShell) const auto only = i + 3 < args.size() && ! args[i + 3].startsWith ("--") ? args[i + 3].unquoted() : juce::String(); runPluginTest (args[i + 1].unquoted(), args[i + 2].unquoted(), only); return; } if (args.contains ("--crashguardtest")) { // LYNX --crashguardtest "LYNX Test Crash.vst3|.clap" report.txt [process|memcpy] (round 190dt, // tools/testplugin/lynx_test_crash*.{c,cpp}): the plugin crashes in its 40th block on insert 1; LYNX must // catch it, mark the slot, keep playing the other inserts, save the project, reload the plugin; then the // saved project opens with the plugin crashing on its state; and LYNX's own faults are still crashes const auto i = args.indexOf ("--crashguardtest"); runCrashGuardTest (args[i + 1].unquoted(), args[i + 2].unquoted(), i + 3 < args.size() && ! args[i + 3].startsWith ("--") ? args[i + 3].unquoted() : juce::String ("process")); return; } if (args.contains ("--claprestarttest")) { // LYNX.exe --claprestarttest "LYNX Test Restart.clap" report.txt (tools/testplugin/lynx_test_restart.c) const auto i = args.indexOf ("--claprestarttest"); runClapRestartTest (args[i + 1].unquoted(), args[i + 2].unquoted()); return; } if (args.contains ("--multieditor255test")) { // LYNX --multieditor255test report.txt [::Name] ... (round 190ou, issue #255): several plugin editors open // and in use while a keyboard plays; the audio must keep running (src/MultiEditor255Test.inc) const auto i = args.indexOf ("--multieditor255test"); juce::StringArray plugins; for (int k = i + 2; k < args.size() && ! args[k].startsWith ("--"); ++k) plugins.add (args[k].unquoted()); runMultiEditor255Test (args[i + 1].unquoted(), plugins); return; } if (args.contains ("--issue258test")) { // LYNX --issue258test report.txt (round 190pv, issue #258): a cloned channel's own automation clip drives its // sound, through the app's engine with render-ahead off and on (src/Issue258Test.inc; Transistor Bass needs // FL Studio, LYNX_FL_INSTALL on Linux) runIssue258Test (args[args.indexOf ("--issue258test") + 1].unquoted()); return; } if (args.contains ("--autolive190qp")) { // LYNX --autolive190qp report.txt [--per-kind N] [--all-modes] (round 190qp, issue #253): the // project's automated mixer volumes, send levels and effect parameters heard and shown through the app's engine // (src/Hotfix190qpTest.inc) const auto i = args.indexOf ("--autolive190qp"); const auto perKind = args.contains ("--per-kind") ? args[args.indexOf ("--per-kind") + 1].getIntValue() : 2; runAutoLive190qpTest (args[i + 1].unquoted(), args[i + 2].unquoted(), perKind, args.contains ("--all-modes")); return; } if (args.contains ("--feel190qetest")) { // LYNX --feel190qetest report.txt [shot prefix [project]] (round 190qe, TOP-NEXT R1): edge scroll, view stack, zoom // glide and anchor, Restore selection, Keep labels on screen, off screen (src/Feel190qeTest.inc) const auto i = args.indexOf ("--feel190qetest"); const auto arg = [&args] (int k) { return k < args.size() && ! args[k].startsWith ("--") ? args[k].unquoted() : juce::String(); }; setApplicationReturnValue (runFeel190qeTest (arg (i + 1), arg (i + 2), arg (i + 3)) ? 0 : 1); quit(); return; } if (args.contains ("--qa190rfchild")) { // LYNX --qa190rfchild exit|display (round 190rf; --qa190rbtest starts it): a process with the hang // watch's thread running that ends through exit() ("exit": exit code 3 expected; the static hang watch's // destructor called std::terminate before) or whose display connection breaks ("display", Linux: exit code 1 // through crashguard::watchDisplayConnection, its session file names the lost display) const auto i = args.indexOf ("--qa190rfchild"); const auto mode = args[i + 1]; const juce::File folder (args[i + 2].unquoted()); folder.createDirectory(); lynx::crashguard::beginSession (folder.getChildFile ("session.txt").getFullPathName().toStdString(), "LYNX session\n"); lynx::crashguard::startHangWatch (folder.getFullPathName().toStdString()); if (mode == "exit") std::exit (3); #if JUCE_LINUX if (mode == "display") if (auto* xlib = dlopen ("libX11.so.6", RTLD_LAZY | RTLD_LOCAL)) { using OpenDisplay = void* (*) (const char*); using ConnectionNumber = int (*) (void*); using Sync = int (*) (void*, int); const auto open = (OpenDisplay) dlsym (xlib, "XOpenDisplay"); const auto number = (ConnectionNumber) dlsym (xlib, "XConnectionNumber"); const auto sync = (Sync) dlsym (xlib, "XSync"); if (auto* display = open != nullptr && number != nullptr && sync != nullptr ? open (nullptr) : nullptr) { lynx::crashguard::watchDisplayConnection (nullptr); ::shutdown (number (display), SHUT_RDWR); // (the server "went away") sync (display, 0); } } #endif std::_Exit (2); // (not reached when the display part ran) } if (args.contains ("--qa190rbtest")) { // LYNX --qa190rbtest report.txt (round 190rb, the 0.1.32 quality round's crash / memory fixes; also in // --selftest): src/Qa190rbCheck.inc juce::LookAndFeel::setDefaultLookAndFeel (&lookAndFeel); juce::String log; const auto result = qa190rbCheck (log); juce::File (args[args.indexOf ("--qa190rbtest") + 1].unquoted()).replaceWithText (log + "qa190rb=" + result + "\n"); setApplicationReturnValue (result == "OK" ? 0 : 1); quit(); return; } if (args.contains ("--issues190qrtest")) { // LYNX --issues190qrtest report.txt (round 190qr, issues #274-#281; also in --selftest): src/Issues190qrCheck.inc juce::LookAndFeel::setDefaultLookAndFeel (&lookAndFeel); juce::String log; const auto result = issues190qrCheck (log); juce::File (args[args.indexOf ("--issues190qrtest") + 1].unquoted()).replaceWithText (log + "issues190qr=" + result + "\n"); setApplicationReturnValue (result == "OK" ? 0 : 1); quit(); return; } if (args.contains ("--hwheel254test")) { // LYNX --hwheel254test report.txt (round 190ou, issue #254): the horizontal wheel in the Playlist (three layouts), // Piano roll, Mixer and Browser, off screen (src/HWheel254Test.inc) const auto i = args.indexOf ("--hwheel254test"); setApplicationReturnValue (runHWheel254Test (args[i + 1].unquoted()) ? 0 : 1); quit(); return; } if (args.contains ("--determinismtest190po")) { // LYNX --determinismtest190po report.txt (round 190po, engine/Determinism190poTest.cpp): a render is the same // bit for bit on one thread and on several, and two exports have one hash (Windows: the x87 precision) const auto i = args.indexOf ("--determinismtest190po"); juce::String lines; const auto result = lynx::determinism190po::check ([&lines] (const juce::String& line) { lines << line << "\n"; }); juce::File (args[i + 1].unquoted()).replaceWithText (lines + "determinism190po=" + result + "\n"); setApplicationReturnValue (result.startsWith ("OK") ? 0 : 1); quit(); return; } if (args.contains ("--renderagaintest")) { // LYNX --renderagaintest report.txt (round 190ou, engine/RenderAgainTest.cpp): offline renders made again const auto i = args.indexOf ("--renderagaintest"); juce::String lines; const auto result = lynx::renderagain::check ([&lines] (const juce::String& line) { lines << line << "\n"; }); juce::File (args[i + 1].unquoted()).replaceWithText (lines + "renderagain190ou=" + result + "\n"); setApplicationReturnValue (result.startsWith ("OK") ? 0 : 1); quit(); return; } if (args.contains ("--jsfxtest") || args.contains ("--jsfxbench")) { // LYNX --jsfxtest : the JSFX format end to end (round 190pj, issue #241; also in --selftest), report in // /jsfx-selftest.txt. LYNX --jsfxbench : CPU per instance of every bundled script. const auto test = args.contains ("--jsfxtest"); const auto i = args.indexOf (test ? "--jsfxtest" : "--jsfxbench"); const juce::File out (args[i + 1].unquoted()); juce::String result; if (test) { out.createDirectory(); result = lynx::jsfx::selfTest (out); out.getChildFile ("report.txt").replaceWithText ("jsfx190pj=" + result + "\n"); } else result = lynx::jsfx::bench (out); std::cout << result << std::endl; setApplicationReturnValue (result.startsWith ("OK") ? 0 : 1); quit(); return; } if (args.contains ("--clapteardowntest")) { // LYNX.exe --clapteardowntest "LYNX Test Restart.clap" report.txt (round 190az, engine/ClapTeardownTest.cpp) const auto i = args.indexOf ("--clapteardowntest"); lynx::runClapTeardownTest (args[i + 1].unquoted(), args[i + 2].unquoted(), [this] (int code) { setApplicationReturnValue (code); quit(); }); return; } if (args.contains ("--mpetest")) { // LYNX.exe --mpetest "LYNX Test MPE.clap" report.txt (tools/testplugin/lynx_test_mpe.c, issue #108) const auto i = args.indexOf ("--mpetest"); runMpeTest (args[i + 1].unquoted(), args[i + 2].unquoted()); return; } if (args.contains ("--mpeplaytest190hy")) { // LYNX --mpeplaytest190hy plugin.(clap|vst3) report.txt (round 190hy, issue #108): a song note with a pitch // curve played by a hosted plugin with MPE on, through the whole song path (scheduler, renderer, the wrapper's // MPE / CLAP note expressions), rendered offline; the pitch heard is measured (report.txt, report.wav) const auto i = args.indexOf ("--mpeplaytest190hy"); runMpePlayTest190hy (args[i + 1].unquoted(), args[i + 2].unquoted()); return; } if (args.contains ("--editortest")) { // LYNX.exe --editortest plugin.vst3 report.txt ["name"]: opens the plugin's own editor in a window for a few // seconds, then closes it (a plugin whose UI crashes the host ends the process before the report says OK) const auto i = args.indexOf ("--editortest"); const auto only = i + 3 < args.size() && ! args[i + 3].startsWith ("--") ? args[i + 3].unquoted() : juce::String(); runEditorTest (args[i + 1].unquoted(), args[i + 2].unquoted(), only); return; } if (args.contains ("--editorcrashtest")) { // LYNX.exe --editorcrashtest "LYNX Test Crash.clap" report.txt (issue #32, round 174a; Windows): the test // plugin's editor faults in its own window procedure (LYNX_TEST_CRASH=editor). LYNX must catch it, close // that editor, record the trace and keep running its message loop. const auto i = args.indexOf ("--editorcrashtest"); runEditorCrashTest (args[i + 1].unquoted(), args[i + 2].unquoted()); return; } if (args.contains ("--reloadtest")) { // LYNX --reloadtest plugin report.txt [shots folder] [--wait-kill]: round 190ao (reload a crashed plugin). // Hosts the plugin in a separate process (a channel for an instrument, insert 1 for an effect) in an offline // engine, crashes its process (--wait-kill: writes .pid and waits for the process to be killed // from outside), checks that nothing reloads by itself, reloads it on request and checks the new process, // the state captured last, the untouched song and undo history; twice. With a shots folder: PNGs of the // plugin window's crash notice and of the prompt. const auto i = args.indexOf ("--reloadtest"); runReloadTest (args[i + 1].unquoted(), args[i + 2].unquoted(), i + 3 < args.size() && ! args[i + 3].startsWith ("--") ? args[i + 3].unquoted() : juce::String(), args.contains ("--wait-kill")); return; } if (args.contains ("--pluginoptionstest")) { // LYNX --pluginoptionstest plugin report.txt [shots folder]: round 190ao. Hosts the plugin inside LYNX (a // channel for an instrument, insert 1 for an effect) in an offline engine, opens its window and checks // LYNX's own plugin-window options: Pin on top (set, kept above another window, saved with the plugin, // back when the window opens again). With a shots folder: PNGs of each state. The window is on screen. const auto i = args.indexOf ("--pluginoptionstest"); runPluginOptionsTest (args[i + 1].unquoted(), args[i + 2].unquoted(), i + 3 < args.size() && ! args[i + 3].startsWith ("--") ? args[i + 3].unquoted() : juce::String()); return; } if (args.contains ("--plugwintest")) { // LYNX --plugwintest plugin report.txt ["name"] [seconds]: round 162d. Puts the plugin in a channel (an // instrument) or on insert 1 (an effect) of an offline engine, opens its plugin window (wrapper header, // presets), checks a preset round trip, keeps the window `seconds` on screen (default 15: time for xdotool / // screenshots), then removes the plugin from the song and reports whether its window closed by itself. const auto i = args.indexOf ("--plugwintest"); const auto only = i + 3 < args.size() && ! args[i + 3].startsWith ("--") && ! args[i + 3].containsOnly ("0123456789") ? args[i + 3].unquoted() : juce::String(); auto seconds = 15; for (int k = i + 3; k < juce::jmin (args.size(), i + 5); ++k) if (args[k].containsOnly ("0123456789")) seconds = args[k].getIntValue(); runPlugWinTest (args[i + 1].unquoted(), args[i + 2].unquoted(), only, seconds); return; } if (args.contains ("--zorder191test")) { // LYNX --zorder191test report.txt [plugin.vst3]: issue #191 (round 190mx), ui/ZOrder191Test.h const auto i = args.indexOf ("--zorder191test"); const auto plugin = i + 2 < args.size() && ! args[i + 2].startsWith ("--") ? args[i + 2].unquoted() : juce::String(); lynx::runZOrder191Test (args[i + 1].unquoted(), plugin, &lookAndFeel, [this] (bool ok) { setApplicationReturnValue (ok ? 0 : 1); quit(); }); return; } if (args.contains ("--fittest")) { // LYNX.exe --fittest report.txt [percent]: round 163 — at that UI zoom (default 150) a window taller than // the screen and a big resizable window that grows with a zoom change keep their title bar and close // button on the screen. The windows show for about two seconds. const auto i = args.indexOf ("--fittest"); runFitTest (args[i + 1].unquoted(), i + 2 < args.size() ? args[i + 2].getIntValue() : 150); return; } if (args.contains ("--windowtest")) { // LYNX.exe --windowtest report.txt: opens the Quick-add palette, the Audio editor, a plugin-like window and a name dialog // over the main window and checks that each one stays in front, owned by the main window, with the // keyboard focus (issue #4). The windows appear on screen for a few seconds. runWindowTest (args[args.indexOf ("--windowtest") + 1].unquoted()); return; } if (args.contains ("--minimizeclicktest")) { // LYNX --minimizeclicktest report.txt (issue #188, round 190ir): a tool window over the main window is // minimised (through the window manager), the main window comes to the front, and a click where the tool // window was must reach the main window's component. Run it under a window manager (openbox on a private // Xvfb); exit code 0 = OK. runMinimizeClickTest (args[args.indexOf ("--minimizeclicktest") + 1].unquoted()); return; } if (args.contains ("--focustest")) { // LYNX --focustest report.txt (issue #161): the main window with the Playlist and the Piano roll (native // child windows with docking on). For each: LYNX goes to the background (the main window loses the focus), // the user comes back with a click in the panel, then presses Space: playback must start. Also: a text // field's focus comes back with the window, and inside the active window the click's answer is unchanged. // Shows a window (takes the foreground on Windows: GUI lock); exit code 0 = OK. runFocusTest (args[args.indexOf ("--focustest") + 1].unquoted()); return; } if (args.contains ("--simplekeytest")) { // LYNX --simplekeytest report.txt (round 190fc, 0.1.27 RC H2): the main window in the Simple layout; after a // demo opened from Welcome › Start from and after clicks in the dock, its tabs, the Lyrics button, a track // header and the grid, Space must start playback (a text field clicked into keeps its typing keys). Shows a // window (takes the foreground on Windows: GUI lock); exit code 0 = OK. runSimpleKeyTest (args[args.indexOf ("--simplekeytest") + 1].unquoted()); return; } if (args.contains ("--pluginstyle")) // round 126: force one style for this run (glow, neon, hardware, vivid; auto = per plugin) { const auto i = args.indexOf ("--pluginstyle"); if (i + 1 < args.size()) { const auto name = args[i + 1].unquoted(); lynx::skin::setForcedStyle (name.equalsIgnoreCase ("auto") ? -1 : (int) lynx::skin::styleFromName (name)); } } if (args.contains ("--gfxprobe")) { // LYNX.exe --gfxprobe report.txt (round 170c, issue #11): renderer checks on this platform's native images — // text drawn with a gradient fill (a word with a space in it) and an empty path filled with a gradient must // stay inside their shapes. JUCE 8.0.4's CoreGraphics renderer (macOS) clipped to an empty glyph or path as // "no clip" and flooded the whole component (Facet EQ's blank pink window). const auto i = args.indexOf ("--gfxprobe"); juce::File (args[i + 1].unquoted()).replaceWithText (lynx::skin::rendererProbeReport()); quit(); return; } if (args.contains ("--steppertest")) { // LYNX.exe --steppertest : round 170c (#14) — every value stepper of every generated effect editor // driven by synthetic input (arrows, click on the value, drag, wheel, trackpad); ends with result=OK / FAIL const auto i = args.indexOf ("--steppertest"); juce::LookAndFeel::setDefaultLookAndFeel (&lookAndFeel); juce::String report; int fails = 0, count = 0, skips = 0; { lynx::AudioEngine offline (false); auto kinds = lynx::plugui::flLayoutKinds(); for (const auto own : lynx::plugui::ownLayoutKinds()) kinds.push_back (own); // FL's Default preset when the installation has one (the state-backed controls need FL's state) const auto roots = lynx::findFlStudioRoots(); const auto presets = juce::File (juce::String::fromUTF8 (roots.data.c_str())).getChildFile ("Patches/Plugin presets/Effects"); for (const auto kind : kinds) { auto fx = lynx::makeEffectSlot (kind); for (const auto& plugin : lynx::flPluginsForEffect (kind)) { juce::MemoryBlock data; const auto file = presets.getChildFile (juce::String::fromUTF8 (plugin.c_str())).getChildFile ("Default.fst"); if (file.existsAsFile() && file.loadFileAsData (data)) { const auto* bytes = static_cast (data.getData()); if (auto loaded = lynx::effectFromFlPreset (std::vector (bytes, bytes + data.getSize()), 130.0, lynx::natives::flDataReader (lynx::flStudioAccess())); loaded && loaded->kind == kind) fx = *loaded; } break; } lynx::Song song; song.mixer.resize (2); song.mixer[0].name = "Master"; song.mixer[1].name = "Insert 1"; song.mixer[1].effects.push_back (fx); offline.setSong (std::move (song)); offline.dispatchPendingMessages(); const auto lines = lynx::stepperSelfTest (offline, 1, 0, (int) lynx::plugui::layoutFor (kind).pages.size()); for (const auto& line : juce::StringArray::fromLines (lines)) if (line.isNotEmpty()) { ++count; fails += line.contains (": FAIL") ? 1 : 0; skips += line.contains (": SKIP") ? 1 : 0; } report << lines; juce::PopupMenu::dismissAllActiveMenus(); offline.dispatchPendingMessages(); } } report << "steppers=" << count << " failures=" << fails << " skipped=" << skips << "\nresult=" << (fails == 0 && count > 0 ? "OK" : "FAIL") << "\n"; juce::File (args[i + 1].unquoted()).replaceWithText (report); quit(); return; } if (args.contains ("--design190inshot")) { // LYNX --design190inshot prefix [project.flp]: round 190in off screen (no desktop window, no audio device) — // the channel window as it shows docked (FL's ▸, two-tone title, presets in the title bar, the 46 px strip // with icon tabs, LED, knobs, RANGE / TRACK badges) on each tab, the floating strip, and FL's ▸ menu const auto i = args.indexOf ("--design190inshot"); runDesign190inShot (args[i + 1].unquoted(), i + 2 < args.size() && ! args[i + 2].startsWith ("--") ? args[i + 2].unquoted() : juce::String()); quit(); return; } if (args.contains ("--plugui")) { // LYNX.exe --plugui : the native effect editors at FL's size (one PNG per editor and page), each // loaded with the FL plugin's Default preset when the FL installation has one const auto i = args.indexOf ("--plugui"); runPluginEditorSnapshots (args[i + 1].unquoted()); return; } if (args.contains ("--parityshot")) { // LYNX.exe --parityshot []: one built-in effect's editor with the given // parameters ("index value" lines, tools/fxrender --dump), its displays fed by the demo song — the LYNX side // of the third-party parity pictures (round tp172b) const auto i = args.indexOf ("--parityshot"); runParityShot (args[i + 1].unquoted(), args[i + 2].unquoted(), i + 3 < args.size() ? args[i + 3].unquoted() : juce::String()); if (parityShotFailed) setApplicationReturnValue (2); if (parityShow == nullptr) quit(); return; } if (args.contains ("--design168rshot")) { // LYNX.exe --design168rshot : round 168r's editors (FL effects that had a generated page and LYNX's own // simple built-ins) at 100 % and 200 %, with their default settings and, when they have one, the first // preset of LYNX's own bank. "--design168rshot generated": the generated pages they had before const auto i = args.indexOf ("--design168rshot"); if (i + 2 < args.size() && args[i + 2] == "generated") lynx::plugui::showGeneratedLayoutsOnly (true); runDesign168rShots (args[i + 1].unquoted()); quit(); return; } if (args.contains ("--eq166fshot")) { // LYNX.exe --eq166fshot : round 166f's pictures (issue #16) — Parametric EQ 2's spectrum and heatmap // (flat, a +12 dB band, a -12 dB band, Top position) and Facet EQ's comparative EQ (listening to the target, // its spectrum over the source's), each fed by the demo song rendered offline const auto i = args.indexOf ("--eq166fshot"); runEq166fShots (args[i + 1].unquoted()); quit(); return; } if (args.contains ("--editorcpu")) { // LYNX.exe --editorcpu report.txt: opens built-in plugin editors one at a time in a small window (no audio // device: a silent, idle editor) and writes the process CPU each costs while idle and while its display // animates (demo signal) — round 122's check that an idle editor burns no CPU const auto i = args.indexOf ("--editorcpu"); runEditorCpu (args[i + 1].unquoted()); return; } if (args.contains ("--precomputeshot")) { // LYNX.exe --precomputeshot project.(flp|lynx) : round 167h — -precompute.png (channel 1's // Precomputed effects panel) and -project.png (Options › Project with "Fast declick for cut groups") const auto i = args.indexOf ("--precomputeshot"); juce::LookAndFeel::setDefaultLookAndFeel (&lookAndFeel); lynx::AudioEngine shotEngine (false); const juce::File input (args[i + 1].unquoted()); const auto prefix = args[i + 2].unquoted(); juce::String error; bool ok = false; if (input.hasFileExtension ("flp")) ok = shotEngine.importFlpFile (input, error); else if (auto song = lynx::ProjectFile::load (input, error)) shotEngine.setSong (std::move (*song)), ok = true; shotEngine.dispatchPendingMessages(); auto shoot = [&] (std::unique_ptr c, const juce::String& name) { if (c == nullptr) return false; if (c->getWidth() <= 0) c->setSize (520, 600); savePng (lynx::shot::snapshot (*c), prefix + name); return true; }; ok = ok && shoot (lynx::makeChannelPrecomputePanel (shotEngine, 0), "-precompute.png"); ok = ok && shoot (lynx::makeSettingsPanel (shotEngine, lynx::SettingsPage::project), "-project.png"); setApplicationReturnValue (ok ? 0 : 1); quit(); return; } if (args.contains ("--pluginthumbs")) { // LYNX.exe --pluginthumbs [key,key...]: the Plugin picker's pictures of LYNX's own plugins (round 171c, // ui/PluginThumbs.h), each editor drawn off-screen and kept as /.png; the picker starts this in // the background when pictures are missing. One line per plugin on stdout. const auto i = args.indexOf ("--pluginthumbs"); lynx::crashguard::quietCrashReports(); juce::LookAndFeel::setDefaultLookAndFeel (&lookAndFeel); juce::StringArray only; if (i + 2 < args.size() && ! args[i + 2].startsWith ("--")) only.addTokens (args[i + 2].unquoted(), ",", ""); const auto t0 = juce::Time::getMillisecondCounterHiRes(); // round 190bi: with --shot-scale / LYNX_SHOT_SCALE each plugin's whole editor at that scale, not the picker's // small thumbnail (never for the picker's own cache folder, whatever the environment says) const juce::File folder (args[i + 1].unquoted()); const auto full = lynx::shot::given() && folder != lynx::pluginthumbs::nativeFolder() ? lynx::shot::scale() : 0.0f; const auto drawn = lynx::pluginthumbs::renderNative (folder, only, [] (const juce::String& line) { std::printf ("%s\n", line.toRawUTF8()); std::fflush (stdout); }, full); std::printf ("drawn %d in %.0f ms\n", drawn, juce::Time::getMillisecondCounterHiRes() - t0); setApplicationReturnValue (0); quit(); return; } if (args.contains ("--jsonroundtrip")) { // LYNX.exe --jsonroundtrip : round 183c's finding — a project saved, loaded and saved again: both texts // (a.json, b.json) and the first lines that differ (diff.txt) for the default song, with and without a Patcher const auto i = args.indexOf ("--jsonroundtrip"); const juce::File out (args[i + 1].unquoted()); out.createDirectory(); juce::String report; auto check = [&] (const lynx::Song& song, const juce::String& name) { const auto a = lynx::ProjectFile::toJson (song); juce::String error; const auto back = lynx::ProjectFile::fromJson (a, error); const auto b = back ? lynx::ProjectFile::toJson (*back) : juce::String ("(not loaded: " + error + ")"); out.getChildFile (name + "-a.json").replaceWithText (a); out.getChildFile (name + "-b.json").replaceWithText (b); juce::StringArray la, lb; la.addLines (a); lb.addLines (b); report << name << ": " << (a == b ? "stable" : "DIFFERS") << " (" << la.size() << " / " << lb.size() << " lines)\n"; int shown = 0; for (int k = 0; k < juce::jmax (la.size(), lb.size()) && shown < 12; ++k) if (la[k] != lb[k]) { report << " line " << (k + 1) << "\n a: " << la[k].trim().substring (0, 200) << "\n b: " << lb[k].trim().substring (0, 200) << "\n"; ++shown; } }; auto song = lynx::Song::makeDefault(); check (song, "default"); song.mixer.resize (3); song.mixer[1].effects = { lynx::makeEffectSlot (lynx::EffectKind::patcher) }; check (song, "patcher"); song.mixer[1].effects = { lynx::rack::makeRackSlot (lynx::RackDoc::Kind::audioEffect) }; check (song, "rack"); out.getChildFile ("diff.txt").replaceWithText (report); setApplicationReturnValue (0); quit(); return; } // --prshot190jv (round 190jv: Piano roll › Scale highlighting › Automatic): src/PrShot190jv.inc if (args.contains ("--prshot190jv")) { setApplicationReturnValue (runPrShot190jv (juce::File (args[args.indexOf ("--prshot190jv") + 1].unquoted())) ? 0 : 1); quit(); return; } // --prchord190kd (round 190kd: FL's chord tool strip, scale shading, rack name alignment): src/PrChordShot190kd.inc if (args.contains ("--prchord190kd")) { setApplicationReturnValue (runPrChordShot190kd (juce::File (args[args.indexOf ("--prchord190kd") + 1].unquoted())) ? 0 : 1); quit(); return; } // --keys190nu (round chord2_190nu: key regions, the Scale degree chord, pinned Chord helper relationships) if (args.contains ("--keys190nu")) { setApplicationReturnValue (runKeysShot190nu (juce::File (args[args.indexOf ("--keys190nu") + 1].unquoted())) ? 0 : 1); quit(); return; } // --modal190mc (round 190mc: the Chord helper, Transistor Bass's program row): src/ModalShot190mc.inc if (args.contains ("--modal190mc")) { setApplicationReturnValue (runModalShot190mc (juce::File (args[args.indexOf ("--modal190mc") + 1].unquoted())) ? 0 : 1); quit(); return; } // --trimshot190jv (round 190jv: Mixer menu › Trim unused tracks): src/TrimShot190jv.inc if (args.contains ("--trimshot190jv")) { setApplicationReturnValue (runTrimShot190jv (juce::File (args[args.indexOf ("--trimshot190jv") + 1].unquoted())) ? 0 : 1); quit(); return; } // --undogesture190jv (round 190jv, queue item 73: one undo step per drag): src/UndoGesture190jv.inc if (args.contains ("--undogesture190jv")) { setApplicationReturnValue (runUndoGesture190jv (juce::File (args[args.indexOf ("--undogesture190jv") + 1].unquoted())) ? 0 : 1); quit(); return; } // --simplegb190keshot (round 190ke: tuner, fade-out, Controls tab, LYNX content): src/SimpleGbShot190ke.inc if (args.contains ("--simplegb190keshot")) { setApplicationReturnValue (runSimpleGbShot190ke (juce::File (args[args.indexOf ("--simplegb190keshot") + 1].unquoted())) ? 0 : 1); quit(); return; } // --browsershot190iz (round 190iz: FL's tabs, tags, Live's browser): src/BrowserShot190iz.inc // --qarest190lcshot [Live set] (rollup step 7: QA-8's View menu submenu, QA-2's take lanes in Simple): // src/QaRest190lcShot.inc if (args.contains ("--qarest190lcshot")) { const auto i = args.indexOf ("--qarest190lcshot"); const auto set = i + 2 < args.size() && ! args[i + 2].startsWith ("--") ? args[i + 2].unquoted() : juce::String(); setApplicationReturnValue (runQaRest190lcShot (juce::File (args[i + 1].unquoted()), set) ? 0 : 1); quit(); return; } // --loopinfo190kxshot (round 190kx: loop key / tempo in the Simple rows, the Loop Browser, the clip menu) if (args.contains ("--loopinfo190kxshot")) { setApplicationReturnValue (runLoopInfoShot190kx (juce::File (args[args.indexOf ("--loopinfo190kxshot") + 1].unquoted())) ? 0 : 1); quit(); return; } // --loopshot190kf (round gaps190kf: the Loop Browser): src/LoopShot190kf.inc if (args.contains ("--loopshot190kf")) { setApplicationReturnValue (runLoopShot190kf (juce::File (args[args.indexOf ("--loopshot190kf") + 1].unquoted())) ? 0 : 1); quit(); return; } if (args.contains ("--lynxmodelshot190ni")) { // LYNX --lynxmodelshot190ni prefix: round 190ni, LYNX Model's window per preset, its Browser entry, checks setApplicationReturnValue (runLynxModelShot190ni (args[args.indexOf ("--lynxmodelshot190ni") + 1].unquoted()) ? 0 : 1); quit(); return; } if (args.contains ("--browsershot190iz")) { setApplicationReturnValue (runBrowserShot190iz (juce::File (args[args.indexOf ("--browsershot190iz") + 1].unquoted())) ? 0 : 1); quit(); return; } if (args.contains ("--rackshot")) { // LYNX.exe --rackshot : round 183c's Rack view drawn off-screen (no window), for the LYNX | Live pairs: // rack-deviceview.png (an Audio Effect Rack laid out as in Live's reference shot), rack-mapmode.png (Map mode // with the mapping list), rack-instrument.png (an Instrument Rack with its key zones) const auto i = args.indexOf ("--rackshot"); juce::LookAndFeel::setDefaultLookAndFeel (&lookAndFeel); const auto set = i + 2 < args.size() && ! args[i + 2].startsWith ("--") ? args[i + 2].unquoted() : juce::String(); setApplicationReturnValue (runRackShots (juce::File (args[i + 1].unquoted()), set) ? 0 : 1); quit(); return; } if (args.contains ("--artshot")) { // LYNX.exe --artshot [before|after] [name,name...]: every editor with art of its own (round 170j/170k: the // Themed style; or only the named ones, e.g. "sakura,facet-eq") drawn off-screen at 100 % and 200 % as // /--.png. "before" draws each in the style it had before the Themed style const auto i = args.indexOf ("--artshot"); juce::LookAndFeel::setDefaultLookAndFeel (&lookAndFeel); const auto mode = i + 2 < args.size() && ! args[i + 2].startsWith ("--") ? args[i + 2].unquoted() : juce::String ("after"); if (i + 3 < args.size() && ! args[i + 3].startsWith ("--")) // [name,name...]: only these arts artOnly().addTokens (args[i + 3].unquoted(), ",", ""); setApplicationReturnValue (runArtShots (juce::File (args[i + 1].unquoted()), mode == "before") ? 0 : 1); quit(); return; } if (args.contains ("--artgui")) { // LYNX.exe --artgui [before|after|still] [name,name...]: the same editors in REAL windows on the desktop, one at a // time (always on top, no focus taken), each held while an outside script screenshots it (it writes // /.ready with the window's bounds and waits up to 10 s for /.done), then the // process CPU it costs over 6 s is written to /cpu-.txt. "still": Themed with the motion off const auto i = args.indexOf ("--artgui"); juce::LookAndFeel::setDefaultLookAndFeel (&lookAndFeel); const auto mode = i + 2 < args.size() && ! args[i + 2].startsWith ("--") ? args[i + 2].unquoted() : juce::String ("after"); if (i + 3 < args.size() && ! args[i + 3].startsWith ("--")) // [name,name...]: only these arts artOnly().addTokens (args[i + 3].unquoted(), ",", ""); runArtGui (juce::File (args[i + 1].unquoted()), mode); return; } if (args.contains ("--instrumentshot")) { // LYNX.exe --instrumentshot [lynx|fl]: round 168n — the channel window of // each engine (its Plugin tab) at 100 %, 150 % and 200 %, as /--.png. Source // "lynx" starts from the engine's LYNX bank (what a PC without FL gets), "fl" from FL's Default preset. const auto i = args.indexOf ("--instrumentshot"); juce::LookAndFeel::setDefaultLookAndFeel (&lookAndFeel); const auto source = i + 3 < args.size() && ! args[i + 3].startsWith ("--") ? args[i + 3].unquoted() : juce::String ("lynx"); setApplicationReturnValue (runInstrumentShots (juce::File (args[i + 1].unquoted()), args[i + 2].unquoted(), source) ? 0 : 1); quit(); return; } if (args.contains ("--flextrashot")) { // LYNX.exe --flextrashot : pictures of the editors of round 165g (Big Clock, Tuner, HTML NoteBook, Mute 2, Scratcher, Transmitter) + round 167n Transporter const auto i = args.indexOf ("--flextrashot"); juce::LookAndFeel::setDefaultLookAndFeel (&lookAndFeel); lynx::AudioEngine shotEngine (false); const auto ok = lynx::runFlExtraShots (shotEngine, juce::File (args[i + 1].unquoted())); setApplicationReturnValue (ok ? 0 : 1); quit(); return; } if (args.contains ("--visualtest")) { // LYNX.exe --visualtest [project.flp]: the visual plugins (round 164c) — the audio path's CPU, every // Wave Candy mode and Visualizer scene drawn from a test signal (PNG + the editor's CPU each), and the video // export of a project (default: FL's first ZGameEditor demo) with ffmpeg and as images. Writes report.txt. const auto i = args.indexOf ("--visualtest"); juce::LookAndFeel::setDefaultLookAndFeel (&lookAndFeel); const auto project = i + 2 < args.size() && ! args[i + 2].startsWith ("--") ? juce::File (args[i + 2].unquoted()) : juce::File(); lynx::runVisualTest (juce::File (args[i + 1].unquoted()), project, [this] (bool ok) { setApplicationReturnValue (ok ? 0 : 1); quit(); }); return; } if (args.contains ("--menu-entry")) { // LYNX.AppImage --menu-entry on|off: puts the AppImage in the applications menu (and .lynx files on it) or // takes it out again, without opening a window; the same as the switch in Options › General (round 161) const auto i = args.indexOf ("--menu-entry"); const auto on = args[i + 1].unquoted() != "off"; const auto ok = lynx::runningAsAppImage() && lynx::setAppImageMenuEntry (on); std::fprintf (ok ? stdout : stderr, "%s\n", ok ? (on ? "LYNX SHARE added to the applications menu" : "LYNX SHARE removed from the applications menu") : "only the LYNX SHARE AppImage on Linux can do this"); setApplicationReturnValue (ok ? 0 : 1); quit(); return; } if (args.contains ("--leftovers190nrtest")) { // round 190nr: going back to an older version removes what newer versions added to the install folder // (the --apply-update helper's step after the installer). Prints "result=OK" or the failing check. const auto root = juce::File::createTempFile ("lynx-leftovers190nr"); juce::StringArray fails; auto run = [&] (const juce::String& version, bool licensesGone, bool listGone) { root.deleteRecursively(); root.getChildFile ("install/licenses").createDirectory(); root.getChildFile ("install/licenses/onnxruntime-LICENSE.txt").replaceWithText ("x"); root.getChildFile ("install/LYNX.exe").replaceWithText ("x"); root.getChildFile ("install/installed-files.txt").replaceWithText ("LYNX.exe\r\nlicenses\r\n"); root.getChildFile ("install/My notes.txt").replaceWithText ("x"); root.getChildFile ("update/installing.txt").create(); if (version.isNotEmpty()) root.getChildFile ("update/installing.txt").replaceWithText ("from=0.1.31\nrollback=1\nversion=" + version + "\n"); const auto removed = lynx::updater::removeNewerLeftovers (root.getChildFile ("install"), root.getChildFile ("update/installing.txt")); const auto in = root.getChildFile ("install"); if (in.getChildFile ("licenses").exists() == licensesGone) fails.add (version + ": licenses"); if (in.getChildFile ("installed-files.txt").exists() == listGone) fails.add (version + ": installed-files.txt"); if (! in.getChildFile ("LYNX.exe").existsAsFile() || ! in.getChildFile ("My notes.txt").existsAsFile()) fails.add (version + ": removed too much"); std::printf ("%s -> removed [%s]\n", version.toRawUTF8(), removed.joinIntoString (", ").toRawUTF8()); }; run ("0.1.29-alpha", true, true); // going back to 0.1.29: both newer entries go run ("0.1.28.1-alpha", true, true); run ("0.1.30-alpha", false, true); // 0.1.30 installs licenses itself run ("0.1.31-alpha", false, false); // same or newer: nothing goes run ("0.1.32", false, false); run ("", false, false); // unreadable note: nothing goes root.deleteRecursively(); std::printf ("result=%s%s\n", fails.isEmpty() ? "OK" : "FAILED ", fails.joinIntoString ("; ").toRawUTF8()); setApplicationReturnValue (fails.isEmpty() ? 0 : 1); quit(); return; } if (args.contains ("--send-test-report")) { // LYNX.exe --send-test-report out.txt [--dry]: builds a crash report marked "test" from the newest crash / // hang file and this computer's facts, writes its JSON to out.txt.json and (without --dry) sends it to // lynx-share.com (LYNX_CRASH_ENDPOINT overrides); out.txt gets "id=…" and "result=OK" or the error (round 159) const auto i = args.indexOf ("--send-test-report"); const juce::File out (args[i + 1].unquoted()); lynx::crashreporter::Session session; session.version = getApplicationVersion(); for (const auto* pattern : { "crash *.txt", "hang *.txt" }) { auto files = lynx::platform::settingsFile ("autosave").findChildFiles (juce::File::findFiles, false, pattern); lynx::filesort::byTime (files, lynx::filesort::By::modificationTime, true); if (! files.isEmpty()) (juce::String (pattern).startsWith ("crash") ? session.crashFile : session.hangFile) = files[0]; } session.steps = { "00:00:01 test report (LYNX.exe --send-test-report)", "00:00:02 opening project " + out.getFileName() }; auto input = lynx::crashreporter::makeInput (session, session.crashFile.existsAsFile() ? "crash" : "manual", nullptr); input.test = true; const auto json = lynx::crashreporter::buildJson (input, false); out.withFileExtension (out.getFileExtension() + ".json").replaceWithText (json); const auto error = args.contains ("--dry") ? juce::String() : lynx::crashreporter::sendNow (json); out.replaceWithText ("id=" + juce::String::fromUTF8 (input.id.c_str()) + "\nendpoint=" + lynx::crashreporter::endpoint() + "\nbytes=" + juce::String (json.getNumBytesAsUTF8()) + "\nresult=" + (error.isEmpty() ? juce::String ("OK") : error) + "\n"); setApplicationReturnValue (error.isEmpty() ? 0 : 1); quit(); return; } if (args.contains ("--symbolize")) { // LYNX.exe --symbolize "crash … .txt" out.txt: names the LYNX.exe+offset frames of a user's crash / hang file // (needs this build's LYNX.pdb next to LYNX.exe — the release's "LYNX-symbols" CI artifact; round 157a) const auto i = args.indexOf ("--symbolize"); const auto text = juce::File (args[i + 1].unquoted()).loadFileAsString(); juce::File (args[i + 2].unquoted()).replaceWithText (juce::String::fromUTF8 (lynx::crashguard::symbolizeOwnFrames (text.toStdString()).c_str())); quit(); return; } if (args.contains ("--opentest")) { // LYNX.exe --opentest report.txt [--visible]: every built-in effect and instrument window opened as the mixer / // Channel rack open them, with default, extreme, random and old-project states; a watchdog fails the test on // a hang (round 157a: opening the Parametric EQ froze LYNX). Windows stay off-screen without --visible. const auto i = args.indexOf ("--opentest"); runOpenTest (args[i + 1].unquoted(), args.contains ("--visible"), [this] (bool ok) { setApplicationReturnValue (ok ? 0 : 1); quit(); }); return; } if (args.contains ("--fxfuzz")) { // LYNX.exe --fxfuzz report.txt [rounds] [--drags]: every built-in effect in its editor, parameters swept (and // dragged with the mouse), audio rendered at several rates; a crash ends the process (round 111) const auto i = args.indexOf ("--fxfuzz"); const auto rounds = args.size() > i + 2 ? juce::jmax (1, args[i + 2].getIntValue()) : 6; // --drags: also mouse drags over the editors (their menus may flash on screen: not for the selftest) const auto ok = runEffectFuzz (rounds, args[i + 1].unquoted(), args.contains ("--drags")); setApplicationReturnValue (ok ? 0 : 1); quit(); return; } if (args.contains ("--controllershot")) { // LYNX.exe --controllershot prefix: the built-in controllers' editors (round 133) as PNGs const auto i = args.indexOf ("--controllershot"); runControllerShot (args[i + 1].unquoted()); quit(); return; } if (args.contains ("--edisonshot")) { // LYNX.exe --edisonshot prefix [audio.wav]: the audio editor's Edison tool windows (round 165l) and the // editor before / after some of them, as PNGs (a synthetic drum loop without a file) const auto i = args.indexOf ("--edisonshot"); runEdisonShot (args[i + 1].unquoted(), i + 2 < args.size() ? args[i + 2].unquoted() : juce::String()); quit(); return; } if (args.contains ("--arashot190kx")) { // LYNX --arashot190kx prefix (round 190kx): the Playlist's audio clip menu with its "Edit in ARA plugin" submenu // (a stand-in Melodyne entry in this engine's plugin list, as a scan lists the installed one), before and after the // clip's channel is edited in it const auto i = args.indexOf ("--arashot190kx"); runAraShot190kx (args[i + 1].unquoted()); quit(); return; } if (args.contains ("--polyshot190lj") && args.indexOf ("--polyshot190lj") + 2 < args.size()) { // LYNX --polyshot190lj prefix audio.wav [bends.wav] (round 190lj): "Convert to MIDI (polyphonic)" — the audio // clip menu (Pattern and Simple layouts), the options dialog, Edison's Tools menu, and the result of a // conversion (Playlist, Piano roll; with bends on the second file), plus -checks.txt (OK / FAIL) const auto i = args.indexOf ("--polyshot190lj"); const auto ok = runPolyShot190lj (args[i + 1].unquoted(), args[i + 2].unquoted(), i + 3 < args.size() && ! args[i + 3].startsWith ("--") ? args[i + 3].unquoted() : juce::String()); setApplicationReturnValue (ok ? 0 : 1); quit(); return; } if (args.contains ("--newtoneshot190li")) { // LYNX --newtoneshot190li prefix audio.wav (round 190li): Newtone with the natural engine (a new slot), as // analysed and after Correct pitch 100 / 100 (centre and drift; the vibrato kept), and its Edit menu with the // round's items, for the Melodyne | LYNX pairs (with --shot-scale 1.5 for @150) const auto i = args.indexOf ("--newtoneshot190li"); runNewtoneShot190li (args[i + 1].unquoted(), args[i + 2].unquoted()); quit(); return; } if (args.contains ("--polyeditshot190lk") && args.indexOf ("--polyeditshot190lk") + 2 < args.size()) { // LYNX --polyeditshot190lk prefix audio.wav [key] (round 190lk): "Edit notes (polyphonic)" — the audio clip menu, // the editor as analysed and after one note (the one nearest `key`, default 64 = E4) moved down a semitone, // at 100 % and 150 %, plus -checks.txt (OK / FAIL, timings) and -notes.txt const auto i = args.indexOf ("--polyeditshot190lk"); const auto ok = runPolyEditShot190lk (args[i + 1].unquoted(), args[i + 2].unquoted(), i + 3 < args.size() && ! args[i + 3].startsWith ("--") ? args[i + 3].getDoubleValue() : 64.0); setApplicationReturnValue (ok ? 0 : 1); quit(); return; } if (args.contains ("--polyeditshot190lo") && args.indexOf ("--polyeditshot190lo") + 2 < args.size()) { // LYNX --polyeditshot190lo prefix audio.wav [key] (round 190lo): the polyphonic note editor's round-2 tools — // note assignment, rubber band and moving several notes, stretch handles, modulation / drift / drawn pitch, // a dragged note's preview, Edison's buffer mode and its undo, "Prepare edited clips when a project opens" — // at 100 % and 150 %, plus -checks.txt and -notes.txt const auto i = args.indexOf ("--polyeditshot190lo"); const auto ok = runPolyEditShot190lo (args[i + 1].unquoted(), args[i + 2].unquoted(), i + 3 < args.size() && ! args[i + 3].startsWith ("--") ? args[i + 3].getDoubleValue() : 64.0); setApplicationReturnValue (ok ? 0 : 1); quit(); return; } if (args.contains ("--newtoneshot190kx")) { // LYNX --newtoneshot190kx prefix audio.wav (round 190kx): Newtone with FL's analysis and with "Separate close // notes", each as analysed and after Center 100 % (Melodyne's Correct Pitch), for the Melodyne | LYNX pairs const auto i = args.indexOf ("--newtoneshot190kx"); runNewtoneShot190kx (args[i + 1].unquoted(), args[i + 2].unquoted()); quit(); return; } if (args.contains ("--newtoneshot")) { // LYNX --newtoneshot prefix audio.wav (round natives190kj): FL's Newtone window with the sample analysed, in a // few states (-plain, -selected, -advanced, -cut, -timesel, -moved) and the paint time of the FL look against // the round-165g layout (-paint.txt) const auto i = args.indexOf ("--newtoneshot"); runNewtoneShot (args[i + 1].unquoted(), args[i + 2].unquoted()); quit(); return; } if (args.contains ("--edisonslottest")) { // LYNX.exe --edisonslottest folder [project.flp]: round 190cd — the audio editor as a mixer-slot plugin through // the engine and the project file (report.txt: one "name=ok|FAIL" per check), its window as slot-*.png, and // the Edison slots of an FL project (what was read of each) const auto i = args.indexOf ("--edisonslottest"); const auto ok = runEdisonSlotTest (args[i + 1].unquoted(), i + 2 < args.size() ? args[i + 2].unquoted() : juce::String()); setApplicationReturnValue (ok ? 0 : 1); quit(); return; } if (args.contains ("--danceshot")) { // LYNX.exe --danceshot prefix: LYNX Dance (round 165e) — every move as a contact sheet, the channel's editor, // and a demo project with two dance channels (for --snapshot) const auto i = args.indexOf ("--danceshot"); runDanceShot (args[i + 1].unquoted()); quit(); return; } if (args.contains ("--videoshot") && args.indexOf ("--videoshot") + 2 < args.size()) { // LYNX.exe --videoshot prefix video: the Video Player's editor (round 165g) at a few song positions, with // the user's ffmpeg, as PNGs + report.txt (frames decoded, the sound track) const auto i = args.indexOf ("--videoshot"); runVideoShot (args[i + 1].unquoted(), args[i + 2].unquoted()); return; } if (args.contains ("--videotrackshot") && args.indexOf ("--videotrackshot") + 2 < args.size()) { // LYNX.exe --videotrackshot prefix video [video2]: round 174d — the Playlist with video tracks (filmstrips, // timecode row) and the video window at a few song positions, as PNGs + report.txt (the decoder, the // frame shown for each wanted time: frame accuracy, frames dropped) const auto i = args.indexOf ("--videotrackshot"); runVideoTrackShot (args[i + 1].unquoted(), args[i + 2].unquoted(), i + 3 < args.size() ? args[i + 3].unquoted() : juce::String()); return; } if (args.contains ("--vfxshot")) { // LYNX.exe --vfxshot prefix: the VFX note effects' editors (round 164b), on channels and in a Patcher, as PNGs const auto i = args.indexOf ("--vfxshot"); runVfxShot (args[i + 1].unquoted()); quit(); return; } if (args.contains ("--patchershot")) { // LYNX.exe --patchershot prefix [project]: every Patcher's editor (round 141) as PNGs (a demo one without a project) const auto i = args.indexOf ("--patchershot"); runPatcherShot (args[i + 1].unquoted(), i + 2 < args.size() ? args[i + 2].unquoted() : juce::String()); quit(); return; } if (args.contains ("--audioxshot")) { // LYNX.exe --audioxshot prefix (round 190aq): the pre-fader send, the "Low latency while recording" mark on a // bypassed slot and the Browser's "Preview in time", drawn off-screen runAudioXShot (args[args.indexOf ("--audioxshot") + 1].unquoted()); quit(); return; } if (args.contains ("--comp177shot")) { // LYNX.exe --comp177shot prefix project (round 177c): a project of loop takes in the maximised // Playlist as it opened; every group after "Comp these takes", with a swipe on the first; the track and record menus const auto i = args.indexOf ("--comp177shot"); runComp177Shot (args[i + 1].unquoted(), args[i + 2].unquoted()); quit(); return; } if (args.contains ("--evpaneshot")) { // LYNX --evpaneshot prefix [project] (round 190fz): the Piano roll's event editor divider driven with the mouse // handlers (drag, right-click = alternate size and back, middle-click = default, a drag into the snap zone), // a picture of each state and prefix-report.txt with the heights and the remembered settings file const auto i = args.indexOf ("--evpaneshot"); setApplicationReturnValue (runEvPaneShot (args[i + 1].unquoted(), i + 2 < args.size() ? args[i + 2].unquoted() : juce::String()) ? 0 : 1); quit(); return; } if (args.contains ("--feat166shot")) { // LYNX.exe --feat166shot prefix [project]: round 166d (issue #14) — the Piano Roll with a scale, folded to // it, with one ghost channel, the ghost channels menu, and the Mixer filled to 500 inserts (its start and // its end, and the time a full repaint takes) const auto i = args.indexOf ("--feat166shot"); runFeat166Shot (args[i + 1].unquoted(), i + 2 < args.size() ? args[i + 2].unquoted() : juce::String()); quit(); return; } if (args.contains ("--pickerdropshot")) { // LYNX --pickerdropshot prefix: round 190hm (issue #177) — Picker panel entries dropped on the Playlist as FL // places them (plain drop: one track per entry at the snapped time; Shift: one after another), off-screen, // with -checks.txt (OK / FAIL per placement) setApplicationReturnValue (runPickerDropShot (args[args.indexOf ("--pickerdropshot") + 1].unquoted()) ? 0 : 1); quit(); return; } if (args.contains ("--trackmodeshot")) { // LYNX --trackmodeshot prefix: rollup 190cv (UI gate of PR #151) — Playlist track header › Track mode › Audio // track, off-screen, in three states of FL's live check 190cu (q1-01 fresh, q1-02 one insert linked // elsewhere and one renamed, q1-07 the full state), plus a report that compares each list with FL's setApplicationReturnValue (runTrackModeShot (args[args.indexOf ("--trackmodeshot") + 1].unquoted()) ? 0 : 1); quit(); return; } if (args.contains ("--curveshot")) { // LYNX.exe --curveshot prefix: round 190bw — an automation clip with one segment per FL curve mode in the // point editor and in the Playlist, and FL's point menu, off-screen runCurveShot (args[args.indexOf ("--curveshot") + 1].unquoted()); quit(); return; } if (args.contains ("--remoteshot")) { // LYNX.exe --remoteshot prefix: Online Sessions P5-A1 (round 190ai) — the host's "Share plugins with guests" // list and a guest's parameter editor of a plugin the host plays, off-screen with sample data juce::LookAndFeel::setDefaultLookAndFeel (&lookAndFeel); lynx::liveui::saveRemoteShots (args[args.indexOf ("--remoteshot") + 1].unquoted()); juce::LookAndFeel::setDefaultLookAndFeel (nullptr); quit(); return; } if (args.contains ("--settingsshot") && ! args.contains ("--rtstress")) // (--rtstress has its own --settingsshot file.png option, round 161) { // LYNX.exe --settingsshot prefix: round 190bx — every Settings page off-screen at the window's size, in a // small window (390 x 390) and, for the long pages, whole (see runSettingsShot) runSettingsShot (args[args.indexOf ("--settingsshot") + 1].unquoted()); quit(); return; } if (args.contains ("--perfshot")) { // LYNX.exe --perfshot prefix project: the Playlist in Performance mode with a few clips launched and waiting, // then the project patcherized (every insert's effects, the first channels) saved as prefix-patcherized.lynx // for --patchershot (round 165m) const auto i = args.indexOf ("--perfshot"); runPerfShot (args[i + 1].unquoted(), i + 2 < args.size() ? args[i + 2].unquoted() : juce::String()); quit(); return; } if (args.contains ("--freezetest")) { // LYNX.exe --freezetest prefix [project]: round 190ay's Freeze end to end, off-screen (see runFreezeTest) const auto i = args.indexOf ("--freezetest"); const auto project = i + 2 < args.size() && ! args[i + 2].startsWith ("--") ? args[i + 2].unquoted() : juce::String(); // a word after the project: "keep" = freeze, save prefix-frozen.lynx and stop (the audio stays); // "measure" = only load and render the project, for the memory and time of a process of its own const auto mode = i + 3 < args.size() && ! args[i + 3].startsWith ("--") ? args[i + 3].unquoted() : juce::String(); setApplicationReturnValue (runFreezeTest (args[i + 1].unquoted(), project, mode) ? 0 : 1); quit(); return; } if (args.contains ("--trackfreezetest")) { // LYNX --trackfreezetest prefix: round 190ff's Freeze Track, Flatten / Bounce Track in Place, Bounce to New // Track and Consolidate end to end in the Clip-launch workflow, off-screen (see runTrackFreezeTest) const auto i = args.indexOf ("--trackfreezetest"); setApplicationReturnValue (runTrackFreezeTest (args[i + 1].unquoted()) ? 0 : 1); quit(); return; } if (args.contains ("--details190ihshot")) { // LYNX --details190ihshot prefix: round 190ih's live states off screen (no window, no audio device) — Gross // Beat's locator and slots from its real engine, the rack's activity light, Play / Pause, the Record blink, // the "Note on" hint, the save reminder, the Simple dock's input level, the Envelope Controller's key line const auto i = args.indexOf ("--details190ihshot"); runDetails190ihShot (args[i + 1].unquoted()); quit(); return; } if (args.contains ("--paintbench")) { // LYNX --paintbench project.(flp|lynx|als) report.txt (round 190ge): each main view drawn off screen, whole, many // times (the message thread's CPU per frame), with the playhead mid-song; no window, no audio device const auto i = args.indexOf ("--paintbench"); runPaintBench (juce::File (args[i + 1].unquoted()), juce::File (args[i + 2].unquoted())); quit(); return; } if (args.contains ("--design190igshot")) { // LYNX --design190igshot prefix project.flp: round 190ig off-screen (design190ia slice 3) — the Pattern layout's // Playlist with FL's clip and header look: the song at FL's default zoom (26 px tracks, 15.6 px a bar, bar 21), // at FL's "zoom 17" (50 px tracks, 39.75 px a bar), and playing (the activity column), as FL's reference shots const auto i = args.indexOf ("--design190igshot"); runDesign190igShot (args[i + 1].unquoted(), args[i + 2].unquoted()); quit(); return; } if (args.contains ("--cliplaunch190kcshot")) { // LYNX --cliplaunch190kcshot prefix set.als: round 190kc off screen (Live's return tracks, Sends rows, Pre / Post, // the crossfader, the map modes' crossfader positions and relative strip, Commit / Extract on audio); prefix-checks.txt const auto i = args.indexOf ("--cliplaunch190kcshot"); const auto set = i + 2 < args.size() && ! args[i + 2].startsWith ("--") ? args[i + 2].unquoted() : juce::String(); runClipLaunch190kcShot (args[i + 1].unquoted(), set); quit(); return; } if (args.contains ("--livelook190jnshot")) { // LYNX --livelook190jnshot prefix [set.als]: round 190jn off screen (design190ia slices 13, 17, 18, 19, 25: the // Clip-launch layout in Live's look, and the classic look); prefix-checks.txt const auto i = args.indexOf ("--livelook190jnshot"); const auto set = i + 2 < args.size() && ! args[i + 2].startsWith ("--") ? args[i + 2].unquoted() : juce::String(); runLiveLook190jnShot (args[i + 1].unquoted(), set); quit(); return; } if (args.contains ("--fllook190joshot")) { // LYNX --fllook190joshot prefix project.flp: round 190jo off screen (design190ia slices 12, 21, 23): the Pattern // toolbar's tiles in every state, time / tempo / hint / menu bar, at 1920 / 1600 / 1366 / 1280; the Piano roll // (FL's rows, notes, keys, grid, ghosts); the audio editor in Edison's layout with FL's "DL Breaker.wav"; // prefix-checks.txt (note label contrast) const auto i = args.indexOf ("--fllook190joshot"); runFllook190joShot (args[i + 1].unquoted(), i + 2 < args.size() && ! args[i + 2].startsWith ("--") ? args[i + 2].unquoted() : juce::String()); quit(); return; } if (args.contains ("--capfix190jjshot")) { // LYNX --capfix190jjshot prefix project.flp [set.als]: round 190jj off screen (capture190ji's changes: Simple // capsule states, master meter, pads press, held keys, drop lane ghosts; Live's control bar; FL's C-11 drop ghost // and the picker's playing mark); prefix-checks.txt const auto i = args.indexOf ("--capfix190jjshot"); const auto set = i + 3 < args.size() && ! args[i + 3].startsWith ("--") ? args[i + 3].unquoted() : juce::String(); runCapfix190jjShot (args[i + 1].unquoted(), args[i + 2].unquoted(), set); quit(); return; } if (args.contains ("--demo190plcheck")) { // LYNX --demo190plcheck prefix: round 190pl, the --demo operations of tutorial batch 2 (src/Demo190plCheck.inc) const auto i = args.indexOf ("--demo190plcheck"); setApplicationReturnValue (runDemoCheck190pl (args[i + 1].unquoted()) ? 0 : 1); quit(); return; } if (args.contains ("--demo190pgcheck")) { // LYNX --demo190pgcheck prefix project.lynx: round 190pg, the --demo operations of the tutorial videos (src/Demo190pgCheck.inc) const auto i = args.indexOf ("--demo190pgcheck"); setApplicationReturnValue (runDemoCheck190pg (args[i + 1].unquoted(), juce::File (i + 2 < args.size() ? args[i + 2].unquoted() : juce::String())) ? 0 : 1); quit(); return; } if (args.contains ("--onboard190npshot")) { // LYNX --onboard190npshot prefix: round 190np off screen (src/OnboardShot190np.inc): the welcome card, the choices, // the Next-3 card, the empty-state hints, the tips and the Help menu, 100 % and @150, with -checks.txt const auto i = args.indexOf ("--onboard190npshot"); setApplicationReturnValue (runOnboardShot190np (args[i + 1].unquoted()) ? 0 : 1); quit(); return; } if (args.contains ("--details190oashot")) { // LYNX --details190oashot prefix project.flp: round 190oa off screen (src/DetailsShot190oa.inc) const auto i = args.indexOf ("--details190oashot"); setApplicationReturnValue (runDetailsShot190oa (args[i + 1].unquoted(), i + 2 < args.size() ? args[i + 2].unquoted() : juce::String()) ? 0 : 1); quit(); return; } if (args.contains ("--details190myshot")) { // LYNX --details190myshot prefix project.flp: round 190my off screen (src/DetailsShot190my.inc) const auto i = args.indexOf ("--details190myshot"); setApplicationReturnValue (runDetailsShot190my (args[i + 1].unquoted(), i + 2 < args.size() ? args[i + 2].unquoted() : juce::String()) ? 0 : 1); quit(); return; } if (args.contains ("--details190mvshot")) { // LYNX --details190mvshot prefix project.flp: round 190mv off screen (src/DetailsShot190mv.inc) const auto i = args.indexOf ("--details190mvshot"); setApplicationReturnValue (runDetailsShot190mv (args[i + 1].unquoted(), i + 2 < args.size() ? args[i + 2].unquoted() : juce::String()) ? 0 : 1); quit(); return; } if (args.contains ("--details190mrshot")) { // LYNX --details190mrshot prefix project.flp: round 190mr off screen (src/DetailsShot190mr.inc) const auto i = args.indexOf ("--details190mrshot"); setApplicationReturnValue (runDetailsShot190mr (args[i + 1].unquoted(), i + 2 < args.size() ? args[i + 2].unquoted() : juce::String()) ? 0 : 1); quit(); return; } if (args.contains ("--rack190ncshot") && args.indexOf ("--rack190ncshot") + 1 < args.size()) { // LYNX --rack190ncshot prefix: round 190nc off screen (src/RackShot190nc.inc): Live's rack with its devices // inline and the Macro Map overlay (DL-95), the Session mixer's Solo / Cue (DL-110) setApplicationReturnValue (runRackShot190nc (args[args.indexOf ("--rack190ncshot") + 1].unquoted()) ? 0 : 1); quit(); return; } if (args.contains ("--details190mpshot")) { // LYNX --details190mpshot prefix project.flp: round 190mp off screen (src/DetailsShot190mp.inc) const auto i = args.indexOf ("--details190mpshot"); setApplicationReturnValue (runDetailsShot190mp (args[i + 1].unquoted(), i + 2 < args.size() ? args[i + 2].unquoted() : juce::String()) ? 0 : 1); quit(); return; } if (args.contains ("--details190mkshot")) { // LYNX --details190mkshot prefix project.flp: round 190mk off screen (src/DetailsShot190mk.inc) const auto i = args.indexOf ("--details190mkshot"); setApplicationReturnValue (runDetailsShot190mk (args[i + 1].unquoted(), i + 2 < args.size() ? args[i + 2].unquoted() : juce::String()) ? 0 : 1); quit(); return; } if (args.contains ("--details190mfshot")) { // LYNX --details190mfshot prefix project.flp: round 190mf off screen (src/DetailsShot190mf.inc) const auto i = args.indexOf ("--details190mfshot"); setApplicationReturnValue (runDetailsShot190mf (args[i + 1].unquoted(), i + 2 < args.size() ? args[i + 2].unquoted() : juce::String()) ? 0 : 1); quit(); return; } if (args.contains ("--details190lxshot")) { // LYNX --details190lxshot prefix project.flp [set.als]: round 190lx off screen (src/DetailsShot190lx.inc) const auto i = args.indexOf ("--details190lxshot"); const auto set = i + 3 < args.size() && ! args[i + 3].startsWith ("--") ? args[i + 3].unquoted() : juce::String(); setApplicationReturnValue (runDetailsShot190lx (args[i + 1].unquoted(), args[i + 2].unquoted(), set) ? 0 : 1); quit(); return; } if (args.contains ("--details190lrshot")) { // LYNX --details190lrshot prefix project.flp [set.als]: round 190lr off screen (src/DetailsShot190lr.inc) const auto i = args.indexOf ("--details190lrshot"); const auto set = i + 3 < args.size() && ! args[i + 3].startsWith ("--") ? args[i + 3].unquoted() : juce::String(); setApplicationReturnValue (runDetailsShot190lr (args[i + 1].unquoted(), args[i + 2].unquoted(), set) ? 0 : 1); quit(); return; } if (args.contains ("--details190ldshot")) { // LYNX --details190ldshot prefix project.flp [set.als]: round 190ld off screen (src/DetailsShot190ld.inc) const auto i = args.indexOf ("--details190ldshot"); const auto set = i + 3 < args.size() && ! args[i + 3].startsWith ("--") ? args[i + 3].unquoted() : juce::String(); setApplicationReturnValue (runDetailsShot190ld (args[i + 1].unquoted(), args[i + 2].unquoted(), set) ? 0 : 1); quit(); return; } if (args.contains ("--details190knshot")) { // LYNX --details190knshot prefix project.flp [set.als]: round 190kn off screen (src/DetailsShot190kn.inc) const auto i = args.indexOf ("--details190knshot"); const auto set = i + 3 < args.size() && ! args[i + 3].startsWith ("--") ? args[i + 3].unquoted() : juce::String(); setApplicationReturnValue (runDetailsShot190kn (args[i + 1].unquoted(), args[i + 2].unquoted(), set) ? 0 : 1); quit(); return; } if (args.contains ("--details190imshot")) { // LYNX --details190imshot prefix project.flp [set.als]: round 190im off-screen (details190if R1, R5, R6, R11, R12, // R13, R15) — the automation hints, the Playlist playing (picker marks, glow, overview, activity levels), a drop // preview, Follow's pause, the Sampler's handles, and with the Live set the grid's one-shot / follow / queued // scene / deactivated clip / hints and the Clip View's launched position; prefix-checks.txt const auto i = args.indexOf ("--details190imshot"); const auto set = i + 3 < args.size() && ! args[i + 3].startsWith ("--") ? args[i + 3].unquoted() : juce::String(); runDetails190imShot (args[i + 1].unquoted(), args[i + 2].unquoted(), set); quit(); return; } if (args.contains ("--toolbarshot190qg")) { // LYNX --toolbarshot190qg prefix [project]: round 190qg off screen — the toolbar walk (every preset, icon size, // Interface size and window width: each item on the toolbar or in its overflow), every preset's toolbar at // 80-175 % on 1280 / 1920 px screens, the overflow menus; exit 0 = the walk passed (src/ToolbarShot190qg.inc) const auto i = args.indexOf ("--toolbarshot190qg"); const auto project = i + 2 < args.size() && ! args[i + 2].startsWith ("--") ? args[i + 2].unquoted() : juce::String(); setApplicationReturnValue (runToolbarShot190qg (args[i + 1].unquoted(), project) ? 0 : 1); quit(); return; } if (args.contains ("--toolbarshot190iv")) { // LYNX --toolbarshot190iv prefix [project.als]: round 190iv off screen — the toolbar of each layout style (Pattern, // Simple, Clip-launch) at 1920 / 1366 / 1280, the Simple transport capsule idle / hover / pressed / playing / // recording, the "Last saved" status in its four states, Live's control bar with every button idle / hover / // pressed / lit, the "⋯" menus, and a report of the parts' bounds const auto i = args.indexOf ("--toolbarshot190iv"); const auto project = i + 2 < args.size() && ! args[i + 2].startsWith ("--") ? args[i + 2].unquoted() : juce::String(); runToolbarShot190iv (args[i + 1].unquoted(), project); quit(); return; } if (args.contains ("--gridshot")) { // LYNX.exe --gridshot prefix [project]: the Clip-launch workflow's layout off-screen, with a grid of sample // clips, some playing and waiting, at the size of LYNX_SNAPSHOT_SIZE (round 181a); with a project (.lynx, // .flp, .als), that project's grid instead (round 181c: a Live set's Session view as LYNX imports it) const auto i = args.indexOf ("--gridshot"); const auto project = i + 2 < args.size() && ! args[i + 2].startsWith ("--") ? args[i + 2].unquoted() : juce::String(); runGridShot (args[i + 1].unquoted(), project); quit(); return; } if (args.contains ("--tour190dvshot")) { // LYNX.exe --tour190dvshot prefix: round 190dv off-screen — the Simple workflow's Welcome screen, every step of // the first-song tour done with its "Do it for me" (a loop dropped for the loop step), the end card, Back / // Next / close, the Help menu, the chooser's tour button, Start from with the three demo songs, a demo // opened in Simple — and a text report of the checks (incl. resources/demos/*.lynx = the generated songs) const auto i = args.indexOf ("--tour190dvshot"); runTour190dvShot (args[i + 1].unquoted()); quit(); return; } if (args.contains ("--donateshot")) { // LYNX --donateshot prefix: round 190fq off-screen (no window) — Help › Support LYNX SHARE... in the three // layouts, the Support window, the About window's Support button, the start-up support note in the main // window, and the note's rules end to end on its saved state (run it with LYNX_PROFILE_DIR: it writes // support-note.txt there, and puts the old one back at the end); report prefix-report.txt, exit 0 = OK const auto i = args.indexOf ("--donateshot"); setApplicationReturnValue (runDonateShot (args[i + 1].unquoted()) ? 0 : 1); quit(); return; } if (args.contains ("--simpleclosetest")) { // LYNX --simpleclosetest : round 190fc off-screen (no window) — the main window in the Simple // layout with Welcome, the tour, Start from, a demo, the dock's tabs, Finish and Lyrics open, then closed as at // shutdown (the 0.1.27 RC crashed on every such close); exit code 0 = OK const auto i = args.indexOf ("--simpleclosetest"); setApplicationReturnValue (runSimpleCloseTest (args[i + 1].unquoted()) ? 0 : 1); quit(); return; } if (args.contains ("--patterns190ea")) { // LYNX --patterns190ea : round 190ea off-screen (no window) — a song with no pattern at all // reaching the engine in every layout (the Simple dock's Editor tab, the Piano roll panel of the Pattern // layout, the Clip-launch layout), the last pattern deleted, all patterns cleared by an edit, undo / redo, // a live session's remote song and an out-of-range current pattern; each must leave one pattern and not crash const auto i = args.indexOf ("--patterns190ea"); setApplicationReturnValue (runPatterns190ea (args[i + 1].unquoted()) ? 0 : 1); quit(); return; } if (args.contains ("--reabl190foshot")) { // LYNX --reabl190foshot prefix: round 190fo off-screen — the Simple Sampler track's 16 pads in the dock, its // menus and kits, the typing keys, the .lynx round trip, a folder of stems and MIDI files — and a report const auto i = args.indexOf ("--reabl190foshot"); runReabl190foShot (args[i + 1].unquoted()); quit(); return; } if (args.contains ("--simple190dsshot")) { // LYNX.exe --simple190dsshot prefix: round 190ds off-screen, at 1x and 2x — loops dropped in the Simple // workflow following the project key (the dock's switch, the clip menu), the docked Piano roll in the Editor // tab, the keyboard's modes Keys / Scale keys / Chord pad with the scale selector — and a text report const auto i = args.indexOf ("--simple190dsshot"); runSimple190dsShot (args[i + 1].unquoted()); quit(); return; } if (args.contains ("--simple190dgshot")) { // LYNX.exe --simple190dgshot prefix: round 190dg's additions to the Simple dock off-screen, at 1x and 2x — // the Effects tab with all eight one-knob cards and each card alone, a chain preset with Blend, the // favourites in the Preset menu, the sound picker (a search, My plugins with a made-up plugin list) — and a // text report of the checks const auto i = args.indexOf ("--simple190dgshot"); runSimple190dgShot (args[i + 1].unquoted()); quit(); return; } if (args.contains ("--simplefxshot")) { // LYNX.exe --simplefxshot prefix: round 190bu's track dock of the Simple workflow off-screen, at 1x and 2x — // the Instrument tab (LYNX sounds, My SoundFonts), the Effects tab (empty, a preset, its menus), and a text // report: the dock's edits, a user preset saved and loaded, the same slots in the Pattern workflow's Mixer const auto i = args.indexOf ("--simplefxshot"); runSimpleFxShot (args[i + 1].unquoted()); quit(); return; } if (args.contains ("--simple190jcshot")) { // LYNX.exe --simple190jcshot prefix: round 190jc's Simple layout look (design190ia slices 5, 14, 15, 22, 24 and // Large controls) off-screen, at 1x and 2x, with a text report const auto i = args.indexOf ("--simple190jcshot"); runSimple190jcShot (args[i + 1].unquoted()); quit(); return; } if (args.contains ("--simpleshot")) { // LYNX.exe --simpleshot prefix: round 184a's Simple workflow off-screen — View › Layout style with each style // chosen, Settings › General (Pattern, then Simple selected) with its style list, the window in Pattern, then // Simple, then Pattern again, and how many Simple workflow objects existed before and after (0 before) const auto i = args.indexOf ("--simpleshot"); runSimpleShot (args[i + 1].unquoted()); quit(); return; } // --versionsshot (round 190ap): the Versions panel, File's new items, a project opened without its // third-party plugins (window, list, File menu) and the Export window's additions, offscreen if (args.contains ("--versionsshot")) { runVersionsShot (args[args.indexOf ("--versionsshot") + 1].unquoted()); quit(); return; } // --linkshot (round 190bt): FL's Remote control settings / Global link settings windows, the control // menu with "Link to controller...", the formula presets and controller menus and the Multilink items, // offscreen; prefix-checks.txt holds the round's checks of the engine, the project file and the settings if (args.contains ("--linkshot")) { setApplicationReturnValue (runLinkShot (args[args.indexOf ("--linkshot") + 1].unquoted()) ? 0 : 1); quit(); return; } // --flctlshot (round 190df): FL's multilink menu (on / off), the plugin menu's A/B and "Link all // parameters...", the sampler's File row with its Sample history, and the Envelope / instrument page of a sampler // running FL's voice with its envelope presets, offscreen; prefix-checks.txt holds the checks if (args.contains ("--flctlshot")) { setApplicationReturnValue (runFlCtlShot (args[args.indexOf ("--flctlshot") + 1].unquoted()) ? 0 : 1); quit(); return; } // --samplerpageshot (round 190dh): FL's Sampler page offscreen (shots and checks in prefix-checks.txt) if (args.contains ("--samplerpageshot")) { setApplicationReturnValue (runSamplerPageShot (args[args.indexOf ("--samplerpageshot") + 1].unquoted()) ? 0 : 1); quit(); return; } // --flplshot (round 190dx): the audio clip menu (Preview, Automate › Panning / Volume), the Playlist's "+" // and its menu, Track mode › Instrument track, the Channel rack's "Assign to new instrument track", Tools › One-click // audio recording and Mixer › Disk recording › Latency compensation, offscreen; prefix-checks.txt holds the checks // --hdrshot190ft (round 190ft, issues #163 / #164): FL's track-header selection and resize rules driven // with synthetic mouse events on the Playlist headers and the mixer strips, offscreen; prefix-checks.txt if (args.contains ("--hdrshot190ft")) { setApplicationReturnValue (runHdrShot190ft (args[args.indexOf ("--hdrshot190ft") + 1].unquoted()) ? 0 : 1); quit(); return; } // --dawprojcheck190jf (round 190jf, slice B22): export to DAWproject and open it again if (args.contains ("--dawprojcheck190jf") && args.indexOf ("--dawprojcheck190jf") + 2 < args.size()) { const auto at = args.indexOf ("--dawprojcheck190jf"); setApplicationReturnValue (runDawProjectCheck190jf (args[at + 1].unquoted(), juce::File (args[at + 2].unquoted())) ? 0 : 1); quit(); return; } // --foldersshot190jf (round 190jf, slice B17): the Playlist's folders; prefix-checks.txt if (args.contains ("--foldersshot190jf") && args.indexOf ("--foldersshot190jf") + 2 < args.size()) { const auto at = args.indexOf ("--foldersshot190jf"); setApplicationReturnValue (runFoldersShot190jf (args[at + 1].unquoted(), juce::File (args[at + 2].unquoted())) ? 0 : 1); quit(); return; } // --userfixshot190ib (round 190ib): issue #182's type-to-jump in a real popup menu (the Playlist's Edit menu // of the issue's screenshot, typed into), #183's Piano roll item, #181's Ctrl+, through the main window's keys; // prefix-checks.txt if (args.contains ("--userfixshot190ib")) { setApplicationReturnValue (runUserFixShot190ib (args[args.indexOf ("--userfixshot190ib") + 1].unquoted()) ? 0 : 1); quit(); return; } // --issuesshot190ht (round 190ht): issue #127's other tools on Pattern Blocks (Mute, Select + group move, // Slice, Zoom) and issue #154's insert effects list on linked headers, driven with synthetic mouse events, // offscreen; prefix-checks.txt and pictures if (args.contains ("--issuesshot190ht")) { setApplicationReturnValue (runIssuesShot190ht (args[args.indexOf ("--issuesshot190ht") + 1].unquoted()) ? 0 : 1); quit(); return; } // --chordlane190pfshot (round 190pf, research190oe P13 / P12): src/ChordLaneShot190pf.inc if (args.contains ("--chordlane190pfshot")) { setApplicationReturnValue (runChordLaneShot190pf (args[args.indexOf ("--chordlane190pfshot") + 1].unquoted()) ? 0 : 1); quit(); return; } // --sections190olshot (round 190ol, research190oe P1 / P6): src/SectionsShot190ol.inc if (args.contains ("--sections190olshot")) { setApplicationReturnValue (runSectionsShot190ol (args[args.indexOf ("--sections190olshot") + 1].unquoted()) ? 0 : 1); quit(); return; } // --playlistshot190jq (round 190jq, issues #164 and #191): src/PlaylistShot190jq.inc if (args.contains ("--playlistshot190jq")) { setApplicationReturnValue (runPlaylistShot190jq (args[args.indexOf ("--playlistshot190jq") + 1].unquoted()) ? 0 : 1); quit(); return; } // --focus218shot190ng (round 190ng, issue #218): src/Focus218Shot190ng.inc if (args.contains ("--focus218shot190ng")) { setApplicationReturnValue (runFocus218Shot190ng (args[args.indexOf ("--focus218shot190ng") + 1].unquoted()) ? 0 : 1); quit(); return; } // --mixerqolshot190qh [project.flp] (round 190qh, research190qa R5 Mixer QoL): src/MixerQolShot190qh.inc if (args.contains ("--mixerqolshot190qh")) { const auto i = args.indexOf ("--mixerqolshot190qh"); const auto project = i + 2 < args.size() && ! args[i + 2].startsWith ("--") ? args[i + 2].unquoted() : juce::String(); setApplicationReturnValue (runMixerQolShot190qh (args[i + 1].unquoted(), project) ? 0 : 1); quit(); return; } // --slots260shot (round 190qf, PR #260: FL 2026.2's mixer slots): src/Slots260Shot190qf.inc if (args.contains ("--slots260shot")) { setApplicationReturnValue (runSlots260Shot (args[args.indexOf ("--slots260shot") + 1].unquoted()) ? 0 : 1); quit(); return; } // --mixer221shot190ng (round 190ng, issue #221): src/Mixer221Shot190ng.inc if (args.contains ("--mixer221shot190ng")) { setApplicationReturnValue (runMixer221Shot190ng (args[args.indexOf ("--mixer221shot190ng") + 1].unquoted()) ? 0 : 1); quit(); return; } // --research190onshot (round 190on: research190oe P2, P8, P10): src/Research190onShot.inc if (args.contains ("--research190onshot")) { setApplicationReturnValue (runResearchShot190on (args[args.indexOf ("--research190onshot") + 1].unquoted()) ? 0 : 1); quit(); return; } // --issuesshot190nq (round 190nq, issues #193, #225-#230): src/IssuesShot190nq.inc if (args.contains ("--issuesshot190nq")) { setApplicationReturnValue (runIssuesShot190nq (args[args.indexOf ("--issuesshot190nq") + 1].unquoted()) ? 0 : 1); quit(); return; } // --design190ojshot [project] (round 190oj, design review): src/Design190ojShot.inc if (args.contains ("--design190ojshot")) { const auto i = args.indexOf ("--design190ojshot"); setApplicationReturnValue (runDesign190ojShot (args[i + 1].unquoted(), i + 2 < args.size() && ! args[i + 2].startsWith ("--") ? args[i + 2].unquoted() : juce::String()) ? 0 : 1); quit(); return; } // --rackauto190owshot [project.flp] [probe.flp] (round 190ow, PAT-7 rest / DE-123): src/RackAuto190owShot.inc if (args.contains ("--rackauto190owshot")) { const auto i = args.indexOf ("--rackauto190owshot"); const auto arg = [&args] (int k) { return k < args.size() && ! args[k].startsWith ("--") ? args[k].unquoted() : juce::String(); }; setApplicationReturnValue (runRackAuto190owShot (args[i + 1].unquoted(), arg (i + 2), arg (i + 3)) ? 0 : 1); quit(); return; } // --extras190qkshot (round 190qk: the LYNX extras on by default, FL-exact / Recommended): src/Extras190qkShot.inc if (args.contains ("--extras190qkshot")) { setApplicationReturnValue (runExtras190qkShot (args[args.indexOf ("--extras190qkshot") + 1].unquoted()) ? 0 : 1); quit(); return; } // --design190ooshot [project] (round 190oo, design review 2): src/Design190ooShot.inc if (args.contains ("--design190ooshot")) { const auto i = args.indexOf ("--design190ooshot"); setApplicationReturnValue (runDesign190ooShot (args[i + 1].unquoted(), i + 2 < args.size() && ! args[i + 2].startsWith ("--") ? args[i + 2].unquoted() : juce::String()) ? 0 : 1); quit(); return; } // --rollup031s3shot (rollup 0.1.31 step 3, round 190ny): src/Rollup031S3Shot.inc if (args.contains ("--rollup031s3shot")) { setApplicationReturnValue (runRollup031S3Shot (args[args.indexOf ("--rollup031s3shot") + 1].unquoted()) ? 0 : 1); quit(); return; } // --tabs2test190nz (round 190nz, issue #232 stage 2: copy and paste between two LYNX windows): // src/Tabs2Test190nz.inc if (args.contains ("--tabs2test190nz")) { const auto i = args.indexOf ("--tabs2test190nz"); setApplicationReturnValue (runTabs2Test190nz (args[i + 1].unquoted(), juce::File (args[i + 2].unquoted())) ? 0 : 1); quit(); return; } // --headergearshot248 (rollup 0.1.31 step 7, PRs #248 / #256): src/HeaderGearShot248.inc if (args.contains ("--headergearshot248")) { setApplicationReturnValue (runHeaderGearShot (args[args.indexOf ("--headergearshot248") + 1].unquoted()) ? 0 : 1); quit(); return; } // --hotfix190qpwfshot (round 190qp, 0.1.31.1 hotfix): src/Hotfix190qpWf.inc, its checks and pictures if (args.contains ("--hotfix190qpwfshot")) { const auto prefix = args[args.indexOf ("--hotfix190qpwfshot") + 1].unquoted(); juce::LookAndFeel::setDefaultLookAndFeel (&lookAndFeel); const auto r = hotfix190qpWfCheck (prefix); juce::File (prefix + "-checks.txt").replaceWithText ("hotfix190qp_wf=" + r + "\n"); setApplicationReturnValue (r == "OK" ? 0 : 1); quit(); return; } // --pickerpaint190qi (round 190qi): the plugin lists' and the Browser's paint cost, src/PickerPaintBench190qi.inc if (args.contains ("--pickerpaint190qi")) { runPickerPaint190qi (juce::File (args[args.indexOf ("--pickerpaint190qi") + 1].unquoted())); setApplicationReturnValue (0); quit(); return; } // --picker190qishot (round 190qi, picker and Browser quality of life): src/Picker190qiShot.inc if (args.contains ("--picker190qishot")) { setApplicationReturnValue (runPicker190qiShot (juce::File (args[args.indexOf ("--picker190qishot") + 1].unquoted())) ? 0 : 1); quit(); return; } // --issuesshot190qo (round 190qo, issues #239, #215, #251, #270): src/IssuesShot190qo.inc if (args.contains ("--issuesshot190qo")) { setApplicationReturnValue (runIssuesShot190qo (args[args.indexOf ("--issuesshot190qo") + 1].unquoted()) ? 0 : 1); quit(); return; } // --issuesshot190qb (round 190qb, follow-ups of issues #206 and #215): src/IssuesShot190qb.inc if (args.contains ("--issuesshot190qb")) { setApplicationReturnValue (runIssuesShot190qb (args[args.indexOf ("--issuesshot190qb") + 1].unquoted()) ? 0 : 1); quit(); return; } // --issuesshot190oq (round 190oq, issues #243-#252): src/IssuesShot190oq.inc if (args.contains ("--issuesshot190oq")) { setApplicationReturnValue (runIssuesShot190oq (args[args.indexOf ("--issuesshot190oq") + 1].unquoted()) ? 0 : 1); quit(); return; } // --issuesshot190od (round 190od, issues #236-#242): src/IssuesShot190od.inc if (args.contains ("--issuesshot190od")) { setApplicationReturnValue (runIssuesShot190od (args[args.indexOf ("--issuesshot190od") + 1].unquoted()) ? 0 : 1); quit(); return; } // --issuesshot190ns (round 190ns, issues #231-#235): src/IssuesShot190ns.inc if (args.contains ("--issuesshot190ns")) { setApplicationReturnValue (runIssuesShot190ns (args[args.indexOf ("--issuesshot190ns") + 1].unquoted()) ? 0 : 1); quit(); return; } // --issuesshot190ng (round 190ng, issues #215, #217, #219, #220, #222): src/IssuesShot190ng.inc if (args.contains ("--issuesshot190ng")) { setApplicationReturnValue (runIssuesShot190ng (args[args.indexOf ("--issuesshot190ng") + 1].unquoted()) ? 0 : 1); quit(); return; } // --tracker190nwshot [module] (round 190nw, 0.1.31: the built-in tracker): src/TrackerShot190nw.inc if (args.contains ("--tracker190nwshot")) { const auto i = args.indexOf ("--tracker190nwshot"); setApplicationReturnValue (runTrackerShot190nw (args[i + 1].unquoted(), i + 2 < args.size() && ! args[i + 2].startsWith ("--") ? args[i + 2].unquoted() : juce::String()) ? 0 : 1); quit(); return; } // --automodes190pashot (round 190pa, 0.1.32: automation write modes, range edits on chosen tracks): src/AutoModesShot190pa.inc if (args.contains ("--automodes190pashot")) { setApplicationReturnValue (runAutoModesShot190pa (args[args.indexOf ("--automodes190pashot") + 1].unquoted()) ? 0 : 1); quit(); return; } // --trackstates190opshot (round 190op, 0.1.31: Hide / Deactivate tracks, Capture automation): src/TrackStatesShot190op.inc // --tracks190peshot (round 190pe, 0.1.32: Track versions, Import tracks from another project): src/Tracks190peShot.inc if (args.contains ("--tracks190peshot")) { setApplicationReturnValue (runTracks190peShot (args[args.indexOf ("--tracks190peshot") + 1].unquoted()) ? 0 : 1); quit(); return; } if (args.contains ("--trackstates190opshot")) { setApplicationReturnValue (runTrackStatesShot190op (args[args.indexOf ("--trackstates190opshot") + 1].unquoted()) ? 0 : 1); quit(); return; } // --trackclips190neshot (round 190ne, 0.1.31: track clips): src/TrackClipsShot190ne.inc if (args.contains ("--trackclips190neshot")) { setApplicationReturnValue (runTrackClipsShot190ne (args[args.indexOf ("--trackclips190neshot") + 1].unquoted()) ? 0 : 1); quit(); return; } // --issueshot190mq (round 190mq, issues #211, #212, #213): src/IssuesShot190mq.inc if (args.contains ("--issueshot190mq")) { setApplicationReturnValue (runIssuesShot190mq (args[args.indexOf ("--issueshot190mq") + 1].unquoted()) ? 0 : 1); quit(); return; } // --issueshot190lw (round 190lw, issues #205, #206, #207): src/IssuesShot190lw.inc if (args.contains ("--issueshot190lw")) { setApplicationReturnValue (runIssuesShot190lw (args[args.indexOf ("--issueshot190lw") + 1].unquoted()) ? 0 : 1); quit(); return; } // --issueshot190jz (round 190jz, issues #192, #194, #195): src/IssuesShot190jz.inc if (args.contains ("--issueshot190jz")) { setApplicationReturnValue (runIssuesShot190jz (args[args.indexOf ("--issueshot190jz") + 1].unquoted()) ? 0 : 1); quit(); return; } // --workflowshot190iu (round 190iu, issues #186 and #191): src/WorkflowShot190iu.inc if (args.contains ("--workflowshot190iu")) { setApplicationReturnValue (runWorkflowShot190iu (args[args.indexOf ("--workflowshot190iu") + 1].unquoted()) ? 0 : 1); quit(); return; } // --trackautoshot190gz (round 190gz, issue #170): LYNX's "Link Playlist tracks to mixer tracks" — the // switch, the linked headers' M / S / volume / pan driven with synthetic mouse events, row sizes, undo and the // .lynx round trip, offscreen; prefix-checks.txt if (args.contains ("--trackautoshot190gz")) { setApplicationReturnValue (runTrackAutoShot190gz (args[args.indexOf ("--trackautoshot190gz") + 1].unquoted()) ? 0 : 1); quit(); return; } if (args.contains ("--flplshot")) { setApplicationReturnValue (runFlPlShot (args[args.indexOf ("--flplshot") + 1].unquoted()) ? 0 : 1); quit(); return; } // --genpresetshot (round 190fs): the channel window's preset box with the user's own presets (Save // preset..., Your presets, Delete preset, Show the presets folder) for Fruity DX10, 3x Osc and LYNX's synth, the // name box, a load (one undo step) and the Browser's new channel, offscreen; prefix-checks.txt holds the checks if (args.contains ("--genpresetshot")) { setApplicationReturnValue (runGenPresetShot (args[args.indexOf ("--genpresetshot") + 1].unquoted()) ? 0 : 1); quit(); return; } // --flfixshot (round 190ey): what the live FL session 190ew found different (the Sampler page, the // Multilink menu, the Playlist, issue #152's question), offscreen; prefix-checks.txt holds the checks if (args.contains ("--flfixshot")) { setApplicationReturnValue (runFlFixShot (args[args.indexOf ("--flfixshot") + 1].unquoted()) ? 0 : 1); quit(); return; } // --flclipshot (round 190dz): FL's audio clip menu layout (two columns, FL's sections, LYNX's own items at // the end) and the channel's Misc › Levels adjustment, offscreen; prefix-checks.txt holds the checks if (args.contains ("--flclipshot")) { setApplicationReturnValue (runFlClipShot (args[args.indexOf ("--flclipshot") + 1].unquoted()) ? 0 : 1); quit(); return; } if (args.contains ("--warpshot")) { // LYNX.exe --warpshot prefix: round 190cg's pictures (warp commands in the audio editor, the Clip page's // Audio panel, the arrangement with the loop switched off, a folded track, signature changes), off-screen const auto i = args.indexOf ("--warpshot"); runWarpShot (args[i + 1].unquoted()); quit(); return; } // --bandlab190jrshot (round 190jr): a .blx imported as Simple tracks, the region loop handle, the Simple // automation view and its menu, the Extract stems form; -report.txt with ok / FAIL lines if (args.contains ("--bandlab190jrshot")) { runBandlab190jrShot (args[args.indexOf ("--bandlab190jrshot") + 1].unquoted()); quit(); return; } // --bandlabshot (round 190ch): Lyrics / Notes, Reference match, Start from and Clean voice, offscreen if (args.contains ("--bandlabshot")) { runBandlabShot (args[args.indexOf ("--bandlabshot") + 1].unquoted()); quit(); return; } if (args.contains ("--mpeshot190hy")) { // LYNX --mpeshot190hy prefix: round 190hy (issue #108, MPE stage 2) off-screen: the Piano roll's MPE lanes (pitch // bend, slide, pressure) over notes with curves in Pattern workflow, then the Clip-launch layout's Clip page with // its Notes and MPE tabs. Writes prefix-checks.txt. runMpeShot190hy (args[args.indexOf ("--mpeshot190hy") + 1].unquoted()); quit(); return; } if (args.contains ("--detailshot")) { // LYNX.exe --detailshot prefix: the Clip-launch workflow's detail view off-screen (round 183a): a track's chain // (instrument, effects, one off, one folded), its clip page, and Pattern workflow before / after, at // LYNX_SNAPSHOT_SIZE. Writes prefix-counts.txt with what the chain shows. const auto i = args.indexOf ("--detailshot"); runDetailShot (args[i + 1].unquoted()); quit(); return; } if (args.contains ("--meldshot190ko")) { // LYNX.exe --meldshot190ko prefix meld.adv spectraltime.adv spectralresonator.adv: round 190ko off-screen, in the // Clip-launch layout: a track whose instrument is what a Live Meld preset imports onto (Braid) and whose insert // holds what Spectral Time and Spectral Resonator presets import onto (Timeprism, Harmonia), on the Device View. // Writes prefix-devices.png and prefix-checks.txt. const auto i = args.indexOf ("--meldshot190ko"); runMeldShot190ko (args[i + 1].unquoted(), args[i + 2].unquoted(), args[i + 3].unquoted(), args[i + 4].unquoted()); quit(); return; } if (args.contains ("--livedevshot190kk")) { // LYNX.exe --livedevshot190kk prefix: round 190kk off-screen, in the Clip-launch layout: a track whose insert holds // what Live's Erosion, Vinyl Distortion and Corpus (Core Library presets) import onto — Corrode, Platter, // Soundboard — on the Device View as ordinary effect cards. Writes prefix-devices.png and prefix-checks.txt. runLiveDevShot190kk (args[args.indexOf ("--livedevshot190kk") + 1].unquoted()); quit(); return; } if (args.contains ("--liverackshot190hr")) { // LYNX.exe --liverackshot190hr prefix: round 190hr off-screen, in the Ableton-style layout: the Device View's // instrument menu with Group / Ungroup, an instrument grouped into an Instrument Rack and back, a rack's Save // Preset button and drop area (a device dropped in, an instrument refused), Live's own .adg presets opened // with their chains, and a saved .adg read back. Writes prefix-checks.txt. runLiveRackShot190hr (args[args.indexOf ("--liverackshot190hr") + 1].unquoted()); quit(); return; } if (args.contains ("--helixshot190mi")) { // LYNX --helixshot190mi prefix [bank preset name]: round 190mi off-screen, the Pattern layout's Helix channel // window with Helix+'s strip, from a factory preset (default "Growl FM"): the device + strip, LFO 1 (drawn), // the Matrix page (macros, Helix+'s rows); --shot-scale 1.5 --shot-suffix @150 for the 150 % pictures. const auto i = args.indexOf ("--helixshot190mi"); runHelixShot190mi (args[i + 1].unquoted(), i + 2 < args.size() && ! args[i + 2].startsWith ("--") ? args[i + 2].unquoted() : juce::String ("Growl FM")); quit(); return; } if (args.contains ("--helixshot190oc")) { // LYNX --helixshot190oc prefix: round 190oc off-screen: the Pattern layout's Helix channel window with round 4's // row (Grain Swarm, Spectral Ensemble; Frozen Choir and Triple Stack for the side by side with 190mt), the strip's // row alone; paint costs in prefix-checks.txt runHelixShot190oc (args[args.indexOf ("--helixshot190oc") + 1].unquoted()); quit(); return; } if (args.contains ("--helixshot190mt")) { // LYNX --helixshot190mt prefix: round 190mt off-screen: the Pattern layout's Helix channel window with round 3's // row (Grain Cloud, Frozen Choir, Spectral Glass; Triple Stack for the side by side with 190ml), the Matrix page with // the new rows, and the Clip-launch Device View card's Helix+ panel; paint costs in prefix-checks.txt. runHelixShot190mt (args[args.indexOf ("--helixshot190mt") + 1].unquoted()); quit(); return; } if (args.contains ("--helixshot190ml")) { // LYNX --helixshot190ml prefix: round 190ml off-screen: the Pattern layout's Helix channel window with Helix+ 2's // rows (Triple Stack, Vowel Sync), the Matrix page's Macros tab, the table editor (Draw, Harmonics) and the // Clip-launch Device View card without / with its Helix+ panel; paint costs in prefix-checks.txt. runHelixShot190ml (args[args.indexOf ("--helixshot190ml") + 1].unquoted()); quit(); return; } if (args.contains ("--helixshot190ja")) { // LYNX --helixshot190ja prefix [Wavetable preset .adv]: round 190ja off-screen, the Clip-launch layout's Device // View with a Helix track (the preset's values imported as a Live set would bring them, else Helix's defaults): // the device and its pages (Matrix, MIDI, MPE, Env 2, LFO 1, Osc 2), then the Pattern layout's channel window. const auto i = args.indexOf ("--helixshot190ja"); runHelixShot190ja (args[i + 1].unquoted(), i + 2 < args.size() && ! args[i + 2].startsWith ("--") ? args[i + 2].unquoted() : juce::String()); quit(); return; } if (args.contains ("--liveshot190ce")) { // LYNX.exe --liveshot190ce prefix: round 190ce off-screen, in the Ableton-style layout: the Device View's cards // with their hot-swap and save buttons, a device's menu, hot-swap on (the Browser's bar, the lit button), a // swap and its undo, a duplicate, and the Browser's collections (STARRED tab, the Collections menu, a search // by a collection's name). Writes prefix-checks.txt. runLiveShot190ce (args[args.indexOf ("--liveshot190ce") + 1].unquoted()); quit(); return; } if (args.contains ("--missingsearchshot190eo")) { // LYNX --missingsearchshot190eo prefix folder...: round 190eo (integration of issue #159's fix) off-screen: the // Missing files window's Samples page while a real search of the folders runs (matches streamed in, Stop // shown, Apply usable). Writes prefix-searching.png and prefix-checks.txt; the search is let go at the end. const auto i = args.indexOf ("--missingsearchshot190eo"); const auto prefix = args[i + 1].unquoted(); juce::StringArray folders; for (int k = i + 2; k < args.size(); ++k) folders.add (args[k].unquoted()); juce::LookAndFeel::setDefaultLookAndFeel (&lookAndFeel); std::shared_ptr panel = lynx::makeMissingFilesPanelSearching (lynx::missingFilesSnapshotInfo(), folders); juce::Timer::callAfterDelay (700, [this, panel, prefix] { juce::String status; bool stopShown = false, applyEnabled = false; const auto searching = lynx::missingFilesSearchState (*panel, status, stopShown, applyEnabled); auto image = lynx::shot::paint (*panel, lynx::theme::panel); const auto file = juce::File (prefix + "-searching.png"); file.deleteFile(); if (auto out = file.createOutputStream()) juce::PNGImageFormat().writeImageToStream (image, *out); juce::String checks; auto check = [&checks] (const char* name, bool ok, const juce::String& detail) { checks << name << "=" << (ok ? "OK" : "FAIL") << " " << detail << "\n"; }; check ("still_searching_at_the_shot", searching, {}); check ("status_shows_the_walk", status.contains (lynx::tr ("Searching {0}... {1} files looked at").upToFirstOccurrenceOf ("{0}", false, false)), status); check ("stop_shown", stopShown, {}); check ("apply_usable_during_the_search", applyEnabled, {}); lynx::stopMissingFilesSearch (*panel); juce::File (prefix + "-checks.txt").replaceWithText (checks); quit(); }); return; } // --grooveshot190fm (round 190fm): a Playlist pattern clip's menu with its Groove items (the chooser, Commit, // Extract) and the "Classic swing" folder, and a Groove Pool holding classic swing grooves, offscreen; // prefix-checks.txt holds the checks (also the .lynx round trip of a Playlist clip's groove) if (args.contains ("--grooveshot190fm")) { setApplicationReturnValue (runGrooveShot190fm (args[args.indexOf ("--grooveshot190fm") + 1].unquoted()) ? 0 : 1); quit(); return; } if (args.contains ("--mtshot190fm")) { // LYNX --mtshot190fm prefix: round 190fm off-screen: the MIDI Tools panel's Generate tab with each generator // (prefix-generate-rhythm.png … -euclidean.png), the five side by side as Live's picture shows them // (prefix-generate-panels.png; Live's: ableton190o/shots/live-04-generate-panels.png), then each generator // written into a one-bar pattern and undone again: prefix-checks.txt. juce::LookAndFeel::setDefaultLookAndFeel (&lookAndFeel); runMtShot190fm (args[args.indexOf ("--mtshot190fm") + 1].unquoted()); quit(); return; } if (args.contains ("--drumshot190ec")) { // LYNX.exe --drumshot190ec prefix: round 190ec off-screen: a demo Drum Rack's pad view (default and scrolled), its // chain list with I-O, sends and return chains, a new empty Drum Rack and the Piano roll's pad names. Writes // prefix-checks.txt (hit tests: C1 bottom-left, overview scroll, a pad dragged onto another swaps them). juce::LookAndFeel::setDefaultLookAndFeel (&lookAndFeel); lynx::drumshot::run (args[args.indexOf ("--drumshot190ec") + 1].unquoted()); quit(); return; } if (args.contains ("--linkshot190gl")) { // LYNX --linkshot190gl prefix (round 190gl): Ableton Link off-screen with a second Link peer in this process — // the toolbar in FL's Pattern layout (hidden by default, then shown, off and on) and in the Clip-launch layout // ("1 Link", the position display's progress bar, Play waiting), Settings › Ableton Link, the toggle's // drop-down and the Options menu. Writes prefix-checks.txt. runLinkShot190gl (args[args.indexOf ("--linkshot190gl") + 1].unquoted()); quit(); return; } if (args.contains ("--communityshot190hp")) { // LYNX --communityshot190hp prefix (round 190hp): global MIDI mappings, Mix snapshots and Split at silence // off-screen; writes prefix-checks.txt runCommunityShot190hp (args[args.indexOf ("--communityshot190hp") + 1].unquoted()); quit(); return; } if (args.contains ("--mapshot190ef")) { // LYNX.exe --mapshot190ef prefix: round 190ef's map modes off-screen, in the Clip-launch workflow: MIDI Map Mode // (the overlay over the grid, the Session mixer, the Device View and the transport; the Mapping Browser with // Min / Max), Key Map Mode, the row menu, the title bar's Draw / Key / MIDI switches, Ctrl+M / Ctrl+K and the // Pattern layout keeping Ctrl+M. Writes prefix-checks.txt. runMapShot190ef (args[args.indexOf ("--mapshot190ef") + 1].unquoted()); quit(); return; } if (args.contains ("--sceneshot190ef")) { // LYNX.exe --sceneshot190ef prefix: round 190ef's scene work off-screen, in the Clip-launch workflow: the scene // column with its tempo / time signature fields, the scene menu, a scene field's menu, the column title's menu // (Rename, colours), a duplicated scene and a captured scene. Writes prefix-checks.txt. runSceneShot190ef (args[args.indexOf ("--sceneshot190ef") + 1].unquoted()); quit(); return; } if (args.contains ("--drawshot190ef")) { // LYNX.exe --drawshot190ef prefix: round 190ef off-screen, in the Clip-launch workflow: Draw Mode in an // automation lane, steps at the grid width and an Alt (no grid) freehand stroke drawn through the Playlist's // own mouse handlers, and the Options menu with "Draw Mode". Writes prefix-checks.txt. runDrawShot190ef (args[args.indexOf ("--drawshot190ef") + 1].unquoted()); quit(); return; } if (args.contains ("--clipenvshot190gi")) { // LYNX.exe --clipenvshot190gi prefix: round 190gi off-screen: audio clip envelopes on the Playlist (volume and // pan lanes, edited through the Playlist's own mouse handlers), the clip menu's LYNX extras (Clip envelope ›, // Auto-warp, Quantize audio, run from the menu), warp flags added on the flag strip and moved with Alt + drag, // and the Clip-launch Clip View's Envelopes tab (Clip › Gain, Mixer › Track Panning). Writes prefix-checks.txt. runClipEnvShot190gi (args[args.indexOf ("--clipenvshot190gi") + 1].unquoted()); quit(); return; } if (args.contains ("--gapsshot190kf")) { // LYNX.exe --gapsshot190kf prefix [file.wav]: round gaps190kf off-screen: the Clip View's warp time line (Live's // loop brace and Start / End markers under the beat-time ruler, the seconds ruler of an unwarped clip) on the // probe of gaps190kf/live/cv-clipview.als (voice.wav, warp markers at 30 % / 55 %, Loop 1.3 … 3.3, Start 1.4). const auto i = args.indexOf ("--gapsshot190kf"); runGapsShot190kf (args[i + 1].unquoted(), i + 2 < args.size() ? args[i + 2].unquoted() : juce::String()); quit(); return; } if (args.contains ("--livefactsshot190gx")) { // LYNX.exe --livefactsshot190gx prefix: round 190gx off-screen: the Clip page's Audio panel in Live's 190gu // layout (Beats: Preserve label + chooser, the loop-mode icon chooser beside the Transient Envelope box; // Tones / Texture: Grain Size [+ Flux]; Complex [Pro]), the Envelopes tab with a Clip Gain staircase on Live's // axis, choosers at the bottom left, and an unwarped clip without the Envelopes tab. Writes prefix-checks.txt. runLiveFactsShot190gx (args[args.indexOf ("--livefactsshot190gx") + 1].unquoted()); quit(); return; } if (args.contains ("--dvshot190hr")) { // LYNX.exe --dvshot190hr prefix: round 190hr off-screen, the Clip-launch Clip View: a MIDI clip whose Start // marker sits inside its loop, with its own scale and a follow action (Launch panel controls), the docked // editor's grid value and menu, Ctrl+1 / Ctrl+3 / Ctrl+U on it, the Quantize Settings panel, and an audio clip // transposed past ±12. Writes prefix-checks.txt. runDvShot190hr (args[args.indexOf ("--dvshot190hr") + 1].unquoted()); quit(); return; } if (args.contains ("--warpshot190fm")) { // LYNX.exe --warpshot190fm prefix: round 190fm off-screen: the Clip page's Audio panel of a grid audio clip in // Beats (Preserve, Transient Loop Mode, Envelope), Tones and Texture (Grain Size), Complex (none), and the clip // made unique by a mode change while another clip shares its channel (O16). Writes prefix-checks.txt. runWarpShot190fm (args[args.indexOf ("--warpshot190fm") + 1].unquoted()); quit(); return; } if (args.contains ("--liveshot190dr")) { // LYNX.exe --liveshot190dr prefix: round 190dr off-screen, in the Clip-launch workflow: the Session mixer // under the clip grid (default sections, Track Options, Volume only, hidden, its View menu), the Clip page's // Sample panel of an audio clip (Warp on / off, the Set buttons while it plays, the sample's title) and a // device dragged from one track's Device View to another track. Writes prefix-checks.txt. runLiveShot190dr (args[args.indexOf ("--liveshot190dr") + 1].unquoted()); quit(); return; } if (args.contains ("--modshot190ox")) { // LYNX.exe --modshot190ox prefix [--shot-scale 1.5 --shot-suffix @150] (round 190ox, modulators stage 2): the // Modulators window, rings on knobs, the Modulate with menu; checks in prefix-checks.txt runModShot190ox (args[args.indexOf ("--modshot190ox") + 1].unquoted()); quit(); return; } if (args.contains ("--gapshot190og")) { // LYNX.exe --gapshot190og prefix [--shot-scale 1.5 --shot-suffix @150] (round gap190og, coverage rows still open on // 0.1.31): in the Clip-launch layout, the Edit menu's Live block on the Device View (deviceview-0012), the Clip // panel's Duplicate (Loop) button (detail-019), the clip menu's Crop Clip and Ctrl+Shift+J (detail-020), the // Velocity lane's Randomize footer (detail-047), Key Map Mode on the transport switches (mapping-0028); // checks in prefix-checks.txt runGapShot190og (args[args.indexOf ("--gapshot190og") + 1].unquoted()); quit(); return; } if (args.contains ("--undoshot190mz")) { // LYNX.exe --undoshot190mz prefix [--shot-scale 1.5 --shot-suffix @150] (round 190mz, issue #214): the main // window's undo keys with three edits, in both "Alternate undo mode" settings, and the Edit menu after each // step in the Pattern, Clip-launch and Simple layouts (prefix-menu-*.png); checks in prefix-checks.txt runUndoShot190mz (args[args.indexOf ("--undoshot190mz") + 1].unquoted()); quit(); return; } if (args.contains ("--design190igs4shot")) { // LYNX.exe --design190igs4shot prefix [set.als]: round 190ig slice 4 off-screen, in the Clip-launch layout with the // set imported there (Live's colours, CL-6): the Session grid in Live's look idle, then the launch states — // playing, a launch waiting (both blink phases), a stop waiting, recording, the status pie at 25 / 50 / 75 % — // and the same with Animations off, then round 181a's look (the option); prefix-checks.txt const auto i = args.indexOf ("--design190igs4shot"); const auto project = i + 2 < args.size() && ! args[i + 2].startsWith ("--") ? args[i + 2].unquoted() : juce::String(); runDesign190igS4Shot (args[i + 1].unquoted(), project); quit(); return; } if (args.contains ("--typeaheadtest")) { // LYNX.exe --typeaheadtest out.txt: issue #64 — a real popup menu (headings, a submenu) driven by key presses // through its window's peer, as the OS delivers them; writes what got the highlight and what was picked const auto i = args.indexOf ("--typeaheadtest"); runTypeAheadTest (juce::File (args[i + 1].unquoted())); return; } if (args.contains ("--choosertest")) { // LYNX --choosertest out.txt file: issue #72 — opens LYNX's file chooser as the UI does (makeFileChooser + // launchChooser) and reports which dialog came up and what reached the callback. A built-in dialog is shot // (out.txt.png), `file` typed into it and confirmed; a native one (zenity / kdialog) is left to answer. const auto i = args.indexOf ("--choosertest"); runChooserTest (juce::File (args[i + 1].unquoted()), juce::File (args[i + 2].unquoted())); return; } if (args.contains ("--stabilityshot")) { // LYNX --stabilityshot (round 190gg): offscreen PNGs of the crash prompt, the plugin window's crash // notice, the Plugin manager's "Separate process" column and the monitor's dropout line (no window opens) const auto i = args.indexOf ("--stabilityshot"); runStabilityShot (args[i + 1].unquoted()); return; } if (args.contains ("--repeats190pmshot")) { // LYNX --repeats190pmshot (round 190pm, research190oe P19 / P23): Note Repeats and Conditions, Touch mode setApplicationReturnValue (runRepeatsShot190pm (args[args.indexOf ("--repeats190pmshot") + 1].unquoted()) ? 0 : 1); quit(); return; } if (args.contains ("--discord190qushot")) { // LYNX --discord190qushot [lanes.flp] (round 190qu, Discord 11-24): keys, Clip View, lanes, Simple, Track-only const auto i = args.indexOf ("--discord190qushot"); const auto project = i + 2 < args.size() && ! args[i + 2].startsWith ("--") ? args[i + 2].unquoted() : juce::String(); setApplicationReturnValue (runDiscordShot190qu (args[i + 1].unquoted(), project) ? 0 : 1); quit(); return; } if (args.contains ("--simpleduck190otshot")) { // LYNX --simpleduck190otshot (round 190ot, research190oe P5): "Duck under..." and the Echo send at 100 / 150 % setApplicationReturnValue (runSimpleDuckShot190ot (args[args.indexOf ("--simpleduck190otshot") + 1].unquoted()) ? 0 : 1); quit(); return; } if (args.contains ("--smarttipshot190ok")) { // LYNX --smarttipshot190ok [project.flp] (round 190ok, D1): the smart-disable tip at 100 / 150 % const auto i = args.indexOf ("--smarttipshot190ok"); const auto project = i + 2 < args.size() && ! args[i + 2].startsWith ("--") ? args[i + 2].unquoted() : juce::String(); setApplicationReturnValue (runSmartTipShot190ok (args[i + 1].unquoted(), project) ? 0 : 1); quit(); return; } if (args.contains ("--monitorshot190of")) { // LYNX --monitorshot190of (round 190of): the Plugin performance monitor with its sample numbers // (Longest, Spikes) at 100 % and 150 %, off screen const juce::File dir (args[args.indexOf ("--monitorshot190of") + 1].unquoted()); dir.createDirectory(); juce::LookAndFeel::setDefaultLookAndFeel (&lookAndFeel); { lynx::AudioEngine offline (false); lynx::MainComponent ui (offline, false); offline.dispatchPendingMessages(); for (const auto scale : { 1.0f, 1.5f }) { auto panel = lynx::makePluginMonitorPanel (offline); juce::Component frame; frame.setSize (panel->getWidth(), panel->getHeight()); frame.setOpaque (true); frame.addAndMakeVisible (*panel); savePng (frame.createComponentSnapshot (frame.getLocalBounds(), true, scale), dir.getChildFile (scale > 1.0f ? "plugin-monitor@150.png" : "plugin-monitor.png").getFullPathName()); } } setApplicationReturnValue (0); quit(); return; } if (args.contains ("--jsfxshots")) { // LYNX --jsfxshots [--shot-scale 1.5 --shot-suffix @150] (round 190pj): the JSFX slider panels of // bundled scripts, the Browser's JSFX category and Settings › File with the JSFX folders, off screen const auto i = args.indexOf ("--jsfxshots"); runJsfxShots (args[i + 1].unquoted()); return; } if (args.contains ("--snapshot")) { const auto i = args.indexOf ("--snapshot"); runSnapshot (args[i + 1].unquoted(), args[i + 2].unquoted()); return; } if (args.contains ("--stemsplit")) { // LYNX.exe --stemsplit input.wav folder ["stems=111100 model=2 ..."]: the stem separation of the clip menu, // without the window (round 190jr: the options as the settings file writes them; none = every stem, Standard) const auto i = args.indexOf ("--stemsplit"); lynx::AudioEngine loader (false); const auto options = i + 3 < args.size() && args[i + 3].unquoted().containsChar ('=') ? lynx::stemsplit::optionsFromText (args[i + 3].unquoted().toStdString()) : lynx::stemsplit::Options {}; const auto started = juce::Time::getMillisecondCounterHiRes(); const auto error = lynx::extractStemsToFolder (loader, juce::File (args[i + 1].unquoted()), juce::File (args[i + 2].unquoted()), options); std::fprintf (stderr, "stemsplit: %.0f ms\n", juce::Time::getMillisecondCounterHiRes() - started); juce::File (args[i + 2].unquoted()).getSiblingFile ("stemsplit.txt").replaceWithText (error.isEmpty() ? "result=OK\n" : "result=FAIL " + error + "\n"); setApplicationReturnValue (error.isEmpty() ? 0 : 1); quit(); return; } if (args.contains ("--audio2midi")) { // LYNX.exe --audio2midi input.wav melody|harmony|drums notes.csv: the clip menu's Convert to MIDI, without the // window (round a2m189b's measurements) // Round 190lj: mode "poly" = the "Convert to MIDI (polyphonic)" dialog's path, settings after the CSV as // key=value (poly=0|1 note=0..1 split=0..1 minms=N low=K high=K bends=0|1); audio2midi.txt also gets the // seconds spent resampling, in the model and making the notes. const auto i = args.indexOf ("--audio2midi"); const auto mode = args[i + 2] == "drums" ? lynx::a2m::Mode::drums : args[i + 2] == "harmony" ? lynx::a2m::Mode::harmony : lynx::a2m::Mode::melody; lynx::AudioEngine loader (false); const juce::File csv (args[i + 3].unquoted()); juce::String error, timing; if (args[i + 2] == "poly") { lynx::a2m::ConvertOptions options; for (int k = i + 4; k < args.size() && args[k].containsChar ('='); ++k) { const auto key = args[k].upToFirstOccurrenceOf ("=", false, false); const auto value = args[k].fromFirstOccurrenceOf ("=", false, false); if (key == "poly") options.polyphonic = value.getIntValue() != 0; else if (key == "note") options.noteSensitivity = value.getFloatValue(); else if (key == "split") options.splitSensitivity = value.getFloatValue(); else if (key == "minms") options.minNoteMs = value.getDoubleValue(); else if (key == "low") options.minKey = value.getIntValue(); else if (key == "high") options.maxKey = value.getIntValue(); else if (key == "bends") options.pitchBends = value.getIntValue() != 0; } error = lynx::convertFileToMidiCsv (loader, juce::File (args[i + 1].unquoted()), options, csv, &timing); } else error = lynx::convertFileToMidiCsv (loader, juce::File (args[i + 1].unquoted()), mode, csv); csv.getSiblingFile ("audio2midi.txt").replaceWithText (error.isEmpty() ? "result=OK\n" + (timing.isEmpty() ? juce::String() : "seconds=" + timing + "\n") : "result=FAIL " + error + "\n"); setApplicationReturnValue (error.isEmpty() ? 0 : 1); quit(); return; } if (args.contains ("--stems") || args.contains ("--stemexport")) { // LYNX.exe --stems project.(flp|als|lynx) base.wav [--separate]: one WAV per insert that has sound (like // "Export stems"), in one render of the song (round 190gj; --separate: one render per insert, as before). // LYNX.exe --stemexport project base.ext options.txt [--separate]: what the Export window writes with these // options (exportopts::toText lines: stems, sections, the full mix, formats...), the same code. // Both write .txt: the files with their peaks, the renders, the wall and CPU time. const auto full = args.contains ("--stemexport"); const auto i = args.indexOf (full ? "--stemexport" : "--stems"); const auto separate = args.contains ("--separate"); juce::String error, report; int written = 0; { lynx::AudioEngine loader (false); const juce::File input (args[i + 1].unquoted()), base (args[i + 2].unquoted()); // an .flp or a Live set (.als) opens through the import, as File › Open does (round 182b) auto ok = input.hasFileExtension ("flp;als") ? loader.importFlpFile (input, error) : false; if (! input.hasFileExtension ("flp;als")) if (auto song = lynx::ProjectFile::load (input, error)) { loader.setSong (std::move (*song)); ok = true; } const auto& song = loader.getSong(); lynx::StemPlan plan; if (full && ok) plan = lynx::planStemExport (song, lynx::exportopts::fromText (juce::File (args[i + 3].unquoted()).loadFileAsString().toStdString()), base); else if (ok) { // every insert a channel goes to, as " - .wav", 24-bit, 6 s of tail at most lynx::ExportSettings settings; plan.sets.push_back ({ song, settings.toOptions() }); for (int t = 1; t < (int) song.mixer.size(); ++t) if (std::any_of (song.channels.begin(), song.channels.end(), [t] (const lynx::ChannelDef& c) { return c.mixerTrack == t; })) plan.items.push_back ({ juce::String (t), base.getSiblingFile (base.getFileNameWithoutExtension() + " - " + juce::String (t) + ".wav"), 0, t, lynx::makeBounceSong (song, t), settings.toOptions() }); } const auto wallStart = juce::Time::getMillisecondCounterHiRes(); const auto cpuStart = std::clock(); lynx::StemRunStats stats; std::vector lines (plan.items.size()); auto previous = wallStart; // (one render per file: the time since the file before is its render's) written = lynx::runStemExport ( plan, [] (std::function f) { f(); }, {}, {}, {}, [&] (std::size_t k, bool done, float peak) { const auto now = juce::Time::getMillisecondCounterHiRes(); if (done) lines[k] = plan.items[k].file.getFileName() + " peak=" + juce::String (peak) + " ms=" + juce::String (now - previous, 0) + "\n"; previous = now; }, separate, full, &stats); const auto wallMs = juce::Time::getMillisecondCounterHiRes() - wallStart; const auto cpuMs = 1000.0 * (double) (std::clock() - cpuStart) / (double) CLOCKS_PER_SEC; for (const auto& line : lines) report << line; report << "renders=" << (stats.passes + stats.alone) << " shared=" << stats.passes << " inshared=" << stats.inPass << " alone=" << stats.alone << "\n"; for (const auto& why : stats.why) report << "alone: " << why << "\n"; report << "wall_ms=" << juce::String (wallMs, 0) << " cpu_ms=" << juce::String (cpuMs, 0) << " make_ms=" << juce::String (stats.makeMs, 0) << " render_ms=" << juce::String (stats.renderMs, 0) << "\n"; } report << "stems=" << written << "\n"; juce::File (args[i + 2].unquoted() + ".txt").replaceWithText (report); setApplicationReturnValue (written > 0 ? 0 : 1); quit(); return; } // --export-als [--live11] [--reference] [--scan]: "/ Project/.als" (round 175a) if (args.contains ("--export-als")) { const auto i = args.indexOf ("--export-als"); runAlsExport (args[i + 1].unquoted(), args[i + 2].unquoted(), args.contains ("--live11"), args.contains ("--reference")); return; } // --export-flm (round 190og, FLM coverage app-0003): File › "Save a copy as FL // Studio Mobile project" without the window; the samples go beside it, the losses and the result to ".txt". // --flmexportshot [--shot-scale 1.5 --shot-suffix @150]: the window with that project's losses if (args.contains ("--export-flm") || args.contains ("--flmexportshot")) { const auto shot = args.contains ("--flmexportshot"); const auto i = args.indexOf (shot ? "--flmexportshot" : "--export-flm"); const juce::File input (args[i + (shot ? 2 : 1)].unquoted()); juce::String error, report; auto ok = false; { lynx::AudioEngine loader (false); if (input.hasFileExtension ("flp;als;flm;songtmpl;band;blx;mod;xm;s3m;it;dawproject")) ok = loader.importFlpFile (input, error); else if (auto song = lynx::ProjectFile::load (input, error)) { loader.setSong (std::move (*song)); ok = true; } if (ok && shot) { juce::LookAndFeel::setDefaultLookAndFeel (&lookAndFeel); lynx::FlmExportOptions o; o.title = input.getFileNameWithoutExtension().toStdString(); const auto dry = lynx::exportFlm (loader.getSong(), o); auto list = std::make_shared(); std::unique_ptr w (lynx::buildFlmExportWindow (dry, list)); saveSnapshot (*w, args[i + 1].unquoted() + "-flmexport.png"); report << lynx::flmExportLossText (dry) << "\n"; } else if (ok) { loader.capturePluginStates(); lynx::FlmExportResult result; const juce::File out (args[i + 2].unquoted()); ok = lynx::writeFlmCopy (loader.getSong(), out, result, error); report << "bytes=" << (int) result.bytes.size() << "\nsamples=" << (int) result.samples.size() << "\n"; for (const auto& l : result.lost) report << (l.sound ? "sound: " : "other: ") << juce::String::fromUTF8 (l.text.c_str()).replace ("{0}", juce::String::fromUTF8 (l.detail.c_str())) << "\n"; } } report << "result=" << (ok ? "OK" : "ERROR " + error) << "\n"; juce::File (args[i + (shot ? 1 : 2)].unquoted() + (shot ? "-flmexport.txt" : ".txt")).replaceWithText (report); setApplicationReturnValue (ok ? 0 : 1); quit(); return; } // --gamepadshot (round 184a, S16): the game controller's hints overlay and the MIDI settings page with // the option on, offscreen, plus the poller fed fake pad states ("-gamepad.txt") if (args.contains ("--gamepadshot")) { runGamepadShot (args[args.indexOf ("--gamepadshot") + 1].unquoted()); return; } // --midioutshot [--shot-scale 1.5] (round 190jl): Settings › MIDI with the output devices' Port boxes // (the snapshot's sample devices: the volca on port 1 of its own, the drum machine with master sync), offscreen if (args.contains ("--midioutshot")) { juce::LookAndFeel::setDefaultLookAndFeel (&lookAndFeel); { lynx::AudioEngine engine (false); auto page = lynx::makeMidiPage (engine, {}, false); page->setSize (1000, 1300); savePng (lynx::shot::snapshot (*page), args[args.indexOf ("--midioutshot") + 1].unquoted() + "-settings-midi.png"); } setApplicationReturnValue (0); quit(); return; } // --export-bundle [--zip] [--no-mixdown] [--shot ] (round 184a, S9): File › // Export › "For other apps..." without the window; the report goes to "/export-bundle.txt" if (args.contains ("--export-bundle")) { const auto i = args.indexOf ("--export-bundle"); runBundleExport (args[i + 1].unquoted(), args[i + 2].unquoted(), args.contains ("--zip"), ! args.contains ("--no-mixdown"), args.contains ("--shot") ? args[args.indexOf ("--shot") + 1].unquoted() : juce::String()); return; } if (args.contains ("--export-flp")) { const auto i = args.indexOf ("--export-flp"); runFlExport (args[i + 1].unquoted(), args[i + 2].unquoted(), args.contains ("--substitute")); return; } if (args.contains ("--export")) { const auto i = args.indexOf ("--export"); const auto insert = args.contains ("--insert") ? args[args.indexOf ("--insert") + 1].getIntValue() : 0; runExport (args[i + 1].unquoted(), args[i + 2].unquoted(), args.contains ("--pattern"), insert); return; } if (args.contains ("--tempomarkershot")) { // LYNX --tempomarkershot (round 190hq): the Playlist of the project with its tempo // markers on the ruler (-playlist.png) and the "Save a copy for an older LYNX" window for each release // (-savecopy-.png); no window, nothing saved const auto i = args.indexOf ("--tempomarkershot"); const auto prefix = args[i + 1].unquoted(); juce::LookAndFeel::setDefaultLookAndFeel (&lookAndFeel); lynx::AudioEngine shotEngine (false); juce::String error; auto ok = false; if (auto song = lynx::ProjectFile::load (juce::File (args[i + 2].unquoted()), error)) shotEngine.setSong (std::move (*song)), ok = true; if (ok) { { lynx::PlaylistComponent playlist (shotEngine); playlist.setBounds (0, 0, 1400, 420); playlist.setVisible (true); playlist.setViewForSnapshot (70.0, 0, 0); shotEngine.dispatchPendingMessages(); saveSnapshot (playlist, prefix + "-playlist.png"); } auto list = std::make_shared(); std::unique_ptr w (lynx::MainComponent::buildSaveCopyWindow (lynx::ProjectFile::toJson (shotEngine.getSong()), list)); const auto releases = lynx::olderlynx::releases(); for (int k = 0; k < releases.size(); ++k) { w->getComboBoxComponent ("release")->setSelectedItemIndex (k, juce::sendNotificationSync); saveSnapshot (*w, prefix + "-savecopy-" + releases[k] + ".png"); } } setApplicationReturnValue (ok ? 0 : 1); quit(); return; } if (args.contains ("--savecopyfor")) { // LYNX --savecopyfor (round 190hq, B20): File › "Save a copy for an older // LYNX..." without the window; what the copy loses goes to .txt (English), then result=OK const auto i = args.indexOf ("--savecopyfor"); const juce::File input (args[i + 1].unquoted()), output (args[i + 3].unquoted()); const auto release = args[i + 2].unquoted(); juce::String report, error; auto ok = false; if (const auto song = lynx::ProjectFile::load (input, error)) { const auto copy = lynx::olderlynx::forRelease (*song, release); for (const auto& l : copy.lost) report << (l.sound ? "sound: " : "view: ") << juce::String::fromUTF8 (l.text).replace ("{0}", l.detail) << "\n"; ok = copy.ok && output.replaceWithText (copy.json, false, false, nullptr); if (! copy.ok) error = copy.error; } report << "result=" << (ok ? juce::String ("OK") : "ERROR " + error) << "\n"; juce::File (output.getFullPathName() + ".txt").replaceWithText (report); setApplicationReturnValue (ok ? 0 : 1); quit(); return; } if (args.contains ("--render")) { const auto i = args.indexOf ("--render"); runRender (args[i + 1].unquoted(), args[i + 2].unquoted(), args[i + 3].getDoubleValue()); return; } // session breadcrumb: a fail-fast (no crash handler runs) still leaves the last steps behind (round 111) uncleanLastStep = collectUncleanSessions(); sessionsFolder().createDirectory(); lynx::crashguard::beginSession ( sessionsFolder().getChildFile ("session-" + juce::String (lynx::crashguard::processId()) + ".txt").getFullPathName().toStdString(), ("LYNX session\nversion=" + getApplicationVersion() + "\npid=" + juce::String (lynx::crashguard::processId()) + "\nstart=" + juce::String ((juce::int64) lynx::crashguard::processStartTime()) + "\nstarted=" + juce::Time::getCurrentTime().toISO8601 (true) + "\n").toStdString()); startHangWatch(); // LYNX_PROFILE_MAIN= (round 174f): the message thread sampled every millisecond, 5-second windows if (const auto profile = juce::SystemStats::getEnvironmentVariable ("LYNX_PROFILE_MAIN", {}); profile.isNotEmpty()) lynx::crashguard::startMainProfiler (profile.toStdString()); startupTrace.mark ("initialise (normal start)"); // (round 190hd, Windows) how long before the trace's 0 the process was made: the loader (the exe, its DLLs, // relocations) and the static initialisers that ran before this file's if (const auto created = lynx::crashguard::processStartTime(); created != 0) { const auto t0 = (std::uint64_t) std::chrono::duration_cast (startupTrace.t0System.time_since_epoch()).count() * 10u + 116444736000000000ull; // (FILETIME: 100 ns since 1601) if (t0 > created) startupTrace.mark ((" (the process was made " + juce::String ((double) (t0 - created) / 10000.0, 1) + " ms before this trace's 0: the loader, the DLLs, the first static initialisers)").toRawUTF8()); } prepareGraphicsDevice(); if (startupTrace.on) lynx::startupMark = startupMarkHook; juce::LookAndFeel::setDefaultLookAndFeel (&lookAndFeel); lynx::themeui::loadSaved(); // the user's theme (Options › Theme, round 162d) startupOptions = lynx::StartupOptions::load(); if (lynx::demo::active()) // (round 190np: --demo records from the first frame: no splash card, no start-up sound) startupOptions.splash = startupOptions.sound = false; lynx::registerFileTypes(); startupTrace.mark ("options + file types"); // Double-clicking a .lynx/.flp opens LYNX with the file as an argument; a path typed in a terminal may be relative // (D#92, round 180a: it was ignored, leaving the blank project with no message). A missing file gets "Could not open". if (args.size() > 0 && lynx::safety::isFileArgument (args[0].unquoted().toStdString())) fileToOpen = juce::File::getCurrentWorkingDirectory().getChildFile (args[0].unquoted()); // LYNX --no-plugins project.lynx (round 190ap): File › "Open without third-party plugins..." from the command // line, for a project a plugin keeps from opening — no hosted plugin is created, each keeps its settings if (const auto i = args.indexOf ("--no-plugins"); i >= 0) { if (i + 1 < args.size() && lynx::safety::isFileArgument (args[i + 1].unquoted().toStdString())) fileToOpen = juce::File::getCurrentWorkingDirectory().getChildFile (args[i + 1].unquoted()); startWithoutPlugins = fileToOpen.hasFileExtension ("lynx"); } // LYNX_TEST_MODE=1 LYNX --open-event-test : the file arrives the way macOS's Finder delivers it (a Linux // or Windows run can exercise that path): 0 ms = at once, before the window exists if (lynx::platform::testMode() && args[0] == "--open-event-test" && args.size() > 2) { const auto file = args[2].unquoted().quoted(); if (args[1].getIntValue() == 0) anotherInstanceStarted (file); else juce::Timer::callAfterDelay (args[1].getIntValue(), [this, file] { anotherInstanceStarted (file); }); } // LYNX --opentime project.(flp|lynx)|- report.txt [idle seconds] (round 165i): the normal start-up (splash, audio // device, window) opens the project, waits until it is loaded and LYNX has gone quiet, measures the idle CPU and // memory, writes the times and quits normally (a benchmark that killed LYNX left "closed unexpectedly" behind) if (args.contains ("--opentime")) { const auto i = args.indexOf ("--opentime"); const auto project = args[i + 1].unquoted(); fileToOpen = project != "-" && juce::File::isAbsolutePath (project) ? juce::File (project) : juce::File(); openTimeReport = juce::File (args[i + 2].unquoted()); if (args.size() > i + 3 && ! args[i + 3].startsWith ("--")) openTimeIdleSeconds = juce::jlimit (1, 120, args[i + 3].getIntValue()); } // round 190go: the ASIO device of the last session is made and opened from now on, while the splash and the // window come up (see below) lynx::AudioEngine::prewarmAudioDevice(); // round 190go: the built-in start-up sound is made while the splash and the window come up (pure maths) if (startupOptions.sound && lynx::themeui::current().startupSound.empty()) startupSampleJob = std::async (std::launch::async, [] { return lynx::makeStartupSample(); }); // Round 190go (start-up faster than FL Studio): the main window is built first, with the engine ready but no // audio device open; the device opens after it. An ASIO device of the last session was made and opened ahead, // on a worker, while the window was built (AudioEngine::prewarmAudioDevice; the driver itself only ever runs on // JUCE's ASIO thread, as COM wants). Play pressed before the device is open starts with it. if (! startupOptions.splash) { startEngine(); createMainWindow(); mainWindow->reveal(); startupTrace.mark ("window revealed"); // the device (and the start-up sound) once the window's first frame is on screen mainWindow->whenPainted ([this] { openAudioDevice(); openMidiDevices(); startAfterWindow (lynx::demo::active()); // (round 190np: --demo has no splash; its first run still gets the welcome card) }); return; } // the splash first; the main window is built behind its card (still: the logo has not started to drop; building // it during the drop would stop the animation, both run on the message thread), then the audio device opens // (the start-up sound needs it), and the drop starts with its sound. The window shows the moment the logo has // landed (round 190go, A4: before, the window was built only after the drop: the drop, then ~0.6 s of build). // Round 190hd (Windows): the card draws on a thread of its own, so the main window is built DURING the drop // (startOnItsOwnThread below). splash = lynx::makeStartupSplash(); startupTrace.mark ("splash made"); splash->showOnDesktop(); startupTrace.mark ("splash on the desktop"); if (splash->drawsOnItsOwnThread()) { startWithThreadedSplash(); return; } // the rest once the card's first frame is on the screen (round 190go: before, a fixed 40 ms), at the latest // after 40 ms const auto goOn = [this, started = std::make_shared (false)] { if (std::exchange (*started, true) || splash == nullptr) // (once; or quit meanwhile) return; startEngine(); if (splash == nullptr) // quit meanwhile return; createMainWindow(); if (splash == nullptr || mainWindow == nullptr) return; if (startupOptions.sound) openAudioDevice (false); // (else after the splash: nothing waits for it) // one turn of the message loop before the drop: what fell due while the window was built (JUCE's timers, // the window's own async work) runs now, on the still card, not in the drop's first frames juce::MessageManager::callAsync ([this] { startDrop(); }); }; splash->onFirstFrame = goOn; juce::Timer::callAfterDelay (40, goOn); } // Round 190hd (start-up faster than FL Studio, Windows): the card draws on a thread of its own (ui/Splash.cpp), so // nothing the message thread does stops the drop. The card shows at once (no Direct2D device is made for it); the // engine starts and the audio device opens behind the still card (an ASIO device of the last session was made and // opened ahead on its own thread meanwhile), the drop starts with its sound, and the main window is built while // the logo drops and shown as soon as it is built, behind the card (the drop and its sound go on above it); the card // fades the moment the logo has landed. The card stays for the drop only (the JUCE card's // 2.1 s from the process start was there to keep a fast start from flashing; the drop alone is 1.05 s). void startWithThreadedSplash() { splash->onFirstFrame = [this] { if (splash != nullptr && startupTrace.on) startupTrace.mark ((" splash: first frame on the screen at " + juce::String (std::chrono::duration (splash->getFirstFrameTime() - startupTrace.t0).count(), 1) + " ms (its own thread)") .toRawUTF8()); }; juce::MessageManager::callAsync ([this] { if (splash == nullptr) // (quit meanwhile) return; startEngine(); if (splash == nullptr) return; if (startupOptions.sound) openAudioDevice (false); // (else after the splash: nothing waits for it) startDrop(); // the main window while the logo drops (one more message, so the drop's start is not held by it) juce::MessageManager::callAsync ([this] { if (splash == nullptr || mainWindow != nullptr || engine == nullptr) return; createMainWindow(); // shown as soon as it is built, behind the card: the logo goes on dropping above it and the card fades at // the landing as before (LYNX_REVEAL_AT_LANDING=1: the window shows at the landing, as in round 190go) if (mainWindow != nullptr && splash != nullptr && juce::SystemStats::getEnvironmentVariable ("LYNX_REVEAL_AT_LANDING", {}) != "1") { mainWindow->reveal(); windowRevealed = true; startupTrace.mark ("window revealed (behind the card, while the logo drops)"); splash->raise(); } }); }); } // the logo's drop and the start-up sound together; the window shows the moment the logo has landed void startDrop() { const auto ownThread = splash != nullptr && splash->drawsOnItsOwnThread(); // (the window is built during the drop) if (splash == nullptr || (mainWindow == nullptr && ! ownThread) || engine == nullptr) return; if (startupOptions.sound) playStartupSound(); splash->setStatus (lynx::tr ("Loading the workspace...")); splash->startClock(); // the minimum counts from the process start (the window and the audio device took part of it already); a card // on its own thread stays for the drop (round 190hd) splashDuration = ownThread ? landingSeconds : lynx::SplashScreen::remainingDuration (startupTrace.seconds()); splash->setBarDuration (splashDuration); splash->whenLanded (splashDuration, [this] { if (splash == nullptr || mainWindow == nullptr) return; if (startupTrace.on) startupTrace.mark (("splash: the drop in " + juce::String (splash->getDropFrames()) + " frames, longest gap " + juce::String (splash->getLongestDropGapMs(), 1) + " ms" + (splash->getLongestDropGapAt() >= 0.0 ? " (at " + juce::String (splash->getLongestDropGapAt(), 3) + " s of its clock; the frame before: " + splash->getLongestDropGapDetail() + ")" : juce::String())) .toRawUTF8()); if (! std::exchange (windowRevealed, true)) { mainWindow->reveal(); startupTrace.mark ("window revealed (after the splash)"); } splash->raise(); const auto deviceOpen = ! engine->isAudioDeviceOpenPending(); splash->finish ([this, deviceOpen] { splash = nullptr; // without the start-up sound the device opens now, once the card has faded (the window is up) if (! deviceOpen) openAudioDevice(); openMidiDevices(); if (! deviceOpen) startAfterWindow (true); }); if (deviceOpen) mainWindow->whenPainted ([this] { startAfterWindow (true); }); }); } // what follows the window's first frame (the audio device is open): the notice of an unclean end, the start-up // project, the probes and the update check; on a first run (with the splash) the setup wizard void startAfterWindow (bool offerSetupWizard) { if (std::exchange (startedAfterWindow, true) || mainWindow == nullptr) return; // (round 190go) each step after the window is a timed line of the start-up trace showUncleanNotice(); startupTrace.mark ("after the window: unclean-session notice"); openStartupFile(); startupTrace.mark ("startup file opened"); startOpenTimeProbe(); if (! lynx::demo::active()) // (round 190np: --demo records videos: no update prompt, no support note) { startUpdateCheck(); startSupportNote(); // (round 190fq) } startupTrace.mark ("after the window: probes, update check scheduled"); juce::MessageManager::callAsync ([] { startupTrace.mark ("first message loop turn"); }); markSettled(); // (round 190gd) // first run: language, audio, plugin folders (FL Studio's included) and a background scan if (! offerSetupWizard) return; // round 190np: a fresh profile gets the welcome card ("Where are you coming from?"); a profile that had LYNX's // settings and never finished the old wizard keeps the old wizard; an answered one gets nothing (core/Onboarding.h) const auto action = lynx::onboarding::startAction (lynx::setupWizardDone(), lynx::onboardui::profileExistedAtStart(), mainWindow->getContent().onboardingStateForCheck().pending); using StartAction = lynx::onboarding::StartAction; if (action != StartAction::none && lynx::platform::testMode()) lynx::platform::testModeLog (action == StartAction::welcomeCard ? "setup wizard: welcome card" : "setup wizard"); else if (action == StartAction::welcomeCard) { mainWindow->getContent().showWelcomeCard (true); startupTrace.mark ("after the window: welcome card shown"); } else if (action == StartAction::setupWizard) { mainWindow->showSetupWizard(); startupTrace.mark ("after the window: setup wizard shown"); } // issue #252 (round 190oq; on by default as FL's Welcome window, rollup 0.1.31 step 6): the start page over the start-up project, never over the // first run's card, never when a file was given to open if (lynx::startpage::showAtStart (lynx::startpage::enabled(), fileToOpen != juce::File(), action != StartAction::none, openTimeReport != juce::File() || lynx::platform::testMode())) { mainWindow->getContent().showStartPage(); startupTrace.mark ("after the window: start page shown"); } } // round 190fq: the start-up support note (ui/SupportLynx.h) counts this start and, from the 10th on, may show its // card once at a quiet moment. Only here, on the normal start path (the command-line modes returned earlier); test // mode and CI machines neither count nor show it. void startSupportNote() { if (mainWindow == nullptr) return; const auto env = [] (const char* name) { return juce::SystemStats::getEnvironmentVariable (name, {}).toStdString(); }; const auto quiet = lynx::supportnote::quietEnvironment (lynx::platform::testMode(), env ("CI"), env ("GITHUB_ACTIONS"), env ("LYNX_NO_SUPPORT_NOTE")); if (quiet && lynx::platform::testMode()) lynx::platform::testModeLog ("support note: not counted (test mode)"); mainWindow->getContent().startSupportNote (quiet); } // the start-up trace's last lines: what the first seconds after the window add (lazy work, caches, the first paints) static void markSettled() { if (! startupTrace.on) return; juce::Timer::callAfterDelay (5000, [] { startupTrace.mark ("5 s after the window"); startupTrace.write(); }); juce::Timer::callAfterDelay (15000, [] { startupTrace.mark ("15 s after the window"); startupTrace.write(); }); } // Round 190hd (Windows): the Direct3D 11 + Direct2D device (~0.35 s: the graphics driver loads) is made once, on a // worker, while the splash card, the engine and the audio device come up, and kept until LYNX closes: a 1 x 1 // Direct2D image holds JUCE's shared DirectX object (its devices), so the main window finds them made and nothing // makes them again (before, every holder going away -- the splash's logo, a temporary one -- could mean a new device // at its next use). Other systems: nothing to do. void prepareGraphicsDevice() { #if JUCE_WINDOWS if (juce::SystemStats::getEnvironmentVariable ("LYNX_GPU_PREWARM", {}) == "0") return; graphicsDeviceJob = std::async (std::launch::async, [] { const auto from = std::chrono::steady_clock::now(); juce::Image holder (juce::Image::ARGB, 1, 1, false); // (NativeImageType: Direct2D, the shared device) return std::make_pair (holder, std::chrono::duration (std::chrono::steady_clock::now() - from).count()); }); #endif } void markGraphicsDevice() { if (! graphicsDeviceJob.valid() || ! startupTrace.on || std::exchange (graphicsDeviceMarked, true)) return; const auto ready = graphicsDeviceJob.wait_for (std::chrono::seconds (0)) == std::future_status::ready; startupTrace.mark (ready ? (" graphics device made on a worker in " + juce::String (graphicsDeviceJob.get().second, 1) + " ms").toRawUTF8() : " graphics device: still being made on its worker"); } void startEngine() { startupTrace.mark ("before the audio engine"); lynx::BrowserComponent::allowIndexerProcess = true; // (round 190hd: the normal window only) // (round 190go) ready to play, no device open yet: see openAudioDevice engine = std::make_unique (true, -1, true, true); lynx::videoview::install (*engine); // (Fruity Video Player channels: their sound tracks) startupTrace.mark ("audio engine (no device yet)"); crashEngine = engine.get(); lynx::crashreporter::watchAudioDevice (engine->getDeviceManager()); // (the session file names the device: crash reports) // a project given on the command line: its slow plugin modules (a Waves shell) start now, on their own // thread, while the splash and the main window come up (round 121) if (fileToOpen.hasFileExtension ("flp")) if (juce::MemoryBlock data; fileToOpen.loadFileAsData (data)) try { engine->getPluginHost().startModulesFor (lynx::flpForeignPlugins (flp::parseProject ({ static_cast (data.getData()), data.getSize() }))); startupTrace.mark ("plugin modules started ahead"); } catch (const flp::Error&) { } } // The audio device of the last session, then (withSound) the start-up sound on it (once; message thread) void openAudioDevice (bool withSound = true) { if (engine == nullptr || ! engine->isAudioDeviceOpenPending()) return; engine->openAudioDevice(); if (const auto prewarmed = lynx::asioPrewarmReport(); prewarmed.isNotEmpty() && startupTrace.on) startupTrace.mark ((" " + prewarmed).toRawUTF8()); startupTrace.mark ("audio device opened"); addDriverFileDeviceType(); if (withSound) playStartupSound(); } // issue #280 (round 190qr): the LYNX extra "Play a sound when an export finishes" (core/ExportDone.h) void bindExportDoneSound() { lynx::exportdone::playSound = [this] { if (engine != nullptr) { auto sound = lynx::startup::makeDoneSound (48000.0); auto sample = std::make_shared(); sample->left = std::move (sound.left); sample->right = std::move (sound.right); sample->sampleRate = sound.sampleRate; engine->previewSample (sample); } }; } void playStartupSound() { if (startupOptions.sound && ! std::exchange (startupSoundPlayed, true) && engine != nullptr) { // Options › Theme › Startup sound (issue #12): the user's file, else (or when it can't be read) LYNX's own std::shared_ptr sound; if (const auto& own = lynx::themeui::current().startupSound; ! own.empty() && juce::File (juce::String::fromUTF8 (own.c_str())).existsAsFile()) sound = engine->getSampleLibrary().load (juce::String::fromUTF8 (own.c_str())); if (sound == nullptr && startupSampleJob.valid()) sound = startupSampleJob.get(); engine->previewSample (sound != nullptr ? sound : lynx::makeStartupSample()); } startupTrace.mark ("startup sound"); } void openMidiDevices() { if (engine != nullptr) engine->openMidiDevices(); // (its own line in the start-up trace: "engine: MIDI inputs") } void createMainWindow() { bindExportDoneSound(); // (round 190qr, #280) mainWindow = std::make_unique ("LYNX SHARE", *engine); // the brand; getApplicationName() stays "LYNX" (an id: instance lock, X11 WM_CLASS, ALSA client) lynx::setMainWindowForOwnership (mainWindow.get()); lynx::crashguard::watchDisplayConnection (onDisplayLost); // (round 190rf, Linux: the display is open now) lynx::applyRenderingChoice (*mainWindow); // (GPU rendering off: GDI; round 157a) lynx::startRenderingWatch(); startupTrace.mark ("main window built"); lynx::remoteui::install ([this] (bool enabled) { remoteControl = nullptr; if (enabled) remoteControl = lynx::RemoteControl::create (*engine, true, [this] { const auto title = mainWindow != nullptr ? mainWindow->getName() : juce::String ("Untitled"); const auto separator = title.indexOf (" - "); return separator >= 0 ? title.substring (separator + 3) : title; }, [this] { const auto file = mainWindow != nullptr ? mainWindow->getContent().getCurrentProjectFile() : juce::File(); return file == juce::File() ? juce::String() : file.getFullPathName(); }); lynx::remoteui::setRuntimeStatus (remoteControl != nullptr && remoteControl->active()); }); if (lynx::demo::active()) // round 190np: --demo's view operations (ui.find, ui.click, ui.layout...) on the API lynx::RemoteControl::setExtension (lynx::demo::operations(), [this] (const juce::String& op, const juce::var& args) -> juce::var { if (mainWindow == nullptr) throw std::runtime_error ("No main window"); return mainWindow->getContent().handleDemoOp (op, args); }); markGraphicsDevice(); } // the previous run ended without closing (see collectUncleanSessions): say so once, with its last step — and, as // Settings › General › "Crash reports" says (round 159), ask whether to send a report, send it unasked, or not void showUncleanNotice() { if (lynx::platform::testMode()) // LYNX_TEST_MODE: no prompt, no report sent (written to test-mode.log) { if (uncleanLastStep.isNotEmpty()) lynx::platform::testModeLog ("\"closed unexpectedly\" notice (last step: " + uncleanLastStep + ")"); return; } if (uncleanLastStep.isEmpty()) { lynx::crashreporter::retryPending(); // (reports an earlier run could not send: once more) return; } auto message = lynx::tr ("The last session ended without closing normally. Last step: {0}. Backup copies of your project are in " "LYNX SHARE's autosave folder; details in crash-history.log.", { uncleanLastStep }); uncleanLastStep.clear(); const auto cause = uncleanCause(); // round 157a: a plugin's editor was opening — it crashed (often in the graphics driver, inside the plugin's own // OpenGL window): offer to keep that plugin in its own process, where a crash takes only the plugin down juce::String separatePlugin; if (cause.editorPlugin.isNotEmpty() && ! lynx::pluginSandboxEnabled() && ! lynx::pluginAlwaysSeparate (cause.editorPlugin)) separatePlugin = cause.editorPlugin; // LYNX's own drawing crashed in the graphics driver (Direct2D / Direct3D): draw with the CPU from now on else if (cause.gpuDriver && lynx::gpuRenderingEnabled()) { lynx::setGpuRenderingEnabled (false); message << "\n\n" << lynx::tr ("The crash was in the graphics driver ({0}). LYNX SHARE now draws its windows without the GPU; you can turn GPU " "rendering back on in Options > General settings (after a driver update, for example).", { cause.driverModule }); } // round 165e: the Visualizer's GPU view was drawing when the session ended (a driver crash, a hang, the machine // going down): the Visualizer draws with the 2D renderer from now on (its GPU button turns it back on) for (int i = uncleanSteps.size(); --i >= 0;) { if (uncleanSteps[i].contains (lynx::visualgl::stopNote)) break; if (uncleanSteps[i].contains (lynx::visualgl::startNote)) { if (lynx::visualgl::enabled()) { lynx::visualgl::setEnabled (false); message << "\n\n" << lynx::tr ("The Visualizer was drawing with the GPU (OpenGL) when it happened. It now draws without the GPU; its GPU " "button turns it back on."); } break; } } const auto session = lynx::crashreporter::parseSession (uncleanSessionText); auto* devices = engine != nullptr ? &engine->getDeviceManager() : nullptr; const auto action = lynx::crashreport::actionFor (lynx::crashreporter::consent()); lynx::crashreporter::retryPending(); if (action == lynx::crashreport::Action::askUser) { if (separatePlugin.isNotEmpty()) message << "\n\n" << lynx::tr ("It happened while the window of {0} was opening{1}.", { separatePlugin, cause.gpuDriver ? lynx::tr (" (in the graphics driver, {0})", { cause.driverModule }) : juce::String() }); lynx::crashreporter::showStartupDialog (session, message, separatePlugin, [separatePlugin] { lynx::setPluginAlwaysSeparate (separatePlugin, true); }, devices); return; } if (action == lynx::crashreport::Action::sendSilently) { const auto input = lynx::crashreporter::makeInput (session, session.kind(), devices); lynx::crashreporter::send (lynx::crashreporter::buildJson (input, false), juce::String::fromUTF8 (input.id.c_str())); message << "\n\n" << lynx::tr ("A crash report is being sent to help fix it (Options > General settings > Crash reports)."); } if (separatePlugin.isNotEmpty()) { juce::AlertWindow::showOkCancelBox ( juce::MessageBoxIconType::WarningIcon, lynx::tr ("LYNX SHARE closed unexpectedly"), message + "\n\n" + lynx::tr ("It happened while the window of {0} was opening{1}. Run {0} in a separate process from now on? If it " "crashes again, only the plugin stops and LYNX SHARE keeps running (Plugin wrapper menu: \"Always run in a " "separate process\").", { separatePlugin, cause.gpuDriver ? lynx::tr (" (in the graphics driver, {0})", { cause.driverModule }) : juce::String() }), lynx::tr ("Run separately"), lynx::tr ("No"), nullptr, juce::ModalCallbackFunction::create ([separatePlugin] (int result) { if (result != 0) lynx::setPluginAlwaysSeparate (separatePlugin, true); })); return; } juce::AlertWindow::showMessageBoxAsync (juce::MessageBoxIconType::WarningIcon, lynx::tr ("LYNX SHARE closed unexpectedly"), message); } // --opentime: after the start-up file was handed to the window void startOpenTimeProbe() { if (openTimeReport == juce::File()) return; struct Probe final : juce::Timer { LynxApplication& app; juce::File report, project; int idleSeconds; int phase = 0; // 0 loading, 1 settling, 2 idle measurement double revealedS = 0.0, loadedS = -1.0, settledS = -1.0, cpuAtLoaded = 0.0; double lastCpu = 0.0, lastT = 0.0, quietSince = -1.0, idleCpu0 = 0.0, idleT0 = 0.0; Probe (LynxApplication& a, juce::File r, juce::File p, int idle) : app (a), report (std::move (r)), project (std::move (p)), idleSeconds (idle) { revealedS = startupTrace.seconds(); startTimer (250); } bool loaded() const { if (project == juce::File()) return true; return app.mainWindow != nullptr && app.mainWindow->getName().containsIgnoreCase (project.getFileNameWithoutExtension()); } void finish (const juce::String& result) { stopTimer(); const auto now = startupTrace.seconds(); const auto cpu = lynx::processCpuSeconds(); juce::String text; text << "project=" << (project == juce::File() ? juce::String ("-") : project.getFullPathName()) << "\n" << "window_s=" << juce::String (revealedS, 3) << "\n" << "loaded_s=" << juce::String (loadedS, 3) << "\n" << "settled_s=" << juce::String (settledS, 3) << "\n" << "cpu_at_loaded_s=" << juce::String (cpuAtLoaded, 3) << "\n" << "idle_s=" << juce::String (now - idleT0, 2) << "\n" << "idle_cpu_pct=" << juce::String (phase == 2 && now > idleT0 ? 100.0 * (cpu - idleCpu0) / (now - idleT0) : -1.0, 1) << "\n" << "working_set_mb=" << juce::String ((double) lynx::toolbar::PerformanceMeter::processMemoryBytes() / 1048576.0, 0) << "\n" << "cpu_total_s=" << juce::String (cpu, 3) << "\n" << "result=" << result << "\n"; report.replaceWithText (text); app.setApplicationReturnValue (result == "OK" ? 0 : 1); app.quit(); } void timerCallback() override { const auto now = startupTrace.seconds(); const auto cpu = lynx::processCpuSeconds(); if (phase == 0) { if (loaded()) { loadedS = now; cpuAtLoaded = cpu; phase = 1; lastCpu = cpu; lastT = now; } else if (now - revealedS > 240.0) finish ("TIMEOUT loading"); return; } if (phase == 1) { // quiet = under 10 % of one core for 1.5 s (the harness's rule), at most 30 s after loading const auto use = now > lastT ? 100.0 * (cpu - lastCpu) / (now - lastT) : 0.0; lastCpu = cpu; lastT = now; if (use < 10.0) { if (quietSince < 0.0) quietSince = now - 0.25; if (now - quietSince >= 1.5) settledS = quietSince; } else quietSince = -1.0; if (settledS >= 0.0 || now - loadedS > 30.0) { phase = 2; idleCpu0 = cpu; idleT0 = now; } return; } if (now - idleT0 >= (double) idleSeconds) finish ("OK"); } }; perf = std::make_unique (*this, openTimeReport, fileToOpen, openTimeIdleSeconds); } // round 166b: the update check of a normal start (never in --opentime and the other command-line modes), a few // seconds after the window is up so it never competes with the start-up; and the result of an update just installed void startUpdateCheck() { if (openTimeReport != juce::File()) return; lynx::updater::afterStart(); juce::Timer::callAfterDelay (3000, [] { lynx::updater::startAutomaticCheck(); }); } void openStartupFile() { startupFileHandled = true; if (fileToOpen != juce::File() && mainWindow != nullptr) { if (std::exchange (startWithoutPlugins, false)) // --no-plugins (round 190ap) mainWindow->getContent().openNextWithoutPlugins (true); mainWindow->openFile (fileToOpen); mainWindow->getContent().openNextWithoutPlugins (false); // (a file that did not open leaves nothing behind) } else if (mainWindow != nullptr && openTimeReport == juce::File()) mainWindow->getContent().openStartupProject(); // issue #123 (FL's Startup project) } void shutdown() override { parityShow.reset(); // (LYNX_PARITYSHOT_SHOW's window, before the engine it shows) if (relaunched || updateHelper) return; // the copy that ran owns the session (its crash notes stay for the next start) lynx::crashguard::note ("closing"); lynx::shutdownPluginSandboxWorker(); splash = nullptr; lynx::shutdownStemExtraction(); // (a separation in flight stops before its window and the engine go) lynx::shutdownAudioToMidi(); // (the same for a conversion to MIDI) if (mainWindow != nullptr && mainWindow->isVisible()) mainWindow->saveState(); lynx::remoteui::shutdown(); lynx::closeModalWindows(); // (round 190rf: a call-out box or dialog still open goes before the UI and the engine) remoteControl = nullptr; // cancels queued control work before its engine and UI go mainWindow = nullptr; // the UI goes before the engine graphicsDeviceJob = {}; // (round 190hd: the graphics device's holder, after every window) lynx::updater::shutdown(); // (a check or download in flight stops) crashEngine = nullptr; engine = nullptr; // separate-process plugins end on threads of their own (issue #159): a moment for them, never the 10 s a dead // child's pipe can take lynx::finishSandboxTeardowns (2000); // CLAP plugins whose instance another thread deleted while this one was busy: deactivated and destroyed now lynx::ClapPluginFormat::finishPendingTeardowns(); juce::LookAndFeel::setDefaultLookAndFeel (nullptr); heartbeat.stopTimer(); lynx::crashreporter::shutdown(); // (an upload in flight gets a moment, never long) lynx::crashguard::stopHangWatch(); lynx::crashguard::stopMainProfiler(); lynx::crashguard::endSession(); // a clean exit: no breadcrumb left behind // everything is saved and closed: a process that loaded third-party plugins ends here, before the DLLs' own // teardown runs (some crash in it at exit, round 111) if (sandboxChild || lynx::PluginHost::pluginsWereLoaded()) lynx::crashguard::exitNow (getApplicationReturnValue()); } void systemRequestedQuit() override { if (mainWindow != nullptr) mainWindow->confirmDiscard ([] { juce::JUCEApplication::quit(); }); else quit(); } private: // round 157a: a frozen UI (Windows' "not responding") writes the message thread's stack to autosave\hang