ardour
instrument_selector.cc
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003-2014 Paul Davis
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; if not, write to the Free Software
16  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18 
19 #include "ardour/plugin_manager.h"
20 
21 #include "instrument_selector.h"
22 
23 #include "i18n.h"
24 
25 using namespace Gtk;
26 using namespace ARDOUR;
27 
29  : _reasonable_synth_id(0)
30 {
32  set_model(_instrument_list);
33  pack_start(_instrument_list_columns.name);
34  set_active(_reasonable_synth_id);
35  set_button_sensitivity(Gtk::SENSITIVITY_AUTO);
36 }
37 
38 void
40 {
41  PluginManager& manager = PluginManager::instance();
42 
43  PluginInfoList all_plugs;
44  all_plugs.insert(all_plugs.end(), manager.ladspa_plugin_info().begin(), manager.ladspa_plugin_info().end());
45 #ifdef WINDOWS_VST_SUPPORT
46  all_plugs.insert(all_plugs.end(), manager.windows_vst_plugin_info().begin(), manager.windows_vst_plugin_info().end());
47 #endif
48 #ifdef LXVST_SUPPORT
49  all_plugs.insert(all_plugs.end(), manager.lxvst_plugin_info().begin(), manager.lxvst_plugin_info().end());
50 #endif
51 #ifdef AUDIOUNIT_SUPPORT
52  all_plugs.insert(all_plugs.end(), manager.au_plugin_info().begin(), manager.au_plugin_info().end());
53 #endif
54 #ifdef LV2_SUPPORT
55  all_plugs.insert(all_plugs.end(), manager.lv2_plugin_info().begin(), manager.lv2_plugin_info().end());
56 #endif
57 
58  _instrument_list = ListStore::create(_instrument_list_columns);
59 
60  TreeModel::Row row = *(_instrument_list->append());
62  row[_instrument_list_columns.name] = _("-none-");
63 
64  uint32_t n = 1;
65  for (PluginInfoList::const_iterator i = all_plugs.begin(); i != all_plugs.end(); ++i) {
66  if (manager.get_status(*i) == PluginManager::Hidden) {
67  continue;
68  }
69 
70  if ((*i)->is_instrument()) {
71  row = *(_instrument_list->append());
72  row[_instrument_list_columns.name] = (*i)->name;
74  if ((*i)->unique_id == "https://community.ardour.org/node/7596") {
76  }
77  n++;
78  }
79  }
80 }
81 
84 {
85  TreeModel::iterator iter = get_active();
86  if (!iter) {
87  return PluginInfoPtr();
88  }
89 
90  const TreeModel::Row& row = (*iter);
92 }
Definition: ardour_ui.h:130
ARDOUR::PluginInfoList & windows_vst_plugin_info()
ARDOUR::PluginInfoList & lv2_plugin_info()
#define _(Text)
Definition: i18n.h:11
Glib::RefPtr< Gtk::ListStore > _instrument_list
ARDOUR::PluginInfoList & ladspa_plugin_info()
Definition: amp.h:29
ARDOUR::PluginInfoPtr selected_instrument()
ARDOUR::PluginInfoList & au_plugin_info()
InstrumentListColumns _instrument_list_columns
ARDOUR::PluginInfoList & lxvst_plugin_info()
Gtk::TreeModelColumn< ARDOUR::PluginInfoPtr > info_ptr
std::list< PluginInfoPtr > PluginInfoList
Definition: plugin.h:90
boost::shared_ptr< PluginInfo > PluginInfoPtr
Definition: plugin.h:89
Gtk::TreeModelColumn< std::string > name
PluginStatusType get_status(const PluginInfoPtr &)