annotate examples/vamp-example-plugins.cpp @ 133:2255741a934c

Add test target
author Chris Cannam <c.cannam@qmul.ac.uk>
date Fri, 11 Nov 2016 11:08:10 +0000
parents 2e8aacb7f883
children
rev   line source
c@117 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
c@117 2
c@117 3 /*
c@117 4 Piper
c@117 5
c@117 6 Centre for Digital Music, Queen Mary, University of London.
c@117 7 Copyright 2015-2016 QMUL.
c@117 8
c@117 9 Permission is hereby granted, free of charge, to any person
c@117 10 obtaining a copy of this software and associated documentation
c@117 11 files (the "Software"), to deal in the Software without
c@117 12 restriction, including without limitation the rights to use, copy,
c@117 13 modify, merge, publish, distribute, sublicense, and/or sell copies
c@117 14 of the Software, and to permit persons to whom the Software is
c@117 15 furnished to do so, subject to the following conditions:
c@117 16
c@117 17 The above copyright notice and this permission notice shall be
c@117 18 included in all copies or substantial portions of the Software.
c@117 19
c@117 20 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
c@117 21 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
c@117 22 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
c@117 23 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
c@117 24 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
c@117 25 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
c@117 26 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
c@117 27
c@117 28 Except as contained in this notice, the names of the Centre for
c@117 29 Digital Music; Queen Mary, University of London; and Chris Cannam
c@117 30 shall not be used in advertising or otherwise to promote the sale,
c@117 31 use or other dealings in this Software without prior written
c@117 32 authorization.
c@117 33 */
c@117 34
c@117 35 #include "PiperAdapter.h"
c@117 36 #include "PiperPluginLibrary.h"
c@117 37
c@117 38 #include "examples/ZeroCrossing.h"
c@117 39 #include "examples/SpectralCentroid.h"
c@117 40 #include "examples/PercussionOnsetDetector.h"
c@117 41 #include "examples/FixedTempoEstimator.h"
c@117 42 #include "examples/AmplitudeFollower.h"
c@117 43 #include "examples/PowerSpectrum.h"
c@117 44
c@117 45 using piper_vamp_js::PiperAdapter;
c@117 46 using piper_vamp_js::PiperPluginLibrary;
c@117 47
c@117 48 static std::string soname("vamp-example-plugins");
c@117 49
c@117 50 static PiperAdapter<ZeroCrossing> zeroCrossingAdapter(soname);
c@117 51 static PiperAdapter<SpectralCentroid> spectralCentroidAdapter(soname);
c@117 52 static PiperAdapter<PercussionOnsetDetector> percussionOnsetAdapter(soname);
c@117 53 static PiperAdapter<FixedTempoEstimator> fixedTempoAdapter(soname);
c@117 54 static PiperAdapter<AmplitudeFollower> amplitudeAdapter(soname);
c@117 55 static PiperAdapter<PowerSpectrum> powerSpectrumAdapter(soname);
c@117 56
c@117 57 static PiperPluginLibrary library({
c@117 58 &zeroCrossingAdapter,
c@117 59 &spectralCentroidAdapter,
c@117 60 &percussionOnsetAdapter,
c@117 61 &fixedTempoAdapter,
c@117 62 &amplitudeAdapter,
c@117 63 &powerSpectrumAdapter
c@117 64 });
c@117 65
c@117 66 extern "C" {
c@117 67
c@117 68 const char *piperRequestJson(const char *request) {
c@117 69 return library.requestJson(request);
c@117 70 }
c@117 71
c@117 72 const char *piperProcessRaw(int handle,
c@117 73 const float *const *inputBuffers,
c@117 74 int sec,
c@117 75 int nsec) {
c@117 76 return library.processRaw(handle, inputBuffers, sec, nsec);
c@117 77 }
c@117 78
c@117 79 void piperFreeJson(const char *json) {
c@117 80 return library.freeJson(json);
c@117 81 }
c@117 82
c@117 83 }
c@117 84