comparison capnproto/VampnProto.h @ 58:c38e12d4bbdd

Merge from branch outputid-string-in-featureset
author Chris Cannam <c.cannam@qmul.ac.uk>
date Mon, 19 Sep 2016 14:48:43 +0100
parents 7aec704705c7
children 0ea374ea96a2
comparison
equal deleted inserted replaced
48:ce6cb3308bd7 58:c38e12d4bbdd
40 #include <vamp-hostsdk/Plugin.h> 40 #include <vamp-hostsdk/Plugin.h>
41 #include <vamp-hostsdk/PluginLoader.h> 41 #include <vamp-hostsdk/PluginLoader.h>
42 #include <vamp-hostsdk/PluginStaticData.h> 42 #include <vamp-hostsdk/PluginStaticData.h>
43 43
44 #include "bits/PluginHandleMapper.h" 44 #include "bits/PluginHandleMapper.h"
45 #include "bits/PluginOutputIdMapper.h"
45 #include "bits/RequestResponseType.h" 46 #include "bits/RequestResponseType.h"
46 47
47 namespace vampipe 48 namespace vampipe
48 { 49 {
49 50
292 } 293 }
293 } 294 }
294 295
295 static void 296 static void
296 buildFeatureSet(FeatureSet::Builder &b, 297 buildFeatureSet(FeatureSet::Builder &b,
297 const Vamp::Plugin::FeatureSet &fs) { 298 const Vamp::Plugin::FeatureSet &fs,
299 const PluginOutputIdMapper &omapper) {
298 300
299 auto featureset = b.initFeaturePairs(fs.size()); 301 auto featureset = b.initFeaturePairs(fs.size());
300 int ix = 0; 302 int ix = 0;
301 for (const auto &fsi : fs) { 303 for (const auto &fsi : fs) {
302 auto fspair = featureset[ix]; 304 auto fspair = featureset[ix];
303 fspair.setOutput(fsi.first); 305 fspair.setOutput(omapper.indexToId(fsi.first));
304 auto featurelist = fspair.initFeatures(fsi.second.size()); 306 auto featurelist = fspair.initFeatures(fsi.second.size());
305 for (size_t j = 0; j < fsi.second.size(); ++j) { 307 for (size_t j = 0; j < fsi.second.size(); ++j) {
306 auto feature = featurelist[j]; 308 auto feature = featurelist[j];
307 buildFeature(feature, fsi.second[j]); 309 buildFeature(feature, fsi.second[j]);
308 } 310 }
310 } 312 }
311 } 313 }
312 314
313 static void 315 static void
314 readFeatureSet(Vamp::Plugin::FeatureSet &fs, 316 readFeatureSet(Vamp::Plugin::FeatureSet &fs,
315 const FeatureSet::Reader &r) { 317 const FeatureSet::Reader &r,
318 const PluginOutputIdMapper &omapper) {
316 319
317 fs.clear(); 320 fs.clear();
318 auto pp = r.getFeaturePairs(); 321 auto pp = r.getFeaturePairs();
319 for (const auto &p: pp) { 322 for (const auto &p: pp) {
320 Vamp::Plugin::FeatureList vfl; 323 Vamp::Plugin::FeatureList vfl;
322 for (const auto &f: ff) { 325 for (const auto &f: ff) {
323 Vamp::Plugin::Feature vf; 326 Vamp::Plugin::Feature vf;
324 readFeature(vf, f); 327 readFeature(vf, f);
325 vfl.push_back(vf); 328 vfl.push_back(vf);
326 } 329 }
327 fs[p.getOutput()] = vfl; 330 fs[omapper.idToIndex(p.getOutput())] = vfl;
328 } 331 }
329 } 332 }
330 333
331 static InputDomain 334 static InputDomain
332 fromInputDomain(Vamp::Plugin::InputDomain d) { 335 fromInputDomain(Vamp::Plugin::InputDomain d) {
524 } 527 }
525 528
526 static void 529 static void
527 buildLoadResponse(LoadResponse::Builder &b, 530 buildLoadResponse(LoadResponse::Builder &b,
528 const Vamp::HostExt::LoadResponse &resp, 531 const Vamp::HostExt::LoadResponse &resp,
529 PluginHandleMapper &mapper) { 532 const PluginHandleMapper &pmapper) {
530 533
531 b.setPluginHandle(mapper.pluginToHandle(resp.plugin)); 534 b.setPluginHandle(pmapper.pluginToHandle(resp.plugin));
532 auto sd = b.initStaticData(); 535 auto sd = b.initStaticData();
533 buildPluginStaticData(sd, resp.staticData); 536 buildPluginStaticData(sd, resp.staticData);
534 auto conf = b.initDefaultConfiguration(); 537 auto conf = b.initDefaultConfiguration();
535 buildPluginConfiguration(conf, resp.defaultConfiguration); 538 buildPluginConfiguration(conf, resp.defaultConfiguration);
536 } 539 }
537 540
538 static void 541 static void
539 readLoadResponse(Vamp::HostExt::LoadResponse &resp, 542 readLoadResponse(Vamp::HostExt::LoadResponse &resp,
540 const LoadResponse::Reader &r, 543 const LoadResponse::Reader &r,
541 PluginHandleMapper &mapper) { 544 const PluginHandleMapper &pmapper) {
542 545
543 resp.plugin = mapper.handleToPlugin(r.getPluginHandle()); 546 resp.plugin = pmapper.handleToPlugin(r.getPluginHandle());
544 readPluginStaticData(resp.staticData, r.getStaticData()); 547 readPluginStaticData(resp.staticData, r.getStaticData());
545 readPluginConfiguration(resp.defaultConfiguration, 548 readPluginConfiguration(resp.defaultConfiguration,
546 r.getDefaultConfiguration()); 549 r.getDefaultConfiguration());
547 } 550 }
548 551
549 static void 552 static void
550 buildConfigurationRequest(ConfigurationRequest::Builder &b, 553 buildConfigurationRequest(ConfigurationRequest::Builder &b,
551 const Vamp::HostExt::ConfigurationRequest &cr, 554 const Vamp::HostExt::ConfigurationRequest &cr,
552 PluginHandleMapper &mapper) { 555 const PluginHandleMapper &pmapper) {
553 556
554 b.setPluginHandle(mapper.pluginToHandle(cr.plugin)); 557 b.setPluginHandle(pmapper.pluginToHandle(cr.plugin));
555 auto c = b.initConfiguration(); 558 auto c = b.initConfiguration();
556 buildPluginConfiguration(c, cr.configuration); 559 buildPluginConfiguration(c, cr.configuration);
557 } 560 }
558 561
559 static void 562 static void
560 readConfigurationRequest(Vamp::HostExt::ConfigurationRequest &cr, 563 readConfigurationRequest(Vamp::HostExt::ConfigurationRequest &cr,
561 const ConfigurationRequest::Reader &r, 564 const ConfigurationRequest::Reader &r,
562 PluginHandleMapper &mapper) { 565 const PluginHandleMapper &pmapper) {
563 566
564 auto h = r.getPluginHandle(); 567 auto h = r.getPluginHandle();
565 cr.plugin = mapper.handleToPlugin(h); 568 cr.plugin = pmapper.handleToPlugin(h);
566 auto c = r.getConfiguration(); 569 auto c = r.getConfiguration();
567 readPluginConfiguration(cr.configuration, c); 570 readPluginConfiguration(cr.configuration, c);
568 } 571 }
569 572
570 static void 573 static void
571 buildConfigurationResponse(ConfigurationResponse::Builder &b, 574 buildConfigurationResponse(ConfigurationResponse::Builder &b,
572 const Vamp::HostExt::ConfigurationResponse &cr) { 575 const Vamp::HostExt::ConfigurationResponse &cr,
573 576 const PluginHandleMapper &pmapper) {
577
578 b.setPluginHandle(pmapper.pluginToHandle(cr.plugin));
574 auto olist = b.initOutputs(cr.outputs.size()); 579 auto olist = b.initOutputs(cr.outputs.size());
575 for (size_t i = 0; i < cr.outputs.size(); ++i) { 580 for (size_t i = 0; i < cr.outputs.size(); ++i) {
576 auto od = olist[i]; 581 auto od = olist[i];
577 buildOutputDescriptor(od, cr.outputs[i]); 582 buildOutputDescriptor(od, cr.outputs[i]);
578 } 583 }
579 } 584 }
580 585
581 static void 586 static void
582 readConfigurationResponse(Vamp::HostExt::ConfigurationResponse &cr, 587 readConfigurationResponse(Vamp::HostExt::ConfigurationResponse &cr,
583 const ConfigurationResponse::Reader &r) { 588 const ConfigurationResponse::Reader &r,
584 589 const PluginHandleMapper &pmapper) {
590
591 cr.plugin = pmapper.handleToPlugin(r.getPluginHandle());
585 cr.outputs.clear(); 592 cr.outputs.clear();
586 auto oo = r.getOutputs(); 593 auto oo = r.getOutputs();
587 for (const auto &o: oo) { 594 for (const auto &o: oo) {
588 Vamp::Plugin::OutputDescriptor desc; 595 Vamp::Plugin::OutputDescriptor desc;
589 readOutputDescriptor(desc, o); 596 readOutputDescriptor(desc, o);
627 } 634 }
628 635
629 static void 636 static void
630 buildProcessRequest(ProcessRequest::Builder &b, 637 buildProcessRequest(ProcessRequest::Builder &b,
631 const Vamp::HostExt::ProcessRequest &pr, 638 const Vamp::HostExt::ProcessRequest &pr,
632 PluginHandleMapper &mapper) { 639 const PluginHandleMapper &pmapper) {
633 640
634 b.setPluginHandle(mapper.pluginToHandle(pr.plugin)); 641 b.setPluginHandle(pmapper.pluginToHandle(pr.plugin));
635 auto input = b.initInput(); 642 auto input = b.initInput();
636 buildProcessInput(input, pr.timestamp, pr.inputBuffers); 643 buildProcessInput(input, pr.timestamp, pr.inputBuffers);
637 } 644 }
638 645
639 static void 646 static void
640 readProcessRequest(Vamp::HostExt::ProcessRequest &pr, 647 readProcessRequest(Vamp::HostExt::ProcessRequest &pr,
641 const ProcessRequest::Reader &r, 648 const ProcessRequest::Reader &r,
642 PluginHandleMapper &mapper) { 649 const PluginHandleMapper &pmapper) {
643 650
644 auto h = r.getPluginHandle(); 651 auto h = r.getPluginHandle();
645 pr.plugin = mapper.handleToPlugin(h); 652 pr.plugin = pmapper.handleToPlugin(h);
646 readProcessInput(pr.timestamp, pr.inputBuffers, r.getInput()); 653 readProcessInput(pr.timestamp, pr.inputBuffers, r.getInput());
647 } 654 }
648 655
649 static void 656 static void
650 buildProcessResponse(ProcessResponse::Builder &b, 657 buildProcessResponse(ProcessResponse::Builder &b,
651 const Vamp::HostExt::ProcessResponse &pr) { 658 const Vamp::HostExt::ProcessResponse &pr,
652 659 const PluginHandleMapper &pmapper) {
660
661 b.setPluginHandle(pmapper.pluginToHandle(pr.plugin));
653 auto f = b.initFeatures(); 662 auto f = b.initFeatures();
654 buildFeatureSet(f, pr.features); 663 buildFeatureSet(f, pr.features,
664 *pmapper.pluginToOutputIdMapper(pr.plugin));
655 } 665 }
656 666
657 static void 667 static void
658 readProcessResponse(Vamp::HostExt::ProcessResponse &pr, 668 readProcessResponse(Vamp::HostExt::ProcessResponse &pr,
659 const ProcessResponse::Reader &r) { 669 const ProcessResponse::Reader &r,
660 670 const PluginHandleMapper &pmapper) {
661 readFeatureSet(pr.features, r.getFeatures()); 671
672 auto h = r.getPluginHandle();
673 pr.plugin = pmapper.handleToPlugin(h);
674 readFeatureSet(pr.features, r.getFeatures(),
675 *pmapper.handleToOutputIdMapper(r.getPluginHandle()));
662 } 676 }
663 677
664 static void 678 static void
665 buildVampRequest_List(VampRequest::Builder &b) { 679 buildVampRequest_List(VampRequest::Builder &b) {
666 b.getRequest().setList(); 680 b.getRequest().setList();
667 } 681 }
668 682
669 static void 683 static void
670 buildVampResponse_List(VampResponse::Builder &b, 684 buildVampResponse_List(VampResponse::Builder &b,
671 std::string errorText, 685 const Vamp::HostExt::ListResponse &resp) {
672 const std::vector<Vamp::HostExt::PluginStaticData> &d) { 686 b.setSuccess(true);
673 b.setSuccess(errorText == "");
674 b.setErrorText(errorText);
675 auto r = b.getResponse().initList(); 687 auto r = b.getResponse().initList();
676 auto p = r.initPlugins(d.size()); 688 auto p = r.initPlugins(resp.pluginData.size());
677 for (size_t i = 0; i < d.size(); ++i) { 689 for (size_t i = 0; i < resp.pluginData.size(); ++i) {
678 auto pd = p[i]; 690 auto pd = p[i];
679 buildPluginStaticData(pd, d[i]); 691 buildPluginStaticData(pd, resp.pluginData[i]);
680 } 692 }
681 } 693 }
682 694
683 static void 695 static void
684 buildVampRequest_Load(VampRequest::Builder &b, 696 buildVampRequest_Load(VampRequest::Builder &b,
688 } 700 }
689 701
690 static void 702 static void
691 buildVampResponse_Load(VampResponse::Builder &b, 703 buildVampResponse_Load(VampResponse::Builder &b,
692 const Vamp::HostExt::LoadResponse &resp, 704 const Vamp::HostExt::LoadResponse &resp,
693 PluginHandleMapper &mapper) { 705 const PluginHandleMapper &pmapper) {
694 b.setSuccess(resp.plugin != 0); 706 b.setSuccess(resp.plugin != 0);
695 b.setErrorText("");
696 auto u = b.getResponse().initLoad(); 707 auto u = b.getResponse().initLoad();
697 buildLoadResponse(u, resp, mapper); 708 buildLoadResponse(u, resp, pmapper);
698 } 709 }
699 710
700 static void 711 static void
701 buildVampRequest_Configure(VampRequest::Builder &b, 712 buildVampRequest_Configure(VampRequest::Builder &b,
702 const Vamp::HostExt::ConfigurationRequest &cr, 713 const Vamp::HostExt::ConfigurationRequest &cr,
703 PluginHandleMapper &mapper) { 714 const PluginHandleMapper &pmapper) {
704 auto u = b.getRequest().initConfigure(); 715 auto u = b.getRequest().initConfigure();
705 buildConfigurationRequest(u, cr, mapper); 716 buildConfigurationRequest(u, cr, pmapper);
706 } 717 }
707 718
708 static void 719 static void
709 buildVampResponse_Configure(VampResponse::Builder &b, 720 buildVampResponse_Configure(VampResponse::Builder &b,
710 const Vamp::HostExt::ConfigurationResponse &cr) { 721 const Vamp::HostExt::ConfigurationResponse &cr,
722 const PluginHandleMapper &pmapper) {
711 b.setSuccess(!cr.outputs.empty()); 723 b.setSuccess(!cr.outputs.empty());
712 b.setErrorText("");
713 auto u = b.getResponse().initConfigure(); 724 auto u = b.getResponse().initConfigure();
714 buildConfigurationResponse(u, cr); 725 buildConfigurationResponse(u, cr, pmapper);
715 } 726 }
716 727
717 static void 728 static void
718 buildVampRequest_Process(VampRequest::Builder &b, 729 buildVampRequest_Process(VampRequest::Builder &b,
719 const Vamp::HostExt::ProcessRequest &pr, 730 const Vamp::HostExt::ProcessRequest &pr,
720 PluginHandleMapper &mapper) { 731 const PluginHandleMapper &pmapper) {
721 auto u = b.getRequest().initProcess(); 732 auto u = b.getRequest().initProcess();
722 buildProcessRequest(u, pr, mapper); 733 buildProcessRequest(u, pr, pmapper);
723 } 734 }
724 735
725 static void 736 static void
726 buildVampResponse_Process(VampResponse::Builder &b, 737 buildVampResponse_Process(VampResponse::Builder &b,
727 const Vamp::HostExt::ProcessResponse &pr) { 738 const Vamp::HostExt::ProcessResponse &pr,
739 const PluginHandleMapper &pmapper) {
728 b.setSuccess(true); 740 b.setSuccess(true);
729 b.setErrorText("");
730 auto u = b.getResponse().initProcess(); 741 auto u = b.getResponse().initProcess();
731 buildProcessResponse(u, pr); 742 buildProcessResponse(u, pr, pmapper);
732 } 743 }
733 744
734 static void 745 static void
735 buildVampRequest_Finish(VampRequest::Builder &b, 746 buildVampRequest_Finish(VampRequest::Builder &b,
736 Vamp::Plugin *p, 747 const Vamp::HostExt::FinishRequest &req,
737 PluginHandleMapper &mapper) { 748 const PluginHandleMapper &pmapper) {
738 749
739 auto u = b.getRequest().initFinish(); 750 auto u = b.getRequest().initFinish();
740 u.setPluginHandle(mapper.pluginToHandle(p)); 751 u.setPluginHandle(pmapper.pluginToHandle(req.plugin));
741 } 752 }
742 753
743 static void 754 static void
744 buildVampResponse_Finish(VampResponse::Builder &b, 755 buildVampResponse_Finish(VampResponse::Builder &b,
745 const Vamp::HostExt::ProcessResponse &pr) { 756 const Vamp::HostExt::ProcessResponse &pr,
746 757 const PluginHandleMapper &pmapper) {
747 buildVampResponse_Process(b, pr); 758
748 } 759 buildVampResponse_Process(b, pr, pmapper);
749 760 }
761
762 static void
763 buildVampResponse_Error(VampResponse::Builder &b,
764 const std::string &errorText,
765 RRType responseType)
766 {
767 std::string type;
768
769 if (responseType == RRType::List) {
770 type = "list";
771 b.getResponse().initList();
772 } else if (responseType == RRType::Load) {
773 type = "load";
774 b.getResponse().initLoad();
775 } else if (responseType == RRType::Configure) {
776 type = "configure";
777 b.getResponse().initConfigure();
778 } else if (responseType == RRType::Process) {
779 type = "process";
780 b.getResponse().initProcess();
781 } else if (responseType == RRType::Finish) {
782 type = "finish";
783 b.getResponse().initFinish();
784 } else {
785 type = "invalid";
786 }
787
788 b.setSuccess(false);
789 b.setErrorText(std::string("error in ") + type + " request: " + errorText);
790 }
791
792 static void
793 buildVampResponse_Exception(VampResponse::Builder &b,
794 const std::exception &e,
795 RRType responseType)
796 {
797 return buildVampResponse_Error(b, e.what(), responseType);
798 }
799
750 static RRType 800 static RRType
751 getRequestResponseType(const VampRequest::Reader &r) { 801 getRequestResponseType(const VampRequest::Reader &r) {
752 switch (r.getRequest().which()) { 802 switch (r.getRequest().which()) {
753 case VampRequest::Request::Which::LIST: 803 case VampRequest::Request::Which::LIST:
754 return RRType::List; 804 return RRType::List;
787 throw std::logic_error("not a list request"); 837 throw std::logic_error("not a list request");
788 } 838 }
789 } 839 }
790 840
791 static void 841 static void
792 readVampResponse_List(std::vector<Vamp::HostExt::PluginStaticData> &v, 842 readVampResponse_List(Vamp::HostExt::ListResponse &resp,
793 const VampResponse::Reader &r) { 843 const VampResponse::Reader &r) {
794 if (getRequestResponseType(r) != RRType::List) { 844 if (getRequestResponseType(r) != RRType::List) {
795 throw std::logic_error("not a list response"); 845 throw std::logic_error("not a list response");
796 } 846 }
797 v.clear(); 847 resp.pluginData.clear();
798 if (r.getSuccess()) { 848 if (r.getSuccess()) {
799 auto pp = r.getResponse().getList().getPlugins(); 849 auto pp = r.getResponse().getList().getPlugins();
800 for (const auto &p: pp) { 850 for (const auto &p: pp) {
801 Vamp::HostExt::PluginStaticData psd; 851 Vamp::HostExt::PluginStaticData psd;
802 readPluginStaticData(psd, p); 852 readPluginStaticData(psd, p);
803 v.push_back(psd); 853 resp.pluginData.push_back(psd);
804 } 854 }
805 } 855 }
806 } 856 }
807 857
808 static void 858 static void
815 } 865 }
816 866
817 static void 867 static void
818 readVampResponse_Load(Vamp::HostExt::LoadResponse &resp, 868 readVampResponse_Load(Vamp::HostExt::LoadResponse &resp,
819 const VampResponse::Reader &r, 869 const VampResponse::Reader &r,
820 PluginHandleMapper &mapper) { 870 const PluginHandleMapper &pmapper) {
821 if (getRequestResponseType(r) != RRType::Load) { 871 if (getRequestResponseType(r) != RRType::Load) {
822 throw std::logic_error("not a load response"); 872 throw std::logic_error("not a load response");
823 } 873 }
824 resp = {}; 874 resp = {};
825 if (r.getSuccess()) { 875 if (r.getSuccess()) {
826 readLoadResponse(resp, r.getResponse().getLoad(), mapper); 876 readLoadResponse(resp, r.getResponse().getLoad(), pmapper);
827 } 877 }
828 } 878 }
829 879
830 static void 880 static void
831 readVampRequest_Configure(Vamp::HostExt::ConfigurationRequest &req, 881 readVampRequest_Configure(Vamp::HostExt::ConfigurationRequest &req,
832 const VampRequest::Reader &r, 882 const VampRequest::Reader &r,
833 PluginHandleMapper &mapper) { 883 const PluginHandleMapper &pmapper) {
834 if (getRequestResponseType(r) != RRType::Configure) { 884 if (getRequestResponseType(r) != RRType::Configure) {
835 throw std::logic_error("not a configuration request"); 885 throw std::logic_error("not a configuration request");
836 } 886 }
837 readConfigurationRequest(req, r.getRequest().getConfigure(), mapper); 887 readConfigurationRequest(req, r.getRequest().getConfigure(), pmapper);
838 } 888 }
839 889
840 static void 890 static void
841 readVampResponse_Configure(Vamp::HostExt::ConfigurationResponse &resp, 891 readVampResponse_Configure(Vamp::HostExt::ConfigurationResponse &resp,
842 const VampResponse::Reader &r) { 892 const VampResponse::Reader &r,
893 const PluginHandleMapper &pmapper) {
843 if (getRequestResponseType(r) != RRType::Configure) { 894 if (getRequestResponseType(r) != RRType::Configure) {
844 throw std::logic_error("not a configuration response"); 895 throw std::logic_error("not a configuration response");
845 } 896 }
846 resp = {}; 897 resp = {};
847 if (r.getSuccess()) { 898 if (r.getSuccess()) {
848 readConfigurationResponse(resp, r.getResponse().getConfigure()); 899 readConfigurationResponse(resp,
900 r.getResponse().getConfigure(),
901 pmapper);
849 } 902 }
850 } 903 }
851 904
852 static void 905 static void
853 readVampRequest_Process(Vamp::HostExt::ProcessRequest &req, 906 readVampRequest_Process(Vamp::HostExt::ProcessRequest &req,
854 const VampRequest::Reader &r, 907 const VampRequest::Reader &r,
855 PluginHandleMapper &mapper) { 908 const PluginHandleMapper &pmapper) {
856 if (getRequestResponseType(r) != RRType::Process) { 909 if (getRequestResponseType(r) != RRType::Process) {
857 throw std::logic_error("not a process request"); 910 throw std::logic_error("not a process request");
858 } 911 }
859 readProcessRequest(req, r.getRequest().getProcess(), mapper); 912 readProcessRequest(req, r.getRequest().getProcess(), pmapper);
860 } 913 }
861 914
862 static void 915 static void
863 readVampResponse_Process(Vamp::HostExt::ProcessResponse &resp, 916 readVampResponse_Process(Vamp::HostExt::ProcessResponse &resp,
864 const VampResponse::Reader &r) { 917 const VampResponse::Reader &r,
918 const PluginHandleMapper &pmapper) {
865 if (getRequestResponseType(r) != RRType::Process) { 919 if (getRequestResponseType(r) != RRType::Process) {
866 throw std::logic_error("not a process response"); 920 throw std::logic_error("not a process response");
867 } 921 }
868 resp = {}; 922 resp = {};
869 if (r.getSuccess()) { 923 if (r.getSuccess()) {
870 readProcessResponse(resp, r.getResponse().getProcess()); 924 readProcessResponse(resp, r.getResponse().getProcess(), pmapper);
871 } 925 }
872 } 926 }
873 927
874 static void 928 static void
875 readVampRequest_Finish(Vamp::Plugin *&finishPlugin, 929 readVampRequest_Finish(Vamp::HostExt::FinishRequest &req,
876 const VampRequest::Reader &r, 930 const VampRequest::Reader &r,
877 PluginHandleMapper &mapper) { 931 const PluginHandleMapper &pmapper) {
878 if (getRequestResponseType(r) != RRType::Finish) { 932 if (getRequestResponseType(r) != RRType::Finish) {
879 throw std::logic_error("not a finish request"); 933 throw std::logic_error("not a finish request");
880 } 934 }
881 finishPlugin = mapper.handleToPlugin 935 req.plugin = pmapper.handleToPlugin
882 (r.getRequest().getFinish().getPluginHandle()); 936 (r.getRequest().getFinish().getPluginHandle());
883 } 937 }
884 938
885 static void 939 static void
886 readVampResponse_Finish(Vamp::HostExt::ProcessResponse &resp, 940 readVampResponse_Finish(Vamp::HostExt::ProcessResponse &resp,
887 const VampResponse::Reader &r) { 941 const VampResponse::Reader &r,
942 const PluginHandleMapper &pmapper) {
888 if (getRequestResponseType(r) != RRType::Finish) { 943 if (getRequestResponseType(r) != RRType::Finish) {
889 throw std::logic_error("not a finish response"); 944 throw std::logic_error("not a finish response");
890 } 945 }
891 resp = {}; 946 resp = {};
892 if (r.getSuccess()) { 947 if (r.getSuccess()) {
893 readProcessResponse(resp, r.getResponse().getFinish()); 948 readProcessResponse(resp, r.getResponse().getFinish(), pmapper);
894 } 949 }
895 } 950 }
896 }; 951 };
897 952
898 } 953 }