Mercurial > hg > piper-cpp
comparison vamp-json/VampJson.h @ 203:d2a32436bf09
Fix some syntax that the compiler used with Emscripten on Travis doesn't
like
author | Chris Cannam <cannam@all-day-breakfast.com> |
---|---|
date | Thu, 09 Feb 2017 09:21:37 +0000 |
parents | 3eb00e5c76c4 |
children | 328ffacfc70e |
comparison
equal
deleted
inserted
replaced
192:458766b73e71 | 203:d2a32436bf09 |
---|---|
477 BufferSerialisation &serialisation, std::string &err) { | 477 BufferSerialisation &serialisation, std::string &err) { |
478 | 478 |
479 Vamp::Plugin::FeatureList fl; | 479 Vamp::Plugin::FeatureList fl; |
480 if (!j.is_array()) { | 480 if (!j.is_array()) { |
481 err = "array expected for feature list"; | 481 err = "array expected for feature list"; |
482 return {}; | 482 return fl; |
483 } | 483 } |
484 for (const json11::Json &fj : j.array_items()) { | 484 for (const json11::Json &fj : j.array_items()) { |
485 fl.push_back(toFeature(fj, serialisation, err)); | 485 fl.push_back(toFeature(fj, serialisation, err)); |
486 if (failed(err)) return {}; | 486 if (failed(err)) return fl; |
487 } | 487 } |
488 return fl; | 488 return fl; |
489 } | 489 } |
490 | 490 |
491 static Vamp::Plugin::FeatureSet | 491 static Vamp::Plugin::FeatureSet |
495 std::string &err) { | 495 std::string &err) { |
496 | 496 |
497 Vamp::Plugin::FeatureSet fs; | 497 Vamp::Plugin::FeatureSet fs; |
498 if (!j.is_object()) { | 498 if (!j.is_object()) { |
499 err = "object expected for feature set"; | 499 err = "object expected for feature set"; |
500 return {}; | 500 return fs; |
501 } | 501 } |
502 for (auto &entry : j.object_items()) { | 502 for (auto &entry : j.object_items()) { |
503 int n = omapper.idToIndex(entry.first); | 503 int n = omapper.idToIndex(entry.first); |
504 if (fs.find(n) != fs.end()) { | 504 if (fs.find(n) != fs.end()) { |
505 err = "duplicate numerical index for output"; | 505 err = "duplicate numerical index for output"; |
506 return {}; | 506 return fs; |
507 } | 507 } |
508 fs[n] = toFeatureList(entry.second, serialisation, err); | 508 fs[n] = toFeatureList(entry.second, serialisation, err); |
509 if (failed(err)) return {}; | 509 if (failed(err)) return fs; |
510 } | 510 } |
511 return fs; | 511 return fs; |
512 } | 512 } |
513 | 513 |
514 static std::string | 514 static std::string |