c@117: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ c@117: c@117: /* c@117: Piper Vamp JSON Adapter c@117: c@117: Centre for Digital Music, Queen Mary, University of London. c@117: Copyright 2015-2016 QMUL. c@117: c@117: Permission is hereby granted, free of charge, to any person c@117: obtaining a copy of this software and associated documentation c@117: files (the "Software"), to deal in the Software without c@117: restriction, including without limitation the rights to use, copy, c@117: modify, merge, publish, distribute, sublicense, and/or sell copies c@117: of the Software, and to permit persons to whom the Software is c@117: furnished to do so, subject to the following conditions: c@117: c@117: The above copyright notice and this permission notice shall be c@117: included in all copies or substantial portions of the Software. c@117: c@117: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, c@117: EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF c@117: MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND c@117: NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR c@117: ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF c@117: CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION c@117: WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. c@117: c@117: Except as contained in this notice, the names of the Centre for c@117: Digital Music; Queen Mary, University of London; and Chris Cannam c@117: shall not be used in advertising or otherwise to promote the sale, c@117: use or other dealings in this Software without prior written c@117: authorization. c@117: */ c@117: c@117: #ifndef PIPER_PLUGIN_LIBRARY_H c@117: #define PIPER_PLUGIN_LIBRARY_H c@117: c@117: #include "vamp-support/CountingPluginHandleMapper.h" c@117: #include "vamp-support/PluginStaticData.h" c@117: #include "vamp-support/RequestResponse.h" c@117: c@117: #include c@117: #include c@117: #include c@117: c@117: namespace piper_vamp_js { c@117: c@117: class PiperAdapterInterface; c@117: c@117: class PiperPluginLibrary c@117: { c@117: public: c@117: PiperPluginLibrary(std::vector pp); c@117: c@117: const char *requestJson(const char *request) { c@117: return strdup(requestJsonImpl(request).c_str()); c@117: } c@117: c@117: const char *processRaw(int handle, const float *const *inputBuffers, c@117: int sec, int nsec) { c@117: return strdup(processRawImpl(handle, inputBuffers, sec, nsec).c_str()); c@117: } c@117: c@117: void freeJson(const char *json) { c@117: free(const_cast(json)); c@117: } c@117: c@117: private: c@117: std::string requestJsonImpl(std::string req); c@117: std::string processRawImpl(int, const float *const *, int, int); c@117: c@117: piper_vamp::ListResponse listPluginData(piper_vamp::ListRequest r) const; c@117: piper_vamp::LoadResponse loadPlugin(piper_vamp::LoadRequest r, c@117: std::string &err) const; cannam@152: piper_vamp::ConfigurationResponse cannam@152: configurePlugin(piper_vamp::ConfigurationRequest r, cannam@152: const piper_vamp::PluginStaticData &psd, cannam@152: std::string &err) c@117: const; c@117: c@117: // map from pluginKey -> adapter c@117: std::map m_adapters; cannam@152: cannam@155: // map from plugin handle -> plugin static data. Added to when a cannam@155: // plugin is loaded, removed from when finish() is called. cannam@152: std::map m_pluginStaticData; cannam@152: c@117: piper_vamp::CountingPluginHandleMapper m_mapper; c@117: bool m_useBase64; c@117: }; c@117: c@117: } c@117: c@117: #endif