# HG changeset patch # User Chris Cannam # Date 1463576073 -3600 # Node ID d907576aa299d5babfd69afeee7d5280f0d1c0e6 # Parent c35d0909a74ec890807dc66127ae73cfdbbb71b5 More requests/responses diff -r c35d0909a74e -r d907576aa299 capnproto/VampnProto.h --- a/capnproto/VampnProto.h Wed May 18 12:21:23 2016 +0100 +++ b/capnproto/VampnProto.h Wed May 18 13:54:33 2016 +0100 @@ -601,35 +601,82 @@ } static void - buildVampListRequest(VampRequest::Builder &b) { + buildProcessResponse(ProcessResponse::Builder &b, + const Vamp::HostExt::ProcessResponse &pr) { + + auto f = b.initFeatures(); + buildFeatureSet(f, pr.features); + } + + static void + readProcessResponse(Vamp::HostExt::ProcessResponse &pr, + const ProcessResponse::Reader &r) { + + readFeatureSet(pr.features, r.getFeatures()); + } + + static void + buildVampRequest_List(VampRequest::Builder &b) { b.getRequest().setList(); } static void - buildVampLoadRequest(VampRequest::Builder &b, - const Vamp::HostExt::LoadRequest &req) { + buildVampResponse_List(VampResponse::Builder &b, + const std::vector &d, + std::string errorText = "") { + b.setSuccess(errorText == ""); + b.setErrorText(errorText); + auto r = b.getResponse().initList(d.size()); + for (size_t i = 0; i < d.size(); ++i) { + auto rd = r[i]; + buildPluginStaticData(rd, d[i]); + } + } + + static void + buildVampRequest_Load(VampRequest::Builder &b, + const Vamp::HostExt::LoadRequest &req) { auto u = b.getRequest().initLoad(); buildLoadRequest(u, req); } static void - buildVampConfigureRequest(VampRequest::Builder &b, - const Vamp::HostExt::ConfigurationRequest &cr, - PluginHandleMapper &mapper) { + buildVampResponse_Load(VampResponse::Builder &b, + const Vamp::HostExt::LoadResponse &resp, + PluginHandleMapper &mapper) { + auto u = b.getResponse().initLoad(); + buildLoadResponse(u, resp, mapper); + } + + static void + buildVampRequest_Configure(VampRequest::Builder &b, + const Vamp::HostExt::ConfigurationRequest &cr, + PluginHandleMapper &mapper) { auto u = b.getRequest().initConfigure(); buildConfigurationRequest(u, cr, mapper); } static void - buildVampProcessRequest(VampRequest::Builder &b, - const Vamp::HostExt::ProcessRequest &pr, - PluginHandleMapper &mapper) { + buildVampResponse_Configure(VampResponse::Builder &b, + const Vamp::HostExt::ConfigurationResponse &cr) { + auto u = b.getResponse().initConfigure(); + buildConfigurationResponse(u, cr); + } + + static void + buildVampRequest_Process(VampRequest::Builder &b, + const Vamp::HostExt::ProcessRequest &pr, + PluginHandleMapper &mapper) { auto u = b.getRequest().initProcess(); buildProcessRequest(u, pr, mapper); } - - - //...!!! and responses + + static void + buildVampResponse_Process(VampResponse::Builder &b, + const Vamp::HostExt::ProcessResponse &pr) { + auto u = b.getResponse().initProcess(); + buildProcessResponse(u, pr); + } }; } diff -r c35d0909a74e -r d907576aa299 capnproto/vamp.capnp --- a/capnproto/vamp.capnp Wed May 18 12:21:23 2016 +0100 +++ b/capnproto/vamp.capnp Wed May 18 13:54:33 2016 +0100 @@ -140,6 +140,10 @@ input @1 :ProcessInput; } +struct ProcessResponse { + features @0 :FeatureSet; +} + struct VampRequest { request :union { list @0 :Void; @@ -157,8 +161,8 @@ list @2 :List(PluginStaticData); load @3 :LoadResponse; configure @4 :ConfigurationResponse; - process @5 :FeatureSet; - finish @6 :FeatureSet; + process @5 :ProcessResponse; + finish @6 :ProcessResponse; } }