Chris@20: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@20: /* Chris@20: Vamp Test Plugin Chris@20: Copyright (c) 2013-2016 Queen Mary, University of London Chris@20: Chris@20: Permission is hereby granted, free of charge, to any person Chris@20: obtaining a copy of this software and associated documentation Chris@20: files (the "Software"), to deal in the Software without Chris@20: restriction, including without limitation the rights to use, copy, Chris@20: modify, merge, publish, distribute, sublicense, and/or sell copies Chris@20: of the Software, and to permit persons to whom the Software is Chris@20: furnished to do so, subject to the following conditions: Chris@20: Chris@20: The above copyright notice and this permission notice shall be Chris@20: included in all copies or substantial portions of the Software. Chris@20: Chris@20: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, Chris@20: EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF Chris@20: MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND Chris@20: NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY Chris@20: CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF Chris@20: CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION Chris@20: WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Chris@20: Chris@20: Except as contained in this notice, the names of the Centre for Chris@20: Digital Music and Queen Mary, University of London shall not be Chris@20: used in advertising or otherwise to promote the sale, use or other Chris@20: dealings in this Software without prior written authorization. Chris@20: */ Chris@20: Chris@43: #include "PiperAdapter.h" Chris@43: #include "PiperPluginLibrary.h" Chris@20: Chris@20: #include "VampTestPlugin.h" Chris@20: Chris@43: using piper::PiperAdapter; Chris@43: using piper::PiperAdapterBase; Chris@43: using piper::PiperPluginLibrary; Chris@20: Chris@20: static std::string soname("vamp-test-plugin"); Chris@20: Chris@43: class Adapter : public PiperAdapterBase Chris@20: { Chris@20: public: Chris@20: Adapter(bool freq) : Chris@43: PiperAdapterBase(soname), Chris@20: m_freq(freq) { } Chris@20: Chris@20: protected: Chris@20: bool m_freq; Chris@20: Chris@20: Vamp::Plugin *createPlugin(float inputSampleRate) const { Chris@20: 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@20: Chris@43: static PiperPluginLibrary library({ Chris@20: &timeAdapter, Chris@20: &freqAdapter Chris@20: }); Chris@20: Chris@20: extern "C" { Chris@20: Chris@43: const char *piperRequestJson(const char *request) { Chris@20: return library.requestJson(request); Chris@20: } Chris@20: Chris@43: const char *piperProcessRaw(int handle, Chris@20: const float *const *inputBuffers, Chris@20: int sec, Chris@20: int nsec) { Chris@40: return library.processRaw(handle, inputBuffers, sec, nsec); Chris@20: } Chris@20: Chris@43: void piperFreeJson(const char *json) { Chris@20: return library.freeJson(json); Chris@20: } Chris@20: Chris@20: } Chris@20: