changeset 426:5502a06537f6 vampipe

Add listPluginData
author Chris Cannam
date Thu, 12 May 2016 15:53:55 +0100
parents 6b2567f365b0
children 56a23abf8283
files build/update-version.sh configure src/vamp-hostsdk/PluginLoader.cpp vamp-hostsdk/LoadRequest.h vamp-hostsdk/PluginLoader.h vamp-hostsdk/PluginStaticData.h
diffstat 6 files changed, 65 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/build/update-version.sh	Thu May 12 14:43:10 2016 +0100
+++ b/build/update-version.sh	Thu May 12 15:53:55 2016 +0100
@@ -126,4 +126,7 @@
 $p 's/^$/\nextern void libvamphostsdk_v_'$acs'_present(void) { }/' \
     src/vamp-hostsdk/acsymbols.c
 
-echo "Done, now check with e.g. hg diff -- and don't forget to update CHANGELOG"
+echo "Done, now check changes with e.g. hg diff"
+echo "*** Don't forget to update CHANGELOG"
+echo "*** Don't forget to re-run \"aclocal -I . && autoconf\""
+
--- a/configure	Thu May 12 14:43:10 2016 +0100
+++ b/configure	Thu May 12 15:53:55 2016 +0100
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for vamp-plugin-sdk 2.6.
+# Generated by GNU Autoconf 2.69 for vamp-plugin-sdk 2.7.
 #
 # Report bugs to <cannam@all-day-breakfast.com>.
 #
@@ -580,8 +580,8 @@
 # Identity of this package.
 PACKAGE_NAME='vamp-plugin-sdk'
 PACKAGE_TARNAME='vamp-plugin-sdk'
-PACKAGE_VERSION='2.6'
-PACKAGE_STRING='vamp-plugin-sdk 2.6'
+PACKAGE_VERSION='2.7'
+PACKAGE_STRING='vamp-plugin-sdk 2.7'
 PACKAGE_BUGREPORT='cannam@all-day-breakfast.com'
 PACKAGE_URL=''
 
@@ -1243,7 +1243,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures vamp-plugin-sdk 2.6 to adapt to many kinds of systems.
+\`configure' configures vamp-plugin-sdk 2.7 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1304,7 +1304,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of vamp-plugin-sdk 2.6:";;
+     short | recursive ) echo "Configuration of vamp-plugin-sdk 2.7:";;
    esac
   cat <<\_ACEOF
 
@@ -1402,7 +1402,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-vamp-plugin-sdk configure 2.6
+vamp-plugin-sdk configure 2.7
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1651,7 +1651,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by vamp-plugin-sdk $as_me 2.6, which was
+It was created by vamp-plugin-sdk $as_me 2.7, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -4505,7 +4505,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by vamp-plugin-sdk $as_me 2.6, which was
+This file was extended by vamp-plugin-sdk $as_me 2.7, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -4558,7 +4558,7 @@
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-vamp-plugin-sdk config.status 2.6
+vamp-plugin-sdk config.status 2.7
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
--- 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)
 {
--- a/vamp-hostsdk/LoadRequest.h	Thu May 12 14:43:10 2016 +0100
+++ b/vamp-hostsdk/LoadRequest.h	Thu May 12 15:53:55 2016 +0100
@@ -135,6 +135,8 @@
      * information about it that does not depend on its configuration
      * (parameters, programs, initialisation parameters). The contents
      * of this structure are only valid if plugin is non-0.
+     *
+     * Much of the data in here is duplicated with the plugin itself.
      */
     PluginStaticData staticData;
 
--- a/vamp-hostsdk/PluginLoader.h	Thu May 12 14:43:10 2016 +0100
+++ b/vamp-hostsdk/PluginLoader.h	Thu May 12 15:53:55 2016 +0100
@@ -123,12 +123,28 @@
     typedef std::vector<std::string> PluginCategoryHierarchy;
 
     /**
+     * PluginStaticDataList is a list containing static information
+     * about a set of Vamp plugins.
+     *
+     * \see PluginStaticData, listPluginData()
+     */
+    typedef std::vector<PluginStaticData> PluginStaticDataList;
+    
+    /**
      * Search for all available Vamp plugins, and return a list of
      * them in the order in which they were found.
      */
     PluginKeyList listPlugins();
 
     /**
+     * Search for all available Vamp plugins, and return a list of
+     * static data about each plugin in the order in which they were
+     * found. This is slower but returns more comprehensive
+     * information than listPlugins().
+     */
+    PluginStaticDataList listPluginData();
+
+    /**
      * AdapterFlags contains a set of values that may be OR'd together
      * to indicate in which circumstances PluginLoader should use a
      * plugin adapter to make a plugin easier to use for a host that
--- a/vamp-hostsdk/PluginStaticData.h	Thu May 12 14:43:10 2016 +0100
+++ b/vamp-hostsdk/PluginStaticData.h	Thu May 12 15:53:55 2016 +0100
@@ -54,6 +54,11 @@
  * plugin after it is loaded. That is, everything that does not depend
  * on a parameter or initialisation setting.
  *
+ * All of the information in here can be queried from other sources
+ * directly (notably the Plugin class itself); this structure just
+ * pulls it together in one place and provides something that can be
+ * stored and recalled without having a Plugin object to hand.
+ *
  * \note This class was introduced in version 2.7 of the Vamp plugin
  * SDK and is used only by host SDK functions that were also
  * introduced in that release (or newer).