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