diff --git a/libs/ardour/ardour/plugin_manager.h b/libs/ardour/ardour/plugin_manager.h index 6239bd7cb0..31ab833508 100644 --- a/libs/ardour/ardour/plugin_manager.h +++ b/libs/ardour/ardour/plugin_manager.h @@ -127,7 +127,7 @@ class LIBARDOUR_API PluginManager : public boost::noncopyable { void add_lxvst_presets (); void add_presets (std::string domain); - void au_refresh (); + void au_refresh (bool cache_only = false); void lv2_refresh (); diff --git a/libs/ardour/ardour/rc_configuration_vars.h b/libs/ardour/ardour/rc_configuration_vars.h index 20c3857537..2ae2b562eb 100644 --- a/libs/ardour/ardour/rc_configuration_vars.h +++ b/libs/ardour/ardour/rc_configuration_vars.h @@ -211,6 +211,7 @@ CONFIG_VARIABLE (bool, use_lxvst, "use-lxvst", true) CONFIG_VARIABLE (bool, show_plugin_scan_window, "show-plugin-scan-window", false) CONFIG_VARIABLE (bool, discover_vst_on_start, "discover-vst-on-start", false) CONFIG_VARIABLE (int, vst_scan_timeout, "vst-scan-timeout", 600) /* deciseconds, per plugin, <= 0 no timeout */ +CONFIG_VARIABLE (bool, discover_audio_units, "discover-audio-units", false) /* custom user plugin paths */ CONFIG_VARIABLE (std::string, plugin_path_vst, "plugin-path-vst", "@default@") diff --git a/libs/ardour/plugin_manager.cc b/libs/ardour/plugin_manager.cc index 1791e2f10d..344b2ef9b6 100644 --- a/libs/ardour/plugin_manager.cc +++ b/libs/ardour/plugin_manager.cc @@ -243,7 +243,7 @@ PluginManager::refresh (bool cache_only) #ifdef AUDIOUNIT_SUPPORT BootMessage (_("Scanning AU Plugins")); - au_refresh (); + au_refresh (cache_only); #endif BootMessage (_("Plugin Scan Complete...")); @@ -604,11 +604,23 @@ PluginManager::lv2_refresh () #ifdef AUDIOUNIT_SUPPORT void -PluginManager::au_refresh () +PluginManager::au_refresh (bool cache_only) { DEBUG_TRACE (DEBUG::PluginManager, "AU: refresh\n"); + if (cache_only && !Config->get_discover_audio_units ()) { + return; + } delete _au_plugin_info; + + // disable automatic scan in case we crash + Config->set_discover_audio_units (false); + Config->save_state(); + _au_plugin_info = AUPluginInfo::discover(); + + // successful scan re-enabled automatic discovery + Config->set_discover_audio_units (true); + Config->save_state(); } #endif @@ -1050,9 +1062,9 @@ ARDOUR::PluginInfoList& PluginManager::au_plugin_info () { #ifdef AUDIOUNIT_SUPPORT - assert(_au_plugin_info); - return *_au_plugin_info; -#else - return _empty_plugin_info; + if (_au_plugin_info) { + return *_au_plugin_info; + } #endif + return _empty_plugin_info; }