annotate plugins.cpp @ 34:bc4841b14d0f

Copyright note, untabify
author Chris Cannam
date Wed, 14 Sep 2016 17:56:19 +0100
parents cfff2b6ff0fd
children
rev   line source
Chris@34 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@34 2 /*
Chris@34 3 Vamp Test Plugin
Chris@34 4 Copyright (c) 2013-2016 Queen Mary, University of London
Chris@0 5
Chris@34 6 Permission is hereby granted, free of charge, to any person
Chris@34 7 obtaining a copy of this software and associated documentation
Chris@34 8 files (the "Software"), to deal in the Software without
Chris@34 9 restriction, including without limitation the rights to use, copy,
Chris@34 10 modify, merge, publish, distribute, sublicense, and/or sell copies
Chris@34 11 of the Software, and to permit persons to whom the Software is
Chris@34 12 furnished to do so, subject to the following conditions:
Chris@34 13
Chris@34 14 The above copyright notice and this permission notice shall be
Chris@34 15 included in all copies or substantial portions of the Software.
Chris@34 16
Chris@34 17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
Chris@34 18 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
Chris@34 19 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
Chris@34 20 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
Chris@34 21 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
Chris@34 22 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
Chris@34 23 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Chris@34 24
Chris@34 25 Except as contained in this notice, the names of the Centre for
Chris@34 26 Digital Music and Queen Mary, University of London shall not be
Chris@34 27 used in advertising or otherwise to promote the sale, use or other
Chris@34 28 dealings in this Software without prior written authorization.
Chris@34 29 */
Chris@0 30
Chris@0 31 #include <vamp/vamp.h>
Chris@0 32 #include <vamp-sdk/PluginAdapter.h>
Chris@0 33
Chris@0 34 #include "VampTestPlugin.h"
Chris@0 35
Chris@20 36 class Adapter : public Vamp::PluginAdapterBase
Chris@20 37 {
Chris@20 38 public:
Chris@20 39 Adapter(bool freq) :
Chris@34 40 PluginAdapterBase(),
Chris@34 41 m_freq(freq) { }
Chris@0 42
Chris@20 43 virtual ~Adapter() { }
Chris@0 44
Chris@20 45 protected:
Chris@20 46 bool m_freq;
Chris@20 47
Chris@20 48 Vamp::Plugin *createPlugin(float inputSampleRate) {
Chris@34 49 return new VampTestPlugin(inputSampleRate, m_freq);
Chris@20 50 }
Chris@20 51 };
Chris@20 52
Chris@20 53 static Adapter timeAdapter(false);
Chris@20 54 static Adapter freqAdapter(true);
Chris@0 55
Chris@0 56 const VampPluginDescriptor *
Chris@0 57 vampGetPluginDescriptor(unsigned int version, unsigned int index)
Chris@0 58 {
Chris@0 59 if (version < 1) return 0;
Chris@0 60
Chris@0 61 // Return a different plugin adaptor's descriptor for each index,
Chris@0 62 // and return 0 for the first index after you run out of plugins.
Chris@0 63 // (That's how the host finds out how many plugins are in this
Chris@0 64 // library.)
Chris@0 65
Chris@0 66 switch (index) {
Chris@20 67 case 0: return timeAdapter.getDescriptor();
Chris@20 68 case 1: return freqAdapter.getDescriptor();
Chris@0 69 default: return 0;
Chris@0 70 }
Chris@0 71 }
Chris@0 72
Chris@0 73