comparison vamp-capnp/VampnProto.h @ 95:b6ac26b72b59

Implement list, use request-response classes in loader
author Chris Cannam <c.cannam@qmul.ac.uk>
date Thu, 13 Oct 2016 14:31:10 +0100
parents 6429a99abcad
children 427c4c725085
comparison
equal deleted inserted replaced
94:a660dca988f8 95:b6ac26b72b59
494 c.stepSize = r.getStepSize(); 494 c.stepSize = r.getStepSize();
495 c.blockSize = r.getBlockSize(); 495 c.blockSize = r.getBlockSize();
496 } 496 }
497 497
498 static void 498 static void
499 readListResponse(Vamp::HostExt::ListResponse &lr,
500 const ListResponse::Reader &r) {
501
502 lr.available.clear();
503 auto pp = r.getAvailable();
504 for (const auto &p: pp) {
505 Vamp::HostExt::PluginStaticData psd;
506 readExtractorStaticData(psd, p);
507 lr.available.push_back(psd);
508 }
509 }
510
511 static void
499 buildLoadRequest(LoadRequest::Builder &r, 512 buildLoadRequest(LoadRequest::Builder &r,
500 const Vamp::HostExt::LoadRequest &req) { 513 const Vamp::HostExt::LoadRequest &req) {
501 514
502 r.setKey(req.pluginKey); 515 r.setKey(req.pluginKey);
503 r.setInputSampleRate(req.inputSampleRate); 516 r.setInputSampleRate(req.inputSampleRate);
900 readRpcResponse_List(Vamp::HostExt::ListResponse &resp, 913 readRpcResponse_List(Vamp::HostExt::ListResponse &resp,
901 const RpcResponse::Reader &r) { 914 const RpcResponse::Reader &r) {
902 if (getRequestResponseType(r) != RRType::List) { 915 if (getRequestResponseType(r) != RRType::List) {
903 throw std::logic_error("not a list response"); 916 throw std::logic_error("not a list response");
904 } 917 }
905 resp.available.clear(); 918 readListResponse(resp, r.getResponse().getList());
906 auto pp = r.getResponse().getList().getAvailable();
907 for (const auto &p: pp) {
908 Vamp::HostExt::PluginStaticData psd;
909 readExtractorStaticData(psd, p);
910 resp.available.push_back(psd);
911 }
912 } 919 }
913 920
914 static void 921 static void
915 readRpcRequest_Load(Vamp::HostExt::LoadRequest &req, 922 readRpcRequest_Load(Vamp::HostExt::LoadRequest &req,
916 const RpcRequest::Reader &r) { 923 const RpcRequest::Reader &r) {