Mercurial > hg > piper-vamp-js
diff VamPipePluginLibrary.cpp @ 85:1a9ba1c08f9e
Merge from branch process-noparse
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Wed, 14 Sep 2016 14:43:37 +0100 |
parents | a6ab5fd80eb7 |
children | 0e1909abe921 |
line wrap: on
line diff
--- a/VamPipePluginLibrary.cpp Thu Sep 08 15:27:48 2016 +0100 +++ b/VamPipePluginLibrary.cpp Wed Sep 14 14:43:37 2016 +0100 @@ -193,6 +193,36 @@ } string +VamPipePluginLibrary::processRawImpl(int pluginHandle, + const float *const *inputBuffers, + int sec, + int nsec) +{ + RequestOrResponse response; + response.direction = RequestOrResponse::Response; + response.type = RRType::Process; + + try { + if (!m_mapper.isConfigured(pluginHandle)) { + throw runtime_error("plugin has not been configured"); + } + + Vamp::Plugin *plugin = m_mapper.handleToPlugin(pluginHandle); + Vamp::RealTime timestamp(sec, nsec); + + response.processResponse.features = plugin->process(inputBuffers, timestamp); + response.success = true; + + m_useBase64 = true; + + return writeResponse(response); + + } catch (const std::exception &e) { + return VampJson::fromException(e, RRType::Process).dump(); + } +} + +string VamPipePluginLibrary::requestJsonImpl(string req) { RequestOrResponse request; @@ -200,7 +230,6 @@ try { request = readRequest(req); } catch (const std::exception &e) { - std::cerr << "FAILURE" << std::endl; return VampJson::fromException(e, RRType::NotValid).dump(); } @@ -254,7 +283,7 @@ if (channels != m_mapper.getChannelCount(h)) { throw runtime_error("wrong number of channels supplied to process"); } - + const float **fbuffers = new const float *[channels]; for (int i = 0; i < channels; ++i) { if (int(preq.inputBuffers[i].size()) != m_mapper.getBlockSize(h)) {