Mercurial > hg > piper-cpp
diff capnproto/VampnProto.h @ 64:85ec33975434
Support split OutputDescriptor, and plugins rather than pluginData in listResponse from SDK
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Fri, 23 Sep 2016 14:20:29 +0100 |
parents | 18951a1f1001 |
children | 6f160dee1192 |
line wrap: on
line diff
--- a/capnproto/VampnProto.h Fri Sep 23 14:20:06 2016 +0100 +++ b/capnproto/VampnProto.h Fri Sep 23 14:20:29 2016 +0100 @@ -127,11 +127,8 @@ } static void - buildOutputDescriptor(OutputDescriptor::Builder &b, - const Vamp::Plugin::OutputDescriptor &od) { - - auto basic = b.initBasic(); - buildBasicDescriptor(basic, od); + buildConfiguredOutputDescriptor(ConfiguredOutputDescriptor::Builder &b, + const Vamp::Plugin::OutputDescriptor &od) { b.setUnit(od.unit); @@ -162,10 +159,19 @@ } static void - readOutputDescriptor(Vamp::Plugin::OutputDescriptor &od, - const OutputDescriptor::Reader &r) { + buildOutputDescriptor(OutputDescriptor::Builder &b, + const Vamp::Plugin::OutputDescriptor &od) { - readBasicDescriptor(od, r.getBasic()); + auto basic = b.initBasic(); + buildBasicDescriptor(basic, od); + + auto configured = b.initConfigured(); + buildConfiguredOutputDescriptor(configured, od); + } + + static void + readConfiguredOutputDescriptor(Vamp::Plugin::OutputDescriptor &od, + const ConfiguredOutputDescriptor::Reader &r) { od.unit = r.getUnit(); @@ -195,6 +201,14 @@ } static void + readOutputDescriptor(Vamp::Plugin::OutputDescriptor &od, + const OutputDescriptor::Reader &r) { + + readBasicDescriptor(od, r.getBasic()); + readConfiguredOutputDescriptor(od, r.getConfigured()); + } + + static void buildParameterDescriptor(ParameterDescriptor::Builder &b, const Vamp::Plugin::ParameterDescriptor &pd) { @@ -685,10 +699,10 @@ const Vamp::HostExt::ListResponse &resp) { b.setSuccess(true); auto r = b.getResponse().initList(); - auto p = r.initPlugins(resp.pluginData.size()); - for (size_t i = 0; i < resp.pluginData.size(); ++i) { + auto p = r.initPlugins(resp.plugins.size()); + for (size_t i = 0; i < resp.plugins.size(); ++i) { auto pd = p[i]; - buildPluginStaticData(pd, resp.pluginData[i]); + buildPluginStaticData(pd, resp.plugins[i]); } } @@ -844,13 +858,13 @@ if (getRequestResponseType(r) != RRType::List) { throw std::logic_error("not a list response"); } - resp.pluginData.clear(); + resp.plugins.clear(); if (r.getSuccess()) { auto pp = r.getResponse().getList().getPlugins(); for (const auto &p: pp) { Vamp::HostExt::PluginStaticData psd; readPluginStaticData(psd, p); - resp.pluginData.push_back(psd); + resp.plugins.push_back(psd); } } }