annotate src/PiperExport.h @ 66:08d80862b69c

-ffast-math is not a great idea as a default flag, because some plugins won't work correctly with it. Also allow people to override these
author Chris Cannam
date Sat, 12 Nov 2016 09:58:24 +0000
parents 289b4332378d
children
rev   line source
Chris@60 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@60 2
Chris@60 3 /*
Chris@60 4 Piper Vamp JSON Adapter
Chris@60 5
Chris@60 6 Centre for Digital Music, Queen Mary, University of London.
Chris@60 7 Copyright 2015-2016 QMUL.
Chris@60 8
Chris@60 9 Permission is hereby granted, free of charge, to any person
Chris@60 10 obtaining a copy of this software and associated documentation
Chris@60 11 files (the "Software"), to deal in the Software without
Chris@60 12 restriction, including without limitation the rights to use, copy,
Chris@60 13 modify, merge, publish, distribute, sublicense, and/or sell copies
Chris@60 14 of the Software, and to permit persons to whom the Software is
Chris@60 15 furnished to do so, subject to the following conditions:
Chris@60 16
Chris@60 17 The above copyright notice and this permission notice shall be
Chris@60 18 included in all copies or substantial portions of the Software.
Chris@60 19
Chris@60 20 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
Chris@60 21 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
Chris@60 22 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
Chris@60 23 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
Chris@60 24 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
Chris@60 25 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
Chris@60 26 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Chris@60 27
Chris@60 28 Except as contained in this notice, the names of the Centre for
Chris@60 29 Digital Music; Queen Mary, University of London; and Chris Cannam
Chris@60 30 shall not be used in advertising or otherwise to promote the sale,
Chris@60 31 use or other dealings in this Software without prior written
Chris@60 32 authorization.
Chris@60 33 */
Chris@60 34
Chris@60 35 #ifndef PIPER_EXPORT_H
Chris@60 36 #define PIPER_EXPORT_H
Chris@60 37
Chris@60 38 #ifdef _VAMP_IN_PLUGINSDK
Chris@60 39 #error You must include PiperExport.h before any other files that use the Vamp SDK
Chris@60 40 #endif
Chris@60 41
Chris@60 42 // Include all the Piper headers that an export program may need here:
Chris@60 43 // for a simple Vamp plugin library, this one should be the only Piper
Chris@60 44 // #include
Chris@60 45
Chris@60 46 #include "PiperAdapter.h"
Chris@60 47 #include "PiperPluginLibrary.h"
Chris@60 48
Chris@60 49 // Convenience macros for the usual case with a static
Chris@60 50 // PiperPluginLibrary object to export C wrappers for
Chris@60 51
Chris@60 52 #define PIPER_EXPORT_LIBRARY(library) \
Chris@60 53 extern "C" { \
Chris@60 54 const char *piperRequestJson(const char *request) { \
Chris@60 55 return library.requestJson(request); \
Chris@60 56 } \
Chris@60 57 const char *piperProcessRaw(int handle, \
Chris@60 58 const float *const *inputBuffers, \
Chris@60 59 int sec, \
Chris@60 60 int nsec) { \
Chris@60 61 return library.processRaw(handle, inputBuffers, sec, nsec); \
Chris@60 62 } \
Chris@60 63 void piperFreeJson(const char *json) { \
Chris@60 64 return library.freeJson(json); \
Chris@60 65 } \
Chris@60 66 }
Chris@60 67
Chris@60 68 #endif