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