alter ARDOUR::init() API to specify whether a GUI is in control or not

This commit is contained in:
Paul Davis 2019-10-20 22:39:09 -06:00
parent 3f2f517291
commit 58e8fb7aab
3 changed files with 8 additions and 3 deletions

View file

@ -383,7 +383,7 @@ int main (int argc, char *argv[])
<< endl; << endl;
} }
if (!ARDOUR::init (ARDOUR_COMMAND_LINE::use_vst, ARDOUR_COMMAND_LINE::try_hw_optimization, localedir.c_str())) { if (!ARDOUR::init (ARDOUR_COMMAND_LINE::use_vst, ARDOUR_COMMAND_LINE::try_hw_optimization, localedir.c_str(), true)) {
error << string_compose (_("could not initialize %1."), PROGRAM_NAME) << endmsg; error << string_compose (_("could not initialize %1."), PROGRAM_NAME) << endmsg;
Gtk::Main main (argc, argv); Gtk::Main main (argc, argv);
Gtk::MessageDialog msg (string_compose (_("Could not initialize %1 (likely due to corrupt config files).\n" Gtk::MessageDialog msg (string_compose (_("Could not initialize %1 (likely due to corrupt config files).\n"

View file

@ -62,10 +62,12 @@ namespace ARDOUR {
* @param try_optimization true to enable hardware optimized routines * @param try_optimization true to enable hardware optimized routines
* for mixing, finding peak values etc. * for mixing, finding peak values etc.
* @param localedir Directory to look for localisation files * @param localedir Directory to look for localisation files
* @param with_gui set to true if running from a GUI (expected to take
* care of certain initialization itself)
* *
* @return true if Ardour library was successfully initialized * @return true if Ardour library was successfully initialized
*/ */
LIBARDOUR_API bool init (bool with_vst, bool try_optimization, const char* localedir); LIBARDOUR_API bool init (bool with_vst, bool try_optimization, const char* localedir, bool with_gui = false);
LIBARDOUR_API void init_post_engine (uint32_t); LIBARDOUR_API void init_post_engine (uint32_t);
LIBARDOUR_API void cleanup (); LIBARDOUR_API void cleanup ();
LIBARDOUR_API bool no_auto_connect (); LIBARDOUR_API bool no_auto_connect ();

View file

@ -164,6 +164,7 @@ PBD::Signal3<bool,std::string,std::string,int> ARDOUR::CopyConfigurationFiles;
std::map<std::string, bool> ARDOUR::reserved_io_names; std::map<std::string, bool> ARDOUR::reserved_io_names;
static bool have_old_configuration_files = false; static bool have_old_configuration_files = false;
static bool running_from_gui = false;
namespace ARDOUR { namespace ARDOUR {
extern void setup_enum_writer (); extern void setup_enum_writer ();
@ -444,12 +445,14 @@ ARDOUR::handle_old_configuration_files (boost::function<bool (std::string const&
} }
bool bool
ARDOUR::init (bool use_windows_vst, bool try_optimization, const char* localedir) ARDOUR::init (bool use_windows_vst, bool try_optimization, const char* localedir, bool with_gui)
{ {
if (libardour_initialized) { if (libardour_initialized) {
return true; return true;
} }
running_from_gui = with_gui;
#ifndef NDEBUG #ifndef NDEBUG
if (getenv("ARDOUR_LUA_METATABLES")) { if (getenv("ARDOUR_LUA_METATABLES")) {
luabridge::Security::setHideMetatables (false); luabridge::Security::setHideMetatables (false);