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