MCPcopy Create free account
hub / github.com/BespokeSynth/BespokeSynth / initialise

Function initialise

Source/Main.cpp:41–104  ·  view source on GitHub ↗

==============================================================================

Source from the content-addressed store, hash-verified

39
40 //==============================================================================
41 void initialise(const String& commandLine) override
42 {
43 // Parse command line arguments that should cause us to exit
44 auto cliArgv = JUCEApplication::getCommandLineParameterArray();
45 for (int i = 0; i < cliArgv.size(); ++i)
46 {
47 bool should_exit = false;
48 juce::String argument = cliArgv[i];
49 if (argument == "-h" || argument == "--help")
50 {
51 std::cout << "A modular DAW for Mac, Windows, and Linux.\n"
52 << "\n"
53 << "Usage: BespokeSynth [OPTIONS] [path].json [path].bsk(t)\n"
54 << "\n"
55 << "Arguments:\n"
56 << " [path].bsk(t) the project file to open (must end in .bsk or .bskt)\n"
57 << " [path].json path to userprefs.json (must end in .json)\n"
58 << "\n"
59 << "Options:\n"
60 << " -o, --option <option> <value> Temporarily override settings in preferences file\n"
61 << " -h, --help Print help\n"
62 << " -v, --version Print version\n"
63 << std::flush;
64 should_exit = true;
65 }
66 else if (argument == "-v" || argument == "--version")
67 {
68 std::cout << "bespoke synth " << GetBuildInfoString() << std::endl;
69 should_exit = true;
70 }
71 else if (argument == "-o" || argument == "--option")
72 {
73 if ((cliArgv[i + 1].isEmpty()) || (cliArgv[i + 2].isEmpty()))
74 {
75 CliErrorExpectedOpt(argument);
76 should_exit = true;
77 }
78 }
79
80 if (should_exit == true)
81 {
82 JUCEApplicationBase::quit();
83 return;
84 }
85 }
86
87 auto scannerSubprocess = std::make_unique<PluginScannerSubprocess>();
88
89 if (scannerSubprocess->initialiseFromCommandLine(commandLine, kScanProcessUID))
90 {
91 storedScannerSubprocess = std::move(scannerSubprocess);
92 return;
93 }
94
95 mainWindow = std::make_unique<MainWindow>("bespoke synth");
96
97 juce::PropertiesFile::Options options;
98 options.applicationName = "Bespoke Synth";

Callers

nothing calls this directly

Calls 3

GetBuildInfoStringFunction · 0.85
CliErrorExpectedOptFunction · 0.85
sizeMethod · 0.80

Tested by

no test coverage detected