comparison json/VampJson.h @ 32:2d97883d20df

Wire up a couple of server actions
author Chris Cannam <c.cannam@qmul.ac.uk>
date Tue, 24 May 2016 17:17:03 +0100
parents 5b9690d18241
children 54676b4e224e
comparison
equal deleted inserted replaced
31:b376ab0ce003 32:2d97883d20df
687 687
688 std::string err; 688 std::string err;
689 689
690 if (!j.has_shape({ 690 if (!j.has_shape({
691 { "pluginKey", json11::Json::STRING }, 691 { "pluginKey", json11::Json::STRING },
692 { "inputSampleRate", json11::Json::NUMBER }, 692 { "inputSampleRate", json11::Json::NUMBER } }, err)) {
693 { "adapterFlags", json11::Json::ARRAY } }, err)) {
694 throw Failure("malformed load request: " + err); 693 throw Failure("malformed load request: " + err);
695 } 694 }
696 695
697 Vamp::HostExt::LoadRequest req; 696 Vamp::HostExt::LoadRequest req;
698 req.pluginKey = j["pluginKey"].string_value(); 697 req.pluginKey = j["pluginKey"].string_value();
699 req.inputSampleRate = j["inputSampleRate"].number_value(); 698 req.inputSampleRate = j["inputSampleRate"].number_value();
700 req.adapterFlags = toAdapterFlags(j["adapterFlags"]); 699 if (!j["adapterFlags"].is_null()) {
700 req.adapterFlags = toAdapterFlags(j["adapterFlags"]);
701 }
701 return req; 702 return req;
702 } 703 }
703 704
704 static json11::Json 705 static json11::Json
705 fromLoadResponse(const Vamp::HostExt::LoadResponse &resp, 706 fromLoadResponse(const Vamp::HostExt::LoadResponse &resp,