Mercurial > hg > piper-cpp
comparison capnproto/VampnProto.h @ 28:b5005ebc5116
Be sure not to get any unnecessary lookups -- I think this is probably redundant but at least it's explicit
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Tue, 24 May 2016 14:09:54 +0100 |
parents | cc85c2851605 |
children | f3f7561233d6 |
comparison
equal
deleted
inserted
replaced
27:cc85c2851605 | 28:b5005ebc5116 |
---|---|
174 | 174 |
175 od.hasFixedBinCount = r.getHasFixedBinCount(); | 175 od.hasFixedBinCount = r.getHasFixedBinCount(); |
176 if (od.hasFixedBinCount) { | 176 if (od.hasFixedBinCount) { |
177 od.binCount = r.getBinCount(); | 177 od.binCount = r.getBinCount(); |
178 od.binNames.clear(); | 178 od.binNames.clear(); |
179 for (const auto &n: r.getBinNames()) { | 179 auto nn = r.getBinNames(); |
180 for (const auto &n: nn) { | |
180 od.binNames.push_back(n); | 181 od.binNames.push_back(n); |
181 } | 182 } |
182 } | 183 } |
183 | 184 |
184 od.hasKnownExtents = r.getHasKnownExtents(); | 185 od.hasKnownExtents = r.getHasKnownExtents(); |
234 if (pd.isQuantized) { | 235 if (pd.isQuantized) { |
235 pd.quantizeStep = r.getQuantizeStep(); | 236 pd.quantizeStep = r.getQuantizeStep(); |
236 } | 237 } |
237 | 238 |
238 pd.valueNames.clear(); | 239 pd.valueNames.clear(); |
239 for (const auto &n: r.getValueNames()) { | 240 auto nn = r.getValueNames(); |
241 for (const auto &n: nn) { | |
240 pd.valueNames.push_back(n); | 242 pd.valueNames.push_back(n); |
241 } | 243 } |
242 } | 244 } |
243 | 245 |
244 static void | 246 static void |
282 } | 284 } |
283 | 285 |
284 f.label = r.getLabel(); | 286 f.label = r.getLabel(); |
285 | 287 |
286 f.values.clear(); | 288 f.values.clear(); |
287 for (auto v: r.getValues()) { | 289 auto vv = r.getValues(); |
290 for (auto v: vv) { | |
288 f.values.push_back(v); | 291 f.values.push_back(v); |
289 } | 292 } |
290 } | 293 } |
291 | 294 |
292 static void | 295 static void |
310 static void | 313 static void |
311 readFeatureSet(Vamp::Plugin::FeatureSet &fs, | 314 readFeatureSet(Vamp::Plugin::FeatureSet &fs, |
312 const FeatureSet::Reader &r) { | 315 const FeatureSet::Reader &r) { |
313 | 316 |
314 fs.clear(); | 317 fs.clear(); |
315 for (const auto &p: r.getFeaturePairs()) { | 318 auto pp = r.getFeaturePairs(); |
319 for (const auto &p: pp) { | |
316 Vamp::Plugin::FeatureList vfl; | 320 Vamp::Plugin::FeatureList vfl; |
317 for (const auto &f: p.getFeatures()) { | 321 auto ff = p.getFeatures(); |
322 for (const auto &f: ff) { | |
318 Vamp::Plugin::Feature vf; | 323 Vamp::Plugin::Feature vf; |
319 readFeature(vf, f); | 324 readFeature(vf, f); |
320 vfl.push_back(vf); | 325 vfl.push_back(vf); |
321 } | 326 } |
322 fs[p.getOutput()] = vfl; | 327 fs[p.getOutput()] = vfl; |
402 d.maker = r.getMaker(); | 407 d.maker = r.getMaker(); |
403 d.copyright = r.getCopyright(); | 408 d.copyright = r.getCopyright(); |
404 d.pluginVersion = r.getPluginVersion(); | 409 d.pluginVersion = r.getPluginVersion(); |
405 | 410 |
406 d.category.clear(); | 411 d.category.clear(); |
407 for (auto c: r.getCategory()) { | 412 auto cc = r.getCategory(); |
413 for (auto c: cc) { | |
408 d.category.push_back(c); | 414 d.category.push_back(c); |
409 } | 415 } |
410 | 416 |
411 d.minChannelCount = r.getMinChannelCount(); | 417 d.minChannelCount = r.getMinChannelCount(); |
412 d.maxChannelCount = r.getMaxChannelCount(); | 418 d.maxChannelCount = r.getMaxChannelCount(); |
413 | 419 |
414 d.parameters.clear(); | 420 d.parameters.clear(); |
415 for (auto p: r.getParameters()) { | 421 auto pp = r.getParameters(); |
422 for (auto p: pp) { | |
416 Vamp::Plugin::ParameterDescriptor pd; | 423 Vamp::Plugin::ParameterDescriptor pd; |
417 readParameterDescriptor(pd, p); | 424 readParameterDescriptor(pd, p); |
418 d.parameters.push_back(pd); | 425 d.parameters.push_back(pd); |
419 } | 426 } |
420 | 427 |
421 d.programs.clear(); | 428 d.programs.clear(); |
422 for (auto p: r.getPrograms()) { | 429 auto prp = r.getPrograms(); |
430 for (auto p: prp) { | |
423 d.programs.push_back(p); | 431 d.programs.push_back(p); |
424 } | 432 } |
425 | 433 |
426 d.inputDomain = toInputDomain(r.getInputDomain()); | 434 d.inputDomain = toInputDomain(r.getInputDomain()); |
427 | 435 |
428 d.basicOutputInfo.clear(); | 436 d.basicOutputInfo.clear(); |
429 for (auto o: r.getBasicOutputInfo()) { | 437 auto oo = r.getBasicOutputInfo(); |
438 for (auto o: oo) { | |
430 Vamp::HostExt::PluginStaticData::Basic b; | 439 Vamp::HostExt::PluginStaticData::Basic b; |
431 readBasicDescriptor(b, o); | 440 readBasicDescriptor(b, o); |
432 d.basicOutputInfo.push_back(b); | 441 d.basicOutputInfo.push_back(b); |
433 } | 442 } |
434 } | 443 } |
454 | 463 |
455 static void | 464 static void |
456 readPluginConfiguration(Vamp::HostExt::PluginConfiguration &c, | 465 readPluginConfiguration(Vamp::HostExt::PluginConfiguration &c, |
457 const PluginConfiguration::Reader &r) { | 466 const PluginConfiguration::Reader &r) { |
458 | 467 |
459 for (const auto &pp: r.getParameterValues()) { | 468 auto pp = r.getParameterValues(); |
460 c.parameterValues[pp.getParameter()] = pp.getValue(); | 469 for (const auto &p: pp) { |
470 c.parameterValues[p.getParameter()] = p.getValue(); | |
461 } | 471 } |
462 | 472 |
463 c.currentProgram = r.getCurrentProgram(); | 473 c.currentProgram = r.getCurrentProgram(); |
464 c.channelCount = r.getChannelCount(); | 474 c.channelCount = r.getChannelCount(); |
465 c.stepSize = r.getStepSize(); | 475 c.stepSize = r.getStepSize(); |
496 | 506 |
497 req.pluginKey = r.getPluginKey(); | 507 req.pluginKey = r.getPluginKey(); |
498 req.inputSampleRate = r.getInputSampleRate(); | 508 req.inputSampleRate = r.getInputSampleRate(); |
499 | 509 |
500 int flags = 0; | 510 int flags = 0; |
501 for (const auto &a: r.getAdapterFlags()) { | 511 auto aa = r.getAdapterFlags(); |
512 for (auto a: aa) { | |
502 if (a == AdapterFlag::ADAPT_INPUT_DOMAIN) { | 513 if (a == AdapterFlag::ADAPT_INPUT_DOMAIN) { |
503 flags |= Vamp::HostExt::PluginLoader::ADAPT_INPUT_DOMAIN; | 514 flags |= Vamp::HostExt::PluginLoader::ADAPT_INPUT_DOMAIN; |
504 } | 515 } |
505 if (a == AdapterFlag::ADAPT_CHANNEL_COUNT) { | 516 if (a == AdapterFlag::ADAPT_CHANNEL_COUNT) { |
506 flags |= Vamp::HostExt::PluginLoader::ADAPT_CHANNEL_COUNT; | 517 flags |= Vamp::HostExt::PluginLoader::ADAPT_CHANNEL_COUNT; |
570 static void | 581 static void |
571 readConfigurationResponse(Vamp::HostExt::ConfigurationResponse &cr, | 582 readConfigurationResponse(Vamp::HostExt::ConfigurationResponse &cr, |
572 const ConfigurationResponse::Reader &r) { | 583 const ConfigurationResponse::Reader &r) { |
573 | 584 |
574 cr.outputs.clear(); | 585 cr.outputs.clear(); |
575 for (const auto &o: r.getOutputs()) { | 586 auto oo = r.getOutputs(); |
587 for (const auto &o: oo) { | |
576 Vamp::Plugin::OutputDescriptor desc; | 588 Vamp::Plugin::OutputDescriptor desc; |
577 readOutputDescriptor(desc, o); | 589 readOutputDescriptor(desc, o); |
578 cr.outputs.push_back(desc); | 590 cr.outputs.push_back(desc); |
579 } | 591 } |
580 } | 592 } |
602 std::vector<std::vector<float> > &buffers, | 614 std::vector<std::vector<float> > &buffers, |
603 const ProcessInput::Reader &b) { | 615 const ProcessInput::Reader &b) { |
604 | 616 |
605 readRealTime(timestamp, b.getTimestamp()); | 617 readRealTime(timestamp, b.getTimestamp()); |
606 buffers.clear(); | 618 buffers.clear(); |
607 for (const auto &v: b.getInputBuffers()) { | 619 auto vv = b.getInputBuffers(); |
620 for (const auto &v: vv) { | |
608 std::vector<float> buf; | 621 std::vector<float> buf; |
609 for (auto x: v) { | 622 for (auto x: v) { |
610 buf.push_back(x); | 623 buf.push_back(x); |
611 } | 624 } |
612 buffers.push_back(buf); | 625 buffers.push_back(buf); |
781 if (getRequestResponseType(r) != RRType::List) { | 794 if (getRequestResponseType(r) != RRType::List) { |
782 throw std::logic_error("not a list response"); | 795 throw std::logic_error("not a list response"); |
783 } | 796 } |
784 v.clear(); | 797 v.clear(); |
785 if (r.getSuccess()) { | 798 if (r.getSuccess()) { |
786 for (const auto &p: r.getResponse().getList().getPlugins()) { | 799 auto pp = r.getResponse().getList().getPlugins(); |
800 for (const auto &p: pp) { | |
787 Vamp::HostExt::PluginStaticData psd; | 801 Vamp::HostExt::PluginStaticData psd; |
788 readPluginStaticData(psd, p); | 802 readPluginStaticData(psd, p); |
789 v.push_back(psd); | 803 v.push_back(psd); |
790 } | 804 } |
791 } | 805 } |