annotate vamp-test-plugin.cpp @ 110:2f621b00747e

Merge from branch jsonrpc
author Chris Cannam <c.cannam@qmul.ac.uk>
date Thu, 06 Oct 2016 14:33:12 +0100
parents 9d20eb251fbc
children 90bf9d9f9c95
rev   line source
c@89 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
c@89 2 /*
c@89 3 Vamp Test Plugin
c@89 4 Copyright (c) 2013-2016 Queen Mary, University of London
c@89 5
c@89 6 Permission is hereby granted, free of charge, to any person
c@89 7 obtaining a copy of this software and associated documentation
c@89 8 files (the "Software"), to deal in the Software without
c@89 9 restriction, including without limitation the rights to use, copy,
c@89 10 modify, merge, publish, distribute, sublicense, and/or sell copies
c@89 11 of the Software, and to permit persons to whom the Software is
c@89 12 furnished to do so, subject to the following conditions:
c@89 13
c@89 14 The above copyright notice and this permission notice shall be
c@89 15 included in all copies or substantial portions of the Software.
c@89 16
c@89 17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
c@89 18 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
c@89 19 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
c@89 20 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
c@89 21 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
c@89 22 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
c@89 23 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
c@89 24
c@89 25 Except as contained in this notice, the names of the Centre for
c@89 26 Digital Music and Queen Mary, University of London shall not be
c@89 27 used in advertising or otherwise to promote the sale, use or other
c@89 28 dealings in this Software without prior written authorization.
c@89 29 */
c@89 30
c@89 31 #include "VamPipeAdapter.h"
c@89 32 #include "VamPipePluginLibrary.h"
c@89 33
c@89 34 #include "VampTestPlugin.h"
c@89 35
c@89 36 using vampipe::VamPipeAdapter;
c@89 37 using vampipe::VamPipeAdapterBase;
c@89 38 using vampipe::VamPipePluginLibrary;
c@89 39
c@89 40 static std::string soname("vamp-test-plugin");
c@89 41
c@89 42 class Adapter : public VamPipeAdapterBase<VampTestPlugin>
c@89 43 {
c@89 44 public:
c@89 45 Adapter(bool freq) :
c@89 46 VamPipeAdapterBase<VampTestPlugin>(soname),
c@89 47 m_freq(freq) { }
c@89 48
c@89 49 protected:
c@89 50 bool m_freq;
c@89 51
c@89 52 Vamp::Plugin *createPlugin(float inputSampleRate) const {
c@89 53 return new VampTestPlugin(inputSampleRate, m_freq);
c@89 54 }
c@89 55 };
c@89 56
c@89 57 static Adapter timeAdapter(false);
c@89 58 static Adapter freqAdapter(true);
c@89 59
c@89 60 static VamPipePluginLibrary library({
c@89 61 &timeAdapter,
c@89 62 &freqAdapter
c@89 63 });
c@89 64
c@89 65 extern "C" {
c@89 66
c@89 67 const char *vampipeRequestJson(const char *request) {
c@89 68 return library.requestJson(request);
c@89 69 }
c@89 70
c@109 71 const char *vampipeProcessRaw(int handle,
c@89 72 const float *const *inputBuffers,
c@89 73 int sec,
c@89 74 int nsec) {
c@109 75 return library.processRaw(handle, inputBuffers, sec, nsec);
c@89 76 }
c@89 77
c@89 78 void vampipeFreeJson(const char *json) {
c@89 79 return library.freeJson(json);
c@89 80 }
c@89 81
c@89 82 }
c@89 83