Mercurial > hg > vamp-fanchirp
annotate plugins.cpp @ 25:8e57d2f41926 maxpartial
Experiment at limiting number of partials (for speed). Interacts badly with harmonic correction, so doesn't work at the mo
author | Chris Cannam |
---|---|
date | Thu, 04 Oct 2018 15:42:03 +0100 |
parents | 0a860992b4f4 |
children |
rev | line source |
---|---|
Chris@0 | 1 |
Chris@0 | 2 // This is a skeleton file for use in creating your own plugin |
Chris@0 | 3 // libraries. Replace MyPlugin and myPlugin throughout with the name |
Chris@0 | 4 // of your first plugin class, and fill in the gaps as appropriate. |
Chris@0 | 5 |
Chris@0 | 6 |
Chris@0 | 7 #include <vamp/vamp.h> |
Chris@0 | 8 #include <vamp-sdk/PluginAdapter.h> |
Chris@0 | 9 |
Chris@0 | 10 #include "FChTransformF0gram.h" |
Chris@0 | 11 |
Chris@15 | 12 class FChTransformAdapter : public Vamp::PluginAdapterBase |
Chris@15 | 13 { |
Chris@15 | 14 public: |
Chris@15 | 15 FChTransformAdapter(FChTransformF0gram::ProcessingMode mode) : |
Chris@15 | 16 PluginAdapterBase(), |
Chris@15 | 17 m_mode(mode) |
Chris@15 | 18 { } |
Chris@0 | 19 |
Chris@15 | 20 virtual ~FChTransformAdapter() { } |
Chris@0 | 21 |
Chris@15 | 22 protected: |
Chris@15 | 23 Vamp::Plugin *createPlugin(float inputSampleRate) { |
Chris@15 | 24 return new FChTransformF0gram(m_mode, inputSampleRate); |
Chris@15 | 25 } |
Chris@0 | 26 |
Chris@15 | 27 FChTransformF0gram::ProcessingMode m_mode; |
Chris@15 | 28 }; |
Chris@15 | 29 |
Chris@15 | 30 static FChTransformAdapter f0gram(FChTransformF0gram::ModeF0Gram); |
Chris@15 | 31 static FChTransformAdapter spectrogram(FChTransformF0gram::ModeSpectrogram); |
Chris@15 | 32 static FChTransformAdapter rough(FChTransformF0gram::ModeRoughSpectrogram); |
Chris@0 | 33 |
Chris@0 | 34 // This is the entry-point for the library, and the only function that |
Chris@0 | 35 // needs to be publicly exported. |
Chris@0 | 36 |
Chris@0 | 37 const VampPluginDescriptor * |
Chris@0 | 38 vampGetPluginDescriptor(unsigned int version, unsigned int index) |
Chris@0 | 39 { |
Chris@0 | 40 if (version < 1) return 0; |
Chris@0 | 41 |
Chris@0 | 42 // Return a different plugin adaptor's descriptor for each index, |
Chris@0 | 43 // and return 0 for the first index after you run out of plugins. |
Chris@0 | 44 // (That's how the host finds out how many plugins are in this |
Chris@0 | 45 // library.) |
Chris@0 | 46 |
Chris@0 | 47 switch (index) { |
Chris@15 | 48 case 0: return f0gram.getDescriptor(); |
Chris@15 | 49 case 1: return spectrogram.getDescriptor(); |
Chris@15 | 50 case 2: return rough.getDescriptor(); |
Chris@0 | 51 default: return 0; |
Chris@0 | 52 } |
Chris@0 | 53 } |
Chris@0 | 54 |
Chris@0 | 55 |