diff vamp-sdk/hostext/PluginLoader.cpp @ 61:97c5ac99d725 host-factory-stuff

* install hostext headers to vamp-sdk/hostext/ rather than vamp-sdk/ * adjust timestamps in input-domain adapter so as to centre them on block as required by Plugin documentation * better handling for frequency-domain plugins that want non-power-of-two blocksizes (can't handle them, but at least try offering them a power-of-two alternative) * couple of Plugin doc additions * make PluginLoader capable of returning ready-wrapped plugins
author cannam
date Fri, 01 Jun 2007 13:53:42 +0000
parents fa79c4ec847d
children
line wrap: on
line diff
--- a/vamp-sdk/hostext/PluginLoader.cpp	Fri May 25 13:26:59 2007 +0000
+++ b/vamp-sdk/hostext/PluginLoader.cpp	Fri Jun 01 13:53:42 2007 +0000
@@ -36,6 +36,8 @@
 
 #include "vamp-sdk/PluginHostAdapter.h"
 #include "PluginLoader.h"
+#include "PluginInputDomainAdapter.h"
+#include "PluginChannelAdapter.h"
 
 #include <fstream>
 
@@ -171,7 +173,7 @@
 }    
 
 Plugin *
-PluginLoader::loadPlugin(PluginKey key, float inputSampleRate)
+PluginLoader::loadPlugin(PluginKey key, float inputSampleRate, int adapterFlags)
 {
     string fullPath = getLibraryPathForPlugin(key);
     if (fullPath == "") return 0;
@@ -206,10 +208,20 @@
             Vamp::PluginHostAdapter *plugin =
                 new Vamp::PluginHostAdapter(descriptor, inputSampleRate);
 
-            PluginDeletionNotifyAdapter *adapter =
-                new PluginDeletionNotifyAdapter(plugin, this);
+            Plugin *adapter = new PluginDeletionNotifyAdapter(plugin, this);
 
             m_pluginLibraryHandleMap[adapter] = handle;
+
+            if (adapterFlags & ADAPT_INPUT_DOMAIN) {
+                if (adapter->getInputDomain() == Plugin::FrequencyDomain) {
+                    adapter = new PluginInputDomainAdapter(adapter);
+                }
+            }
+
+            if (adapterFlags & ADAPT_CHANNEL_COUNT) {
+                adapter = new PluginChannelAdapter(adapter);
+            }
+
             return adapter;
         }