Mercurial > hg > piper-vamp-js
diff VamPipePluginLibrary.cpp @ 110:2f621b00747e
Merge from branch jsonrpc
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Thu, 06 Oct 2016 14:33:12 +0100 |
parents | 9d20eb251fbc |
children | 873ce3bfa776 |
line wrap: on
line diff
--- a/VamPipePluginLibrary.cpp Fri Sep 30 19:20:23 2016 +0100 +++ b/VamPipePluginLibrary.cpp Thu Oct 06 14:33:12 2016 +0100 @@ -54,10 +54,6 @@ } if (!j.is_object()) { err = "object expected at top level"; - } else if (!j["type"].is_string()) { - err = "string expected for type field"; - } else if (!j["content"].is_null() && !j["content"].is_object()) { - err = "object expected for content field"; } return j; } @@ -130,18 +126,18 @@ } string -VamPipePluginLibrary::processRawImpl(int pluginHandle, +VamPipePluginLibrary::processRawImpl(int handle, const float *const *inputBuffers, int sec, int nsec) { - Vamp::Plugin *plugin = m_mapper.handleToPlugin(pluginHandle); + Vamp::Plugin *plugin = m_mapper.handleToPlugin(handle); if (!plugin) { return VampJson::fromError("unknown plugin handle", RRType::Process) .dump(); } - if (!m_mapper.isConfigured(pluginHandle)) { + if (!m_mapper.isConfigured(handle)) { return VampJson::fromError("plugin has not been configured", RRType::Process) .dump(); } @@ -154,7 +150,7 @@ m_useBase64 = true; - return VampJson::fromVampResponse_Process + return VampJson::fromRpcResponse_Process (resp, m_mapper, VampJson::BufferSerialisation::Base64) .dump(); @@ -185,12 +181,12 @@ switch (type) { case RRType::List: - rj = VampJson::fromVampResponse_List(listPluginData()); + rj = VampJson::fromRpcResponse_List(listPluginData()); break; case RRType::Load: { - auto req = VampJson::toVampRequest_Load(j, err); + auto req = VampJson::toRpcRequest_Load(j, err); if (err != "") { rj = VampJson::fromError(err, type); } else { @@ -199,7 +195,7 @@ rj = VampJson::fromError(err, type); } else { m_mapper.addPlugin(resp.plugin); - rj = VampJson::fromVampResponse_Load(resp, m_mapper); + rj = VampJson::fromRpcResponse_Load(resp, m_mapper); } } break; @@ -207,7 +203,7 @@ case RRType::Configure: { - auto req = VampJson::toVampRequest_Configure(j, m_mapper, err); + auto req = VampJson::toRpcRequest_Configure(j, m_mapper, err); if (err != "") { rj = VampJson::fromError(err, type); } else { @@ -224,7 +220,7 @@ m_mapper.markConfigured(h, req.configuration.channelCount, req.configuration.blockSize); - rj = VampJson::fromVampResponse_Configure(resp, m_mapper); + rj = VampJson::fromRpcResponse_Configure(resp, m_mapper); } } } @@ -235,7 +231,7 @@ { VampJson::BufferSerialisation serialisation; - auto req = VampJson::toVampRequest_Process(j, m_mapper, + auto req = VampJson::toRpcRequest_Process(j, m_mapper, serialisation, err); if (err != "") { rj = VampJson::fromError(err, type); @@ -272,7 +268,7 @@ resp.plugin = req.plugin; resp.features = req.plugin->process(fbuffers, req.timestamp); delete[] fbuffers; - rj = VampJson::fromVampResponse_Process + rj = VampJson::fromRpcResponse_Process (resp, m_mapper, serialisation); } } @@ -282,7 +278,7 @@ case RRType::Finish: { - auto req = VampJson::toVampRequest_Finish(j, m_mapper, err); + auto req = VampJson::toRpcRequest_Finish(j, m_mapper, err); if (err != "") { rj = VampJson::fromError(err, type); } else { @@ -297,7 +293,7 @@ resp.plugin = req.plugin; resp.features = req.plugin->getRemainingFeatures(); - rj = VampJson::fromVampResponse_Finish + rj = VampJson::fromRpcResponse_Finish (resp, m_mapper, serialisation); m_mapper.removePlugin(h);