comparison src/vamp-hostsdk/PluginLoader.cpp @ 426:5502a06537f6 vampipe

Add listPluginData
author Chris Cannam
date Thu, 12 May 2016 15:53:55 +0100
parents 6b2567f365b0
children 2819b5c9a395
comparison
equal deleted inserted replaced
425:6b2567f365b0 426:5502a06537f6
59 public: 59 public:
60 Impl(); 60 Impl();
61 virtual ~Impl(); 61 virtual ~Impl();
62 62
63 PluginKeyList listPlugins(); 63 PluginKeyList listPlugins();
64 PluginStaticDataList listPluginData();
64 65
65 Plugin *loadPlugin(PluginKey key, 66 Plugin *loadPlugin(PluginKey key,
66 float inputSampleRate, 67 float inputSampleRate,
67 int adapterFlags); 68 int adapterFlags);
68 69
140 Impl::setInstanceToClean(m_instance); 141 Impl::setInstanceToClean(m_instance);
141 } 142 }
142 return m_instance; 143 return m_instance;
143 } 144 }
144 145
145 vector<PluginLoader::PluginKey> 146 PluginLoader::PluginKeyList
146 PluginLoader::listPlugins() 147 PluginLoader::listPlugins()
147 { 148 {
148 return m_impl->listPlugins(); 149 return m_impl->listPlugins();
150 }
151
152 PluginLoader::PluginStaticDataList
153 PluginLoader::listPluginData()
154 {
155 return m_impl->listPluginData();
149 } 156 }
150 157
151 Plugin * 158 Plugin *
152 PluginLoader::loadPlugin(PluginKey key, 159 PluginLoader::loadPlugin(PluginKey key,
153 float inputSampleRate, 160 float inputSampleRate,
199 PluginLoader::Impl::setInstanceToClean(PluginLoader *instance) 206 PluginLoader::Impl::setInstanceToClean(PluginLoader *instance)
200 { 207 {
201 m_cleaner.setInstance(instance); 208 m_cleaner.setInstance(instance);
202 } 209 }
203 210
204 vector<PluginLoader::PluginKey> 211 PluginLoader::PluginKeyList
205 PluginLoader::Impl::listPlugins() 212 PluginLoader::Impl::listPlugins()
206 { 213 {
207 if (!m_allPluginsEnumerated) enumeratePlugins(); 214 if (!m_allPluginsEnumerated) enumeratePlugins();
208 215
209 vector<PluginKey> plugins; 216 vector<PluginKey> plugins;
211 mi != m_pluginLibraryNameMap.end(); ++mi) { 218 mi != m_pluginLibraryNameMap.end(); ++mi) {
212 plugins.push_back(mi->first); 219 plugins.push_back(mi->first);
213 } 220 }
214 221
215 return plugins; 222 return plugins;
223 }
224
225 PluginLoader::PluginStaticDataList
226 PluginLoader::Impl::listPluginData()
227 {
228 PluginKeyList keys = listPlugins();
229 PluginStaticDataList dataList;
230
231 for (PluginKeyList::const_iterator ki = keys.begin(); ki != keys.end(); ++ki) {
232 string key = *ki;
233 Plugin *p = loadPlugin(key, 44100, 0);
234 if (p) {
235 string library = getLibraryPathForPlugin(key);
236 PluginCategoryHierarchy category = getPluginCategory(key);
237 dataList.push_back(PluginStaticData::fromPlugin(key, category, p));
238 }
239 delete p;
240 }
241
242 return dataList;
216 } 243 }
217 244
218 void 245 void
219 PluginLoader::Impl::enumeratePlugins(PluginKey forPlugin) 246 PluginLoader::Impl::enumeratePlugins(PluginKey forPlugin)
220 { 247 {