Mercurial > hg > piper-cpp
comparison vamp-capnp/VampnProto.h @ 289:26027c3a99a0
Further wiring for ProgramParameters - should now be supported throughout
author | Chris Cannam <cannam@all-day-breakfast.com> |
---|---|
date | Wed, 08 Apr 2020 15:02:24 +0100 |
parents | 292ec9b50280 |
children |
comparison
equal
deleted
inserted
replaced
288:c9f63ca1914d | 289:26027c3a99a0 |
---|---|
532 c.currentProgram = r.getCurrentProgram(); | 532 c.currentProgram = r.getCurrentProgram(); |
533 c.channelCount = r.getChannelCount(); | 533 c.channelCount = r.getChannelCount(); |
534 c.framing.stepSize = r.getFraming().getStepSize(); | 534 c.framing.stepSize = r.getFraming().getStepSize(); |
535 c.framing.blockSize = r.getFraming().getBlockSize(); | 535 c.framing.blockSize = r.getFraming().getBlockSize(); |
536 } | 536 } |
537 | |
538 static void | |
539 buildProgramParameterMap(piper::LoadResponse::PPPair::Builder &b, | |
540 const PluginProgramParameters &pparams, | |
541 std::string program) { | |
542 b.setProgram(program); | |
543 if (pparams.programParameters.find(program) == | |
544 pparams.programParameters.end()) { | |
545 b.initParameters(0); | |
546 return; | |
547 } | |
548 auto params = b.initParameters | |
549 (unsigned(pparams.programParameters.at(program).size())); | |
550 int i = 0; | |
551 for (auto pv: pparams.programParameters.at(program)) { | |
552 params[i].setParameter(pv.first); | |
553 params[i].setValue(pv.second); | |
554 ++i; | |
555 } | |
556 } | |
557 | |
558 static void | |
559 readProgramParameterMap(PluginProgramParameters &pparams, | |
560 const piper::LoadResponse::PPPair::Reader &r) { | |
561 | |
562 auto program = r.getProgram(); | |
563 auto params = r.getParameters(); | |
564 for (auto pv: params) { | |
565 pparams.programParameters[program][pv.getParameter()] = pv.getValue(); | |
566 } | |
567 } | |
537 | 568 |
538 static void | 569 static void |
539 buildListRequest(piper::ListRequest::Builder &r, | 570 buildListRequest(piper::ListRequest::Builder &r, |
540 const ListRequest &resp) { | 571 const ListRequest &resp) { |
541 | 572 |
634 b.setHandle(pmapper.pluginToHandle(resp.plugin)); | 665 b.setHandle(pmapper.pluginToHandle(resp.plugin)); |
635 auto sd = b.initStaticData(); | 666 auto sd = b.initStaticData(); |
636 buildExtractorStaticData(sd, resp.staticData); | 667 buildExtractorStaticData(sd, resp.staticData); |
637 auto conf = b.initDefaultConfiguration(); | 668 auto conf = b.initDefaultConfiguration(); |
638 buildConfiguration(conf, resp.defaultConfiguration); | 669 buildConfiguration(conf, resp.defaultConfiguration); |
670 | |
671 auto pp = b.initProgramParameters | |
672 (unsigned(resp.programParameters.programParameters.size())); | |
673 | |
674 int i = 0; | |
675 for (auto prog: resp.programParameters.programParameters) { | |
676 auto pb = pp[i]; | |
677 buildProgramParameterMap(pb, resp.programParameters, prog.first); | |
678 ++i; | |
679 } | |
639 } | 680 } |
640 | 681 |
641 static void | 682 static void |
642 readLoadResponse(LoadResponse &resp, | 683 readLoadResponse(LoadResponse &resp, |
643 const piper::LoadResponse::Reader &r, | 684 const piper::LoadResponse::Reader &r, |
646 auto h = r.getHandle(); | 687 auto h = r.getHandle(); |
647 resp.plugin = pmapper.handleToPlugin(h); | 688 resp.plugin = pmapper.handleToPlugin(h); |
648 readExtractorStaticData(resp.staticData, r.getStaticData()); | 689 readExtractorStaticData(resp.staticData, r.getStaticData()); |
649 readConfiguration(resp.defaultConfiguration, | 690 readConfiguration(resp.defaultConfiguration, |
650 r.getDefaultConfiguration()); | 691 r.getDefaultConfiguration()); |
692 | |
693 for (auto pp: r.getProgramParameters()) { | |
694 readProgramParameterMap(resp.programParameters, pp); | |
695 } | |
651 } | 696 } |
652 | 697 |
653 static void | 698 static void |
654 buildConfigurationRequest(piper::ConfigurationRequest::Builder &b, | 699 buildConfigurationRequest(piper::ConfigurationRequest::Builder &b, |
655 const ConfigurationRequest &cr, | 700 const ConfigurationRequest &cr, |