comparison 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
comparison
equal deleted inserted replaced
19:534b001d8e8f 20:cfff2b6ff0fd
3 #include <vamp/vamp.h> 3 #include <vamp/vamp.h>
4 #include <vamp-sdk/PluginAdapter.h> 4 #include <vamp-sdk/PluginAdapter.h>
5 5
6 #include "VampTestPlugin.h" 6 #include "VampTestPlugin.h"
7 7
8 class Adapter : public Vamp::PluginAdapterBase
9 {
10 public:
11 Adapter(bool freq) :
12 PluginAdapterBase(),
13 m_freq(freq) { }
8 14
9 static Vamp::PluginAdapter<VampTestPlugin> myPluginAdapter; 15 virtual ~Adapter() { }
10 16
17 protected:
18 bool m_freq;
19
20 Vamp::Plugin *createPlugin(float inputSampleRate) {
21 return new VampTestPlugin(inputSampleRate, m_freq);
22 }
23 };
24
25 static Adapter timeAdapter(false);
26 static Adapter freqAdapter(true);
11 27
12 const VampPluginDescriptor * 28 const VampPluginDescriptor *
13 vampGetPluginDescriptor(unsigned int version, unsigned int index) 29 vampGetPluginDescriptor(unsigned int version, unsigned int index)
14 { 30 {
15 if (version < 1) return 0; 31 if (version < 1) return 0;
18 // and return 0 for the first index after you run out of plugins. 34 // and return 0 for the first index after you run out of plugins.
19 // (That's how the host finds out how many plugins are in this 35 // (That's how the host finds out how many plugins are in this
20 // library.) 36 // library.)
21 37
22 switch (index) { 38 switch (index) {
23 case 0: return myPluginAdapter.getDescriptor(); 39 case 0: return timeAdapter.getDescriptor();
40 case 1: return freqAdapter.getDescriptor();
24 default: return 0; 41 default: return 0;
25 } 42 }
26 } 43 }
27 44
28 45