2 * Copyright (C) 2005-2006 Taybin Rutkin <taybin@taybin.com>
3 * Copyright (C) 2006-2007 Sampo Savolainen <v2@iki.fi>
4 * Copyright (C) 2006-2019 Paul Davis <paul@linuxaudiosystems.com>
5 * Copyright (C) 2008-2011 David Robillard <d@drobilla.net>
6 * Copyright (C) 2009-2012 Carl Hetherington <carl@carlh.net>
7 * Copyright (C) 2012-2019 Robin Gareus <robin@gareus.org>
8 * Copyright (C) 2015-2017 Len Ovens <len@ovenwerks.net>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
30 #include "ardour/debug.h"
31 #include "ardour/session.h"
33 #ifndef NDEBUG // "-H"
34 #include "processor_box.h"
43 string ARDOUR_COMMAND_LINE::session_name = "";
44 string ARDOUR_COMMAND_LINE::backend_client_name = "ardour";
45 bool ARDOUR_COMMAND_LINE::show_key_actions = false;
46 bool ARDOUR_COMMAND_LINE::show_actions = false;
47 bool ARDOUR_COMMAND_LINE::no_splash = false;
48 bool ARDOUR_COMMAND_LINE::just_version = false;
49 bool ARDOUR_COMMAND_LINE::use_vst = true;
50 bool ARDOUR_COMMAND_LINE::new_session = false;
51 bool ARDOUR_COMMAND_LINE::try_hw_optimization = true;
52 bool ARDOUR_COMMAND_LINE::no_connect_ports = false;
53 string ARDOUR_COMMAND_LINE::keybindings_path = ""; /* empty means use builtin default */
54 std::string ARDOUR_COMMAND_LINE::menus_file = "ardour.menus";
55 bool ARDOUR_COMMAND_LINE::finder_invoked_ardour = false;
56 string ARDOUR_COMMAND_LINE::load_template;
57 bool ARDOUR_COMMAND_LINE::check_announcements = true;
59 using namespace ARDOUR_COMMAND_LINE;
62 print_help (const char *execname)
64 // help2man format, http://docopt.org/
65 // https://www.gnu.org/prep/standards/standards.html#g_t_002d_002dhelp
67 << _("Usage: ") << PROGRAM_NAME << _(" [ OPTIONS ] [ SESSION-NAME ]")
69 << _("Ardour is a multichannel hard disk recorder (HDR) and digital audio workstation (DAW).")
72 << _(" -a, --no-announcements Do not contact website for announcements\n")
73 << _(" -A, --actions Print all possible menu action names\n")
74 << _(" -b, --bindings Display all current key bindings\n")
75 << _(" -B, --bypass-plugins Bypass all plugins in an existing session\n")
76 << _(" -c, --name <name> Use a specific backend client name, default is ardour\n")
77 << _(" -d, --disable-plugins Disable all plugins (safe mode)\n")
79 << _(" -D, --debug <options> Set debug flags. Use \"-D list\" to see available options\n")
81 << _(" -h, --help Print this message\n")
82 << _(" -k, --keybindings <file> Name of key bindings to load\n")
83 << _(" -m, --menus file Use \"file\" to define menus\n")
84 << _(" -n, --no-splash Do not show splash screen\n")
85 << _(" -N, --new session-name Create a new session from the command line\n")
86 << _(" -O, --no-hw-optimizations Disable h/w specific optimizations\n")
87 << _(" -P, --no-connect-ports Do not connect any ports at startup\n")
88 << _(" -S, --sync Draw the GUI synchronously\n")
89 << _(" -T, --template <name> Use given template for new session\n")
90 << _(" -v, --version Print version and exit\n")
91 #ifdef WINDOWS_VST_SUPPORT
92 << _(" -V, --novst Disable WindowsVST support\n")
95 << _("Report bugs to http://tracker.ardour.org\n")
96 << _("Website http://ardour.org\n")
103 ARDOUR_COMMAND_LINE::parse_opts (int argc, char *argv[])
105 const char *optstring = "aAbBc:C:dD:hHk:E:m:N:nOp:PST:U:vV";
106 const char *execname = strrchr (argv[0], '/');
114 const struct option longopts[] = {
115 { "version", 0, 0, 'v' },
116 { "help", 0, 0, 'h' },
117 { "no-announcements", 0, 0, 'a' },
118 { "actions", 0, 0, 'A' },
119 { "bindings", 0, 0, 'b' },
120 { "bypass-plugins", 0, 0, 'B' },
121 { "disable-plugins", 0, 0, 'd' },
122 { "debug", 1, 0, 'D' },
123 { "no-splash", 0, 0, 'n' },
124 { "menus", 1, 0, 'm' },
125 { "name", 1, 0, 'c' },
126 { "novst", 0, 0, 'V' },
127 { "new", 1, 0, 'N' },
128 { "no-hw-optimizations", 0, 0, 'O' },
129 { "sync", 0, 0, 'S' },
130 { "template", 1, 0, 'T' },
131 { "no-connect-ports", 0, 0, 'P' },
135 int option_index = 0;
139 c = getopt_long (argc, argv, optstring, longopts, &option_index);
154 print_help (execname);
159 ProcessorBox::show_all_processors = true;
163 check_announcements = false;
171 show_key_actions = true;
175 ARDOUR::Session::set_bypass_all_loaded_plugins (true);
179 ARDOUR::Session::set_disable_all_loaded_plugins (true);
183 if (PBD::parse_debug_options (optarg)) {
197 //undocumented OS X finder -psn_XXXXX argument
198 finder_invoked_ardour = true;
202 // ; just pass this through to gtk it will figure it out
205 load_template = optarg;
210 session_name = optarg;
214 try_hw_optimization = false;
218 no_connect_ports = true;
222 #ifdef WINDOWS_VST_SUPPORT
224 #endif /* WINDOWS_VST_SUPPORT */
228 backend_client_name = optarg;
232 keybindings_path = optarg;
236 return print_help(execname);
242 cerr << "Illogical combination: you can either create a new session, or a load an existing session but not both!" << endl;
243 return print_help(execname);
245 session_name = argv[optind++];