Mercurial > hg > piper-vamp-js
comparison PiperPluginLibrary.h @ 43:90bf9d9f9c95
Rearrange and rename VamPipe -> Piper as appropriate
author | Chris Cannam |
---|---|
date | Mon, 10 Oct 2016 17:05:37 +0100 |
parents | VamPipePluginLibrary.h@e18e15bedd72 |
children | b780e56eebb4 |
comparison
equal
deleted
inserted
replaced
42:873ce3bfa776 | 43:90bf9d9f9c95 |
---|---|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ | |
2 | |
3 /* | |
4 Piper Vamp JSON Adapter | |
5 | |
6 Centre for Digital Music, Queen Mary, University of London. | |
7 Copyright 2015-2016 QMUL. | |
8 | |
9 Permission is hereby granted, free of charge, to any person | |
10 obtaining a copy of this software and associated documentation | |
11 files (the "Software"), to deal in the Software without | |
12 restriction, including without limitation the rights to use, copy, | |
13 modify, merge, publish, distribute, sublicense, and/or sell copies | |
14 of the Software, and to permit persons to whom the Software is | |
15 furnished to do so, subject to the following conditions: | |
16 | |
17 The above copyright notice and this permission notice shall be | |
18 included in all copies or substantial portions of the Software. | |
19 | |
20 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
21 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
22 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | |
23 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR | |
24 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF | |
25 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | |
26 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
27 | |
28 Except as contained in this notice, the names of the Centre for | |
29 Digital Music; Queen Mary, University of London; and Chris Cannam | |
30 shall not be used in advertising or otherwise to promote the sale, | |
31 use or other dealings in this Software without prior written | |
32 authorization. | |
33 */ | |
34 | |
35 #ifndef PIPER_PLUGIN_LIBRARY_H | |
36 #define PIPER_PLUGIN_LIBRARY_H | |
37 | |
38 #include "vamp-support/CountingPluginHandleMapper.h" | |
39 | |
40 #include <vamp-hostsdk/PluginStaticData.h> | |
41 #include <vamp-hostsdk/RequestResponse.h> | |
42 | |
43 #include <vector> | |
44 #include <string> | |
45 #include <cstring> | |
46 | |
47 namespace piper { | |
48 | |
49 class PiperAdapterInterface; | |
50 | |
51 class PiperPluginLibrary | |
52 { | |
53 public: | |
54 PiperPluginLibrary(std::vector<PiperAdapterInterface *> pp); | |
55 | |
56 const char *requestJson(const char *request) { | |
57 return strdup(requestJsonImpl(request).c_str()); | |
58 } | |
59 | |
60 const char *processRaw(int handle, const float *const *inputBuffers, | |
61 int sec, int nsec) { | |
62 return strdup(processRawImpl(handle, inputBuffers, sec, nsec).c_str()); | |
63 } | |
64 | |
65 void freeJson(const char *json) { | |
66 free(const_cast<char *>(json)); | |
67 } | |
68 | |
69 private: | |
70 std::string requestJsonImpl(std::string req); | |
71 std::string processRawImpl(int, const float *const *, int, int); | |
72 | |
73 Vamp::HostExt::ListResponse listPluginData() const; | |
74 Vamp::HostExt::LoadResponse loadPlugin(Vamp::HostExt::LoadRequest r, | |
75 std::string &err) const; | |
76 Vamp::HostExt::ConfigurationResponse configurePlugin(Vamp::HostExt:: | |
77 ConfigurationRequest r, | |
78 std::string &err) | |
79 const; | |
80 | |
81 // map from pluginKey -> adapter | |
82 std::map<std::string, PiperAdapterInterface *> m_adapters; | |
83 CountingPluginHandleMapper m_mapper; | |
84 bool m_useBase64; | |
85 }; | |
86 | |
87 } | |
88 | |
89 #endif |