diff plugins.cpp @ 20:cfff2b6ff0fd

Add timestamp output and frequency-domain version
author Chris Cannam
date Wed, 14 Jan 2015 10:55:32 +0000
parents 21d94fc628c8
children bc4841b14d0f
line wrap: on
line diff
--- a/plugins.cpp	Wed Dec 03 10:40:07 2014 +0000
+++ b/plugins.cpp	Wed Jan 14 10:55:32 2015 +0000
@@ -5,9 +5,25 @@
 
 #include "VampTestPlugin.h"
 
+class Adapter : public Vamp::PluginAdapterBase
+{
+public:
+    Adapter(bool freq) :
+	PluginAdapterBase(),
+	m_freq(freq) { }
 
-static Vamp::PluginAdapter<VampTestPlugin> myPluginAdapter;
+    virtual ~Adapter() { }
 
+protected:
+    bool m_freq;
+
+    Vamp::Plugin *createPlugin(float inputSampleRate) {
+	return new VampTestPlugin(inputSampleRate, m_freq);
+    }
+};
+
+static Adapter timeAdapter(false);
+static Adapter freqAdapter(true);
 
 const VampPluginDescriptor *
 vampGetPluginDescriptor(unsigned int version, unsigned int index)
@@ -20,7 +36,8 @@
     // library.)
 
     switch (index) {
-    case  0: return myPluginAdapter.getDescriptor();
+    case  0: return timeAdapter.getDescriptor();
+    case  1: return freqAdapter.getDescriptor();
     default: return 0;
     }
 }