Chris@34: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@34: /* Chris@34: Vamp Test Plugin Chris@34: Copyright (c) 2013-2016 Queen Mary, University of London Chris@0: Chris@34: Permission is hereby granted, free of charge, to any person Chris@34: obtaining a copy of this software and associated documentation Chris@34: files (the "Software"), to deal in the Software without Chris@34: restriction, including without limitation the rights to use, copy, Chris@34: modify, merge, publish, distribute, sublicense, and/or sell copies Chris@34: of the Software, and to permit persons to whom the Software is Chris@34: furnished to do so, subject to the following conditions: Chris@34: Chris@34: The above copyright notice and this permission notice shall be Chris@34: included in all copies or substantial portions of the Software. Chris@34: Chris@34: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, Chris@34: EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF Chris@34: MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND Chris@34: NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY Chris@34: CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF Chris@34: CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION Chris@34: WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Chris@34: Chris@34: Except as contained in this notice, the names of the Centre for Chris@34: Digital Music and Queen Mary, University of London shall not be Chris@34: used in advertising or otherwise to promote the sale, use or other Chris@34: dealings in this Software without prior written authorization. Chris@34: */ Chris@0: Chris@0: #include Chris@0: #include Chris@0: Chris@0: #include "VampTestPlugin.h" Chris@0: Chris@20: class Adapter : public Vamp::PluginAdapterBase Chris@20: { Chris@20: public: Chris@20: Adapter(bool freq) : Chris@34: PluginAdapterBase(), Chris@34: m_freq(freq) { } Chris@0: Chris@20: virtual ~Adapter() { } Chris@0: Chris@20: protected: Chris@20: bool m_freq; Chris@20: Chris@20: Vamp::Plugin *createPlugin(float inputSampleRate) { Chris@34: return new VampTestPlugin(inputSampleRate, m_freq); Chris@20: } Chris@20: }; Chris@20: Chris@20: static Adapter timeAdapter(false); Chris@20: static Adapter freqAdapter(true); Chris@0: Chris@0: const VampPluginDescriptor * Chris@0: vampGetPluginDescriptor(unsigned int version, unsigned int index) Chris@0: { Chris@0: if (version < 1) return 0; Chris@0: Chris@0: // Return a different plugin adaptor's descriptor for each index, Chris@0: // and return 0 for the first index after you run out of plugins. Chris@0: // (That's how the host finds out how many plugins are in this Chris@0: // library.) Chris@0: Chris@0: switch (index) { Chris@20: case 0: return timeAdapter.getDescriptor(); Chris@20: case 1: return freqAdapter.getDescriptor(); Chris@0: default: return 0; Chris@0: } Chris@0: } Chris@0: Chris@0: