From 380215a08c9a16fa763ccacea1510dcbc15946d4 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 28 Feb 2015 15:51:06 +0100 Subject: API to delete AU cache & blacklist --- libs/ardour/plugin_manager.cc | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'libs/ardour/plugin_manager.cc') diff --git a/libs/ardour/plugin_manager.cc b/libs/ardour/plugin_manager.cc index 01853ccdb3..2fc84d3679 100644 --- a/libs/ardour/plugin_manager.cc +++ b/libs/ardour/plugin_manager.cc @@ -49,6 +49,8 @@ #include #include #include +#include +#include #include "pbd/whitespace.h" #include "pbd/file_utils.h" @@ -341,6 +343,29 @@ PluginManager::clear_vst_blacklist () #endif } +void +PluginManager::clear_au_cache () +{ +#ifdef AUDIOUNIT_SUPPORT + // AUPluginInfo::au_cache_path () + string fn = Glib::build_filename (ARDOUR::user_config_directory(), "au_cache"); + if (Glib::file_test (fn, Glib::FILE_TEST_EXISTS)) { + ::g_unlink(fn.c_str()); + } +#endif +} + +void +PluginManager::clear_au_blacklist () +{ +#ifdef AUDIOUNIT_SUPPORT + string fn = Glib::build_filename (ARDOUR::user_cache_directory(), "au_blacklist.txt"); + if (Glib::file_test (fn, Glib::FILE_TEST_EXISTS)) { + ::g_unlink(fn.c_str()); + } +#endif +} + void PluginManager::ladspa_refresh () { @@ -623,6 +648,19 @@ PluginManager::au_refresh (bool cache_only) Config->set_discover_audio_units (false); Config->save_state(); + /* note: AU require a CAComponentDescription pointer provided by the OS. + * Ardour only caches port and i/o config. It can't just 'scan' without + * 'discovering' (like we do for VST). + * + * So in case discovery fails, we assume the worst: the Description + * is broken (malicious plugins) and even a simple 'scan' would always + * crash ardour on startup. Hence we disable Auto-Scan on start. + * + * If the crash happens at any later time (description is available), + * Ardour will blacklist the plugin in question -- unless + * the crash happens during realtime-run. + */ + _au_plugin_info = AUPluginInfo::discover(); // successful scan re-enabled automatic discovery -- cgit v1.2.3