diff options
-rw-r--r-- | gtk2_ardour/plugin_selector.cc | 134 | ||||
-rw-r--r-- | gtk2_ardour/plugin_selector.h | 11 | ||||
-rw-r--r-- | gtk2_ardour/redirect_box.cc | 9 | ||||
-rw-r--r-- | gtk2_ardour/redirect_box.h | 1 | ||||
-rw-r--r-- | libs/ardour/SConscript | 4 | ||||
-rw-r--r-- | libs/ardour/ardour/plugin_manager.h | 25 | ||||
-rw-r--r-- | libs/ardour/plugin_manager.cc | 113 | ||||
-rw-r--r-- | libs/ardour/route.cc | 1 | ||||
-rw-r--r-- | libs/ardour/session.cc | 2 | ||||
-rw-r--r-- | libs/libsndfile/SConscript | 2 | ||||
-rw-r--r-- | libs/midi++2/SConscript | 2 | ||||
-rw-r--r-- | libs/pbd/SConscript | 2 | ||||
-rw-r--r-- | libs/sigc++2/SConscript | 2 |
13 files changed, 296 insertions, 12 deletions
diff --git a/gtk2_ardour/plugin_selector.cc b/gtk2_ardour/plugin_selector.cc index c7d456cc4d..41bcd18af1 100644 --- a/gtk2_ardour/plugin_selector.cc +++ b/gtk2_ardour/plugin_selector.cc @@ -19,6 +19,7 @@ #include <cstdio> #include <lrdf.h> +#include <map> #include <algorithm> @@ -64,9 +65,15 @@ PluginSelector::PluginSelector (PluginManager *mgr) manager = mgr; session = 0; - + _menu = 0; + in_row_change = false; + plugin_model = Gtk::ListStore::create (plugin_columns); plugin_display.set_model (plugin_model); + /* XXX translators: try to convert "Fav" into a short term + related to "favorite" + */ + plugin_display.append_column (_("Fav"), plugin_columns.favorite); plugin_display.append_column (_("Available Plugins"), plugin_columns.name); plugin_display.append_column (_("Type"), plugin_columns.type_name); plugin_display.append_column (_("Category"), plugin_columns.category); @@ -76,6 +83,13 @@ PluginSelector::PluginSelector (PluginManager *mgr) plugin_display.set_headers_visible (true); plugin_display.set_headers_clickable (true); plugin_display.set_reorderable (false); + plugin_display.set_rules_hint (true); + + CellRendererToggle* fav_cell = dynamic_cast<CellRendererToggle*>(plugin_display.get_column_cell_renderer (0)); + fav_cell->property_activatable() = true; + fav_cell->property_radio() = false; + fav_cell->signal_toggled().connect (mem_fun (*this, &PluginSelector::favorite_changed)); + scroller.set_border_width(10); scroller.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); scroller.add(plugin_display); @@ -222,6 +236,8 @@ PluginSelector::refill () { std::string filterstr; + in_row_change = true; + plugin_model->clear (); setup_filter_string (filterstr); @@ -230,6 +246,8 @@ PluginSelector::refill () lv2_refiller (filterstr); vst_refiller (filterstr); au_refiller (filterstr); + + in_row_change = false; } void @@ -242,11 +260,11 @@ PluginSelector::refiller (const PluginInfoList& plugs, const::std::string& filte if (show_this_plugin (*i, filterstr)) { TreeModel::Row newrow = *(plugin_model->append()); + newrow[plugin_columns.favorite] = manager->is_a_favorite_plugin (*i); newrow[plugin_columns.name] = (*i)->name; newrow[plugin_columns.type_name] = type; newrow[plugin_columns.category] = (*i)->category; - string creator = (*i)->creator; string::size_type pos = 0; @@ -433,3 +451,115 @@ PluginSelector::on_show () ArdourDialog::on_show (); filter_entry.grab_focus (); } + +Gtk::Menu& +PluginSelector::plugin_menu() +{ + using namespace Menu_Helpers; + + typedef std::map<Glib::ustring,Gtk::Menu*> SubmenuMap; + SubmenuMap submenu_map; + + if (!_menu) { + _menu = new Menu(); + } + + MenuList& items = _menu->items(); + Menu* favs = new Menu(); + + items.clear (); + items.push_back (MenuElem (_("Favorites"), *favs)); + items.push_back (MenuElem (_("Plugin Manager"), mem_fun (*this, &PluginSelector::show_manager))); + items.push_back (SeparatorElem ()); + + PluginInfoList all_plugs; + + all_plugs.insert (all_plugs.end(), manager->ladspa_plugin_info().begin(), manager->ladspa_plugin_info().end()); +#ifdef VST_SUPPORT + all_plugs.insert (all_plugs.end(), manager->vst_plugin_info().begin(), manager->vst_plugin_info().end()); +#endif +#ifdef HAVE_AUDIOUNITS + all_plugs.insert (all_plugs.end(), manager->au_plugin_info().begin(), manager->au_plugin_info().end()); +#endif +#ifdef HAVE_SLV2 + all_plugs.insert (all_plugs.end(), manager->lv2_plugin_info().begin(), manager->lv2_plugin_info().end()); +#endif + + for (PluginInfoList::const_iterator i = all_plugs.begin(); i != all_plugs.end(); ++i) { + SubmenuMap::iterator x; + Gtk::Menu* submenu; + + string creator = (*i)->creator; + string::size_type pos = 0; + + if (manager->is_a_favorite_plugin (*i)) { + favs->items().push_back (MenuElem ((*i)->name, (bind (mem_fun (*this, &PluginSelector::plugin_chosen_from_menu), *i)))); + } + + /* stupid LADSPA creator strings */ + + while (pos < creator.length() && (isalnum (creator[pos]) || isspace (creator[pos]))) ++pos; + creator = creator.substr (0, pos); + + if ((x = submenu_map.find (creator)) != submenu_map.end()) { + submenu = x->second; + } else { + submenu = new Gtk::Menu; + items.push_back (MenuElem (creator, *submenu)); + submenu_map.insert (pair<Glib::ustring,Menu*> (creator, submenu)); + } + + submenu->items().push_back (MenuElem ((*i)->name, (bind (mem_fun (*this, &PluginSelector::plugin_chosen_from_menu), *i)))); + } + + return *_menu; +} + +void +PluginSelector::plugin_chosen_from_menu (const PluginInfoPtr& pi) +{ + use_plugin (pi); +} + +void +PluginSelector::favorite_changed (const Glib::ustring& path) +{ + PluginInfoPtr pi; + + if (in_row_change) { + return; + } + + in_row_change = true; + + TreeModel::iterator iter = plugin_model->get_iter (path); + + if (iter) { + + bool favorite = !(*iter)[plugin_columns.favorite]; + + /* change state */ + + (*iter)[plugin_columns.favorite] = favorite; + + /* save new favorites list */ + + pi = (*iter)[plugin_columns.plugin]; + + if (favorite) { + manager->add_favorite (pi->type, pi->unique_id); + } else { + manager->remove_favorite (pi->type, pi->unique_id); + } + + manager->save_favorites (); + } + in_row_change = false; +} + +void +PluginSelector::show_manager () +{ + show_all(); + run (); +} diff --git a/gtk2_ardour/plugin_selector.h b/gtk2_ardour/plugin_selector.h index 70c9ba3c3e..77d8c462a6 100644 --- a/gtk2_ardour/plugin_selector.h +++ b/gtk2_ardour/plugin_selector.h @@ -43,6 +43,8 @@ class PluginSelector : public ArdourDialog void set_session (ARDOUR::Session*); void on_show (); + Gtk::Menu& plugin_menu (); + private: ARDOUR::Session* session; Gtk::ScrolledWindow scroller; // Available plugins @@ -58,6 +60,7 @@ class PluginSelector : public ArdourDialog struct PluginColumns : public Gtk::TreeModel::ColumnRecord { PluginColumns () { + add (favorite); add (name); add (type_name); add (category); @@ -66,6 +69,7 @@ class PluginSelector : public ArdourDialog add (outs); add (plugin); } + Gtk::TreeModelColumn<bool> favorite; Gtk::TreeModelColumn<std::string> name; Gtk::TreeModelColumn<std::string> type_name; Gtk::TreeModelColumn<std::string> category; @@ -112,6 +116,13 @@ class PluginSelector : public ArdourDialog void cleanup (); bool show_this_plugin (const ARDOUR::PluginInfoPtr&, const std::string&); void setup_filter_string (std::string&); + + void favorite_changed (const Glib::ustring& path); + bool in_row_change; + + void plugin_chosen_from_menu (const ARDOUR::PluginInfoPtr&); + Gtk::Menu* _menu; + void show_manager (); }; #endif // __ardour_plugin_selector_h__ diff --git a/gtk2_ardour/redirect_box.cc b/gtk2_ardour/redirect_box.cc index 050ffdef55..8e7e97a816 100644 --- a/gtk2_ardour/redirect_box.cc +++ b/gtk2_ardour/redirect_box.cc @@ -385,10 +385,9 @@ RedirectBox::deselect_all_redirects () void RedirectBox::choose_plugin () { - sigc::connection newplug_connection = _plugin_selector.PluginCreated.connect (mem_fun(*this,&RedirectBox::insert_plugin_chosen)); - _plugin_selector.show_all(); - _plugin_selector.run (); - newplug_connection.disconnect(); + newplug_connection = _plugin_selector.PluginCreated.connect (mem_fun(*this,&RedirectBox::insert_plugin_chosen)); + Gtk::Menu& m = _plugin_selector.plugin_menu(); + m.popup (1, 0); } void @@ -409,6 +408,8 @@ RedirectBox::insert_plugin_chosen (boost::shared_ptr<Plugin> plugin) redirect->active_changed.connect (bind (mem_fun (*this, &RedirectBox::show_redirect_active_r), boost::weak_ptr<Redirect>(redirect))); } } + + newplug_connection.disconnect(); } void diff --git a/gtk2_ardour/redirect_box.h b/gtk2_ardour/redirect_box.h index cb126dc13f..cc5b87d62a 100644 --- a/gtk2_ardour/redirect_box.h +++ b/gtk2_ardour/redirect_box.h @@ -145,6 +145,7 @@ class RedirectBox : public Gtk::HBox void choose_insert (); void choose_plugin (); void insert_plugin_chosen (boost::shared_ptr<ARDOUR::Plugin>); + sigc::connection newplug_connection; bool no_redirect_redisplay; bool ignore_delete; 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 <list> #include <map> #include <string> +#include <set> #include <ardour/types.h> #include <ardour/plugin.h> @@ -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<FavoritePlugin> 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 <cstdio> #include <lrdf.h> #include <dlfcn.h> +#include <cstdlib> +#include <fstream> #ifdef VST_SUPPORT #include <fst.h> @@ -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<FavoritePluginList::iterator,bool> 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) |