diff 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
line wrap: on
line diff
--- a/src/vamp-hostsdk/PluginLoader.cpp	Thu May 12 14:43:10 2016 +0100
+++ b/src/vamp-hostsdk/PluginLoader.cpp	Thu May 12 15:53:55 2016 +0100
@@ -61,6 +61,7 @@
     virtual ~Impl();
 
     PluginKeyList listPlugins();
+    PluginStaticDataList listPluginData();
 
     Plugin *loadPlugin(PluginKey key,
                        float inputSampleRate,
@@ -142,12 +143,18 @@
     return m_instance;
 }
 
-vector<PluginLoader::PluginKey>
+PluginLoader::PluginKeyList
 PluginLoader::listPlugins() 
 {
     return m_impl->listPlugins();
 }
 
+PluginLoader::PluginStaticDataList
+PluginLoader::listPluginData() 
+{
+    return m_impl->listPluginData();
+}
+
 Plugin *
 PluginLoader::loadPlugin(PluginKey key,
                          float inputSampleRate,
@@ -201,7 +208,7 @@
     m_cleaner.setInstance(instance);
 }
 
-vector<PluginLoader::PluginKey>
+PluginLoader::PluginKeyList
 PluginLoader::Impl::listPlugins() 
 {
     if (!m_allPluginsEnumerated) enumeratePlugins();
@@ -215,6 +222,26 @@
     return plugins;
 }
 
+PluginLoader::PluginStaticDataList
+PluginLoader::Impl::listPluginData() 
+{
+    PluginKeyList keys = listPlugins();
+    PluginStaticDataList dataList;
+
+    for (PluginKeyList::const_iterator ki = keys.begin(); ki != keys.end(); ++ki) {
+        string key = *ki;
+	Plugin *p = loadPlugin(key, 44100, 0);
+	if (p) {
+            string library = getLibraryPathForPlugin(key);
+            PluginCategoryHierarchy category = getPluginCategory(key);
+	    dataList.push_back(PluginStaticData::fromPlugin(key, category, p));
+	}
+        delete p;
+    }
+
+    return dataList;
+}
+
 void
 PluginLoader::Impl::enumeratePlugins(PluginKey forPlugin)
 {