From 1e59c4a2205d35a0bff50cce1ffa028fa32e5bdf Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 24 Apr 2008 17:59:08 +0000 Subject: plugin selection via menu, along with "favorites" git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3284 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/SConscript | 4 +- libs/ardour/ardour/plugin_manager.h | 25 ++++++++ libs/ardour/plugin_manager.cc | 113 ++++++++++++++++++++++++++++++++++++ libs/ardour/route.cc | 1 + libs/ardour/session.cc | 2 + libs/libsndfile/SConscript | 2 +- libs/midi++2/SConscript | 2 +- libs/pbd/SConscript | 2 +- libs/sigc++2/SConscript | 2 +- 9 files changed, 147 insertions(+), 6 deletions(-) (limited to 'libs') diff --git a/libs/ardour/SConscript b/libs/ardour/SConscript index dce3432065..d671387e66 100644 --- a/libs/ardour/SConscript +++ b/libs/ardour/SConscript @@ -6,7 +6,7 @@ import glob Import('env final_prefix install_prefix final_config_prefix libraries i18n') -ardour = env.Copy() +ardour = env.Clone() # # this defines the version number of libardour @@ -317,7 +317,7 @@ env['BUILDERS']['SharedAsmObject'] = Builder (action = '$CXX -c -fPIC $SOURCE -o always_sse_objects = [] -sse_env = ardour.Copy() +sse_env = ardour.Clone() sse_env.Append (CXXFLAGS="-msse") if env['FPU_OPTIMIZATION']: diff --git a/libs/ardour/ardour/plugin_manager.h b/libs/ardour/ardour/plugin_manager.h index 892c8bd75a..858decd0e5 100644 --- a/libs/ardour/ardour/plugin_manager.h +++ b/libs/ardour/ardour/plugin_manager.h @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -54,7 +55,31 @@ class PluginManager { static PluginManager* the_manager() { return _manager; } + void load_favorites (); + void save_favorites (); + void add_favorite (ARDOUR::PluginType type, std::string unique_id); + void remove_favorite (ARDOUR::PluginType type, std::string unique_id); + bool is_a_favorite_plugin (const PluginInfoPtr&); + private: + struct FavoritePlugin { + ARDOUR::PluginType type; + std::string unique_id; + + FavoritePlugin (ARDOUR::PluginType t, std::string id) + : type (t), unique_id (id) {} + + bool operator==(const FavoritePlugin& other) const { + return other.type == type && other.unique_id == unique_id; + } + + bool operator<(const FavoritePlugin& other) const { + return other.type < type || other.unique_id < unique_id; + } + }; + typedef std::set FavoritePluginList; + FavoritePluginList favorites; + ARDOUR::PluginInfoList _vst_plugin_info; ARDOUR::PluginInfoList _ladspa_plugin_info; ARDOUR::PluginInfoList _lv2_plugin_info; diff --git a/libs/ardour/plugin_manager.cc b/libs/ardour/plugin_manager.cc index 336763faa1..2157774cac 100644 --- a/libs/ardour/plugin_manager.cc +++ b/libs/ardour/plugin_manager.cc @@ -21,6 +21,8 @@ #include #include #include +#include +#include #ifdef VST_SUPPORT #include @@ -56,6 +58,7 @@ using namespace ARDOUR; using namespace PBD; +using namespace std; PluginManager* PluginManager::_manager = 0; @@ -64,6 +67,8 @@ PluginManager::PluginManager () char* s; string lrdf_path; + load_favorites (); + if ((s = getenv ("LADSPA_RDF_PATH"))){ lrdf_path = s; } @@ -484,3 +489,111 @@ PluginManager::vst_discover (string path) } #endif // VST_SUPPORT + +bool +PluginManager::is_a_favorite_plugin (const PluginInfoPtr& pi) +{ + FavoritePlugin fp (pi->type, pi->unique_id); + return find (favorites.begin(), favorites.end(), fp) != favorites.end(); +} + +void +PluginManager::save_favorites () +{ + Glib::ustring path = get_user_ardour_path (); + path += '/'; + path += "favorite_plugins"; + + ofstream ofs; + + ofs.open (path.c_str(), ios_base::openmode (ios::out|ios::trunc)); + + if (!ofs) { + return; + } + + for (FavoritePluginList::iterator i = favorites.begin(); i != favorites.end(); ++i) { + switch ((*i).type) { + case LADSPA: + ofs << "LADSPA"; + break; + case AudioUnit: + ofs << "AudioUnit"; + break; + case LV2: + ofs << "LV2"; + break; + case VST: + ofs << "VST"; + break; + } + + ofs << ' ' << (*i).unique_id << endl; + } + + ofs.close (); +} + +void +PluginManager::load_favorites () +{ + Glib::ustring path = get_user_ardour_path (); + path += '/'; + path += "favorite_plugins"; + + ifstream ifs (path.c_str()); + + if (!ifs) { + return; + } + + std::string stype; + std::string id; + PluginType type; + + while (ifs) { + + ifs >> stype; + if (!ifs) { + break; + + } + ifs >> id; + if (!ifs) { + break; + } + + if (stype == "LADSPA") { + type = LADSPA; + } else if (stype == "AudioUnit") { + type = AudioUnit; + } else if (stype == "LV2") { + type = LV2; + } else if (stype == "VST") { + type = VST; + } else { + error << string_compose (_("unknown favorite plugin type \"%1\" - ignored"), stype) + << endmsg; + continue; + } + + add_favorite (type, id); + } + + ifs.close (); +} + +void +PluginManager::add_favorite (PluginType t, string id) +{ + FavoritePlugin fp (t, id); + pair res = favorites.insert (fp); + cerr << "Added " << t << " " << id << " success ? " << res.second << endl; +} + +void +PluginManager::remove_favorite (PluginType t, string id) +{ + FavoritePlugin fp (t, id); + favorites.erase (fp); +} diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index dcf78b5e2e..8daeed2eeb 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -2419,6 +2419,7 @@ Route::update_total_latency () } } +#define DEBUG_LATENCY #ifdef DEBUG_LATENCY cerr << _name << ": internal redirect latency = " << _own_latency << endl; #endif diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 5b8d2f8506..a97a613ea4 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -284,6 +284,7 @@ Session::Session (AudioEngine &eng, diskstreams (new DiskstreamList), routes (new RouteList), auditioner ((Auditioner*) 0), + _total_free_4k_blocks (0), _click_io ((IO*) 0), main_outs (0) { @@ -346,6 +347,7 @@ Session::Session (AudioEngine &eng, midi_requests (16), diskstreams (new DiskstreamList), routes (new RouteList), + _total_free_4k_blocks (0), main_outs (0) { diff --git a/libs/libsndfile/SConscript b/libs/libsndfile/SConscript index 150b820f55..6f0651007e 100644 --- a/libs/libsndfile/SConscript +++ b/libs/libsndfile/SConscript @@ -7,7 +7,7 @@ import glob sndfile_files = glob.glob('src/*.c') + glob.glob('src/GSM610/*.c') + glob.glob('src/G72x/*.c') Import('env install_prefix libraries use_flac') -sndfile = env.Copy() +sndfile = env.Clone() sndfile.Merge([libraries['flac'] ]) domain = 'libsndfile' diff --git a/libs/midi++2/SConscript b/libs/midi++2/SConscript index ce7db6c263..21356da53b 100644 --- a/libs/midi++2/SConscript +++ b/libs/midi++2/SConscript @@ -6,7 +6,7 @@ import glob Import('env libraries install_prefix') -midi2 = env.Copy() +midi2 = env.Clone() midi2.Merge([ libraries['sigc2'], libraries['xml'], libraries['glibmm2'], libraries['glib2'], libraries['pbd'] ]) if midi2['IS_OSX']: diff --git a/libs/pbd/SConscript b/libs/pbd/SConscript index a0065f09bd..f51ddd5a36 100644 --- a/libs/pbd/SConscript +++ b/libs/pbd/SConscript @@ -6,7 +6,7 @@ import glob Import('env libraries i18n install_prefix') -pbd = env.Copy() +pbd = env.Clone() domain = 'libpbd' diff --git a/libs/sigc++2/SConscript b/libs/sigc++2/SConscript index b29aefb0cd..9ac1ef48ee 100644 --- a/libs/sigc++2/SConscript +++ b/libs/sigc++2/SConscript @@ -7,7 +7,7 @@ import glob sigc2_files = glob.glob('sigc++/*.cc') + glob.glob('sigc++/functors/*.cc') + glob.glob('sigc++/adaptors/lambda/*.cc') Import('env install_prefix') -sigc2 = env.Copy() +sigc2 = env.Clone() libsigc2 = sigc2.SharedLibrary('sigc++2', sigc2_files) -- cgit v1.2.3