Mercurial > hg > piper-cpp
comparison capnproto/VampnProto.h @ 64:85ec33975434
Support split OutputDescriptor, and plugins rather than pluginData in listResponse from SDK
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Fri, 23 Sep 2016 14:20:29 +0100 |
parents | 18951a1f1001 |
children | 6f160dee1192 |
comparison
equal
deleted
inserted
replaced
63:72c43bc69616 | 64:85ec33975434 |
---|---|
125 } | 125 } |
126 throw std::logic_error("unexpected Capnp SampleType enum value"); | 126 throw std::logic_error("unexpected Capnp SampleType enum value"); |
127 } | 127 } |
128 | 128 |
129 static void | 129 static void |
130 buildOutputDescriptor(OutputDescriptor::Builder &b, | 130 buildConfiguredOutputDescriptor(ConfiguredOutputDescriptor::Builder &b, |
131 const Vamp::Plugin::OutputDescriptor &od) { | 131 const Vamp::Plugin::OutputDescriptor &od) { |
132 | |
133 auto basic = b.initBasic(); | |
134 buildBasicDescriptor(basic, od); | |
135 | 132 |
136 b.setUnit(od.unit); | 133 b.setUnit(od.unit); |
137 | 134 |
138 b.setSampleType(fromSampleType(od.sampleType)); | 135 b.setSampleType(fromSampleType(od.sampleType)); |
139 b.setSampleRate(od.sampleRate); | 136 b.setSampleRate(od.sampleRate); |
160 b.setQuantizeStep(od.quantizeStep); | 157 b.setQuantizeStep(od.quantizeStep); |
161 } | 158 } |
162 } | 159 } |
163 | 160 |
164 static void | 161 static void |
165 readOutputDescriptor(Vamp::Plugin::OutputDescriptor &od, | 162 buildOutputDescriptor(OutputDescriptor::Builder &b, |
166 const OutputDescriptor::Reader &r) { | 163 const Vamp::Plugin::OutputDescriptor &od) { |
167 | 164 |
168 readBasicDescriptor(od, r.getBasic()); | 165 auto basic = b.initBasic(); |
166 buildBasicDescriptor(basic, od); | |
167 | |
168 auto configured = b.initConfigured(); | |
169 buildConfiguredOutputDescriptor(configured, od); | |
170 } | |
171 | |
172 static void | |
173 readConfiguredOutputDescriptor(Vamp::Plugin::OutputDescriptor &od, | |
174 const ConfiguredOutputDescriptor::Reader &r) { | |
169 | 175 |
170 od.unit = r.getUnit(); | 176 od.unit = r.getUnit(); |
171 | 177 |
172 od.sampleType = toSampleType(r.getSampleType()); | 178 od.sampleType = toSampleType(r.getSampleType()); |
173 od.sampleRate = r.getSampleRate(); | 179 od.sampleRate = r.getSampleRate(); |
190 | 196 |
191 od.isQuantized = r.getIsQuantized(); | 197 od.isQuantized = r.getIsQuantized(); |
192 if (od.isQuantized) { | 198 if (od.isQuantized) { |
193 od.quantizeStep = r.getQuantizeStep(); | 199 od.quantizeStep = r.getQuantizeStep(); |
194 } | 200 } |
201 } | |
202 | |
203 static void | |
204 readOutputDescriptor(Vamp::Plugin::OutputDescriptor &od, | |
205 const OutputDescriptor::Reader &r) { | |
206 | |
207 readBasicDescriptor(od, r.getBasic()); | |
208 readConfiguredOutputDescriptor(od, r.getConfigured()); | |
195 } | 209 } |
196 | 210 |
197 static void | 211 static void |
198 buildParameterDescriptor(ParameterDescriptor::Builder &b, | 212 buildParameterDescriptor(ParameterDescriptor::Builder &b, |
199 const Vamp::Plugin::ParameterDescriptor &pd) { | 213 const Vamp::Plugin::ParameterDescriptor &pd) { |
683 static void | 697 static void |
684 buildVampResponse_List(VampResponse::Builder &b, | 698 buildVampResponse_List(VampResponse::Builder &b, |
685 const Vamp::HostExt::ListResponse &resp) { | 699 const Vamp::HostExt::ListResponse &resp) { |
686 b.setSuccess(true); | 700 b.setSuccess(true); |
687 auto r = b.getResponse().initList(); | 701 auto r = b.getResponse().initList(); |
688 auto p = r.initPlugins(resp.pluginData.size()); | 702 auto p = r.initPlugins(resp.plugins.size()); |
689 for (size_t i = 0; i < resp.pluginData.size(); ++i) { | 703 for (size_t i = 0; i < resp.plugins.size(); ++i) { |
690 auto pd = p[i]; | 704 auto pd = p[i]; |
691 buildPluginStaticData(pd, resp.pluginData[i]); | 705 buildPluginStaticData(pd, resp.plugins[i]); |
692 } | 706 } |
693 } | 707 } |
694 | 708 |
695 static void | 709 static void |
696 buildVampRequest_Load(VampRequest::Builder &b, | 710 buildVampRequest_Load(VampRequest::Builder &b, |
842 readVampResponse_List(Vamp::HostExt::ListResponse &resp, | 856 readVampResponse_List(Vamp::HostExt::ListResponse &resp, |
843 const VampResponse::Reader &r) { | 857 const VampResponse::Reader &r) { |
844 if (getRequestResponseType(r) != RRType::List) { | 858 if (getRequestResponseType(r) != RRType::List) { |
845 throw std::logic_error("not a list response"); | 859 throw std::logic_error("not a list response"); |
846 } | 860 } |
847 resp.pluginData.clear(); | 861 resp.plugins.clear(); |
848 if (r.getSuccess()) { | 862 if (r.getSuccess()) { |
849 auto pp = r.getResponse().getList().getPlugins(); | 863 auto pp = r.getResponse().getList().getPlugins(); |
850 for (const auto &p: pp) { | 864 for (const auto &p: pp) { |
851 Vamp::HostExt::PluginStaticData psd; | 865 Vamp::HostExt::PluginStaticData psd; |
852 readPluginStaticData(psd, p); | 866 readPluginStaticData(psd, p); |
853 resp.pluginData.push_back(psd); | 867 resp.plugins.push_back(psd); |
854 } | 868 } |
855 } | 869 } |
856 } | 870 } |
857 | 871 |
858 static void | 872 static void |