comparison capnproto/VampnProto.h @ 15:d907576aa299

More requests/responses
author Chris Cannam <c.cannam@qmul.ac.uk>
date Wed, 18 May 2016 13:54:33 +0100
parents c35d0909a74e
children 3ef01276e15e
comparison
equal deleted inserted replaced
14:c35d0909a74e 15:d907576aa299
599 pr.plugin = mapper.handleToPlugin(h); 599 pr.plugin = mapper.handleToPlugin(h);
600 readProcessInput(pr.timestamp, pr.inputBuffers, r.getInput()); 600 readProcessInput(pr.timestamp, pr.inputBuffers, r.getInput());
601 } 601 }
602 602
603 static void 603 static void
604 buildVampListRequest(VampRequest::Builder &b) { 604 buildProcessResponse(ProcessResponse::Builder &b,
605 const Vamp::HostExt::ProcessResponse &pr) {
606
607 auto f = b.initFeatures();
608 buildFeatureSet(f, pr.features);
609 }
610
611 static void
612 readProcessResponse(Vamp::HostExt::ProcessResponse &pr,
613 const ProcessResponse::Reader &r) {
614
615 readFeatureSet(pr.features, r.getFeatures());
616 }
617
618 static void
619 buildVampRequest_List(VampRequest::Builder &b) {
605 b.getRequest().setList(); 620 b.getRequest().setList();
606 } 621 }
607 622
608 static void 623 static void
609 buildVampLoadRequest(VampRequest::Builder &b, 624 buildVampResponse_List(VampResponse::Builder &b,
610 const Vamp::HostExt::LoadRequest &req) { 625 const std::vector<Vamp::HostExt::PluginStaticData> &d,
626 std::string errorText = "") {
627 b.setSuccess(errorText == "");
628 b.setErrorText(errorText);
629 auto r = b.getResponse().initList(d.size());
630 for (size_t i = 0; i < d.size(); ++i) {
631 auto rd = r[i];
632 buildPluginStaticData(rd, d[i]);
633 }
634 }
635
636 static void
637 buildVampRequest_Load(VampRequest::Builder &b,
638 const Vamp::HostExt::LoadRequest &req) {
611 auto u = b.getRequest().initLoad(); 639 auto u = b.getRequest().initLoad();
612 buildLoadRequest(u, req); 640 buildLoadRequest(u, req);
613 } 641 }
614 642
615 static void 643 static void
616 buildVampConfigureRequest(VampRequest::Builder &b, 644 buildVampResponse_Load(VampResponse::Builder &b,
617 const Vamp::HostExt::ConfigurationRequest &cr, 645 const Vamp::HostExt::LoadResponse &resp,
618 PluginHandleMapper &mapper) { 646 PluginHandleMapper &mapper) {
647 auto u = b.getResponse().initLoad();
648 buildLoadResponse(u, resp, mapper);
649 }
650
651 static void
652 buildVampRequest_Configure(VampRequest::Builder &b,
653 const Vamp::HostExt::ConfigurationRequest &cr,
654 PluginHandleMapper &mapper) {
619 auto u = b.getRequest().initConfigure(); 655 auto u = b.getRequest().initConfigure();
620 buildConfigurationRequest(u, cr, mapper); 656 buildConfigurationRequest(u, cr, mapper);
621 } 657 }
622 658
623 static void 659 static void
624 buildVampProcessRequest(VampRequest::Builder &b, 660 buildVampResponse_Configure(VampResponse::Builder &b,
625 const Vamp::HostExt::ProcessRequest &pr, 661 const Vamp::HostExt::ConfigurationResponse &cr) {
626 PluginHandleMapper &mapper) { 662 auto u = b.getResponse().initConfigure();
663 buildConfigurationResponse(u, cr);
664 }
665
666 static void
667 buildVampRequest_Process(VampRequest::Builder &b,
668 const Vamp::HostExt::ProcessRequest &pr,
669 PluginHandleMapper &mapper) {
627 auto u = b.getRequest().initProcess(); 670 auto u = b.getRequest().initProcess();
628 buildProcessRequest(u, pr, mapper); 671 buildProcessRequest(u, pr, mapper);
629 } 672 }
630 673
631 674 static void
632 //...!!! and responses 675 buildVampResponse_Process(VampResponse::Builder &b,
676 const Vamp::HostExt::ProcessResponse &pr) {
677 auto u = b.getResponse().initProcess();
678 buildProcessResponse(u, pr);
679 }
633 }; 680 };
634 681
635 } 682 }
636 683
637 684