comparison json/VampJson.h @ 16:913fc1d3710a

Create process request in JSON version, plus a fix
author Chris Cannam <c.cannam@qmul.ac.uk>
date Wed, 18 May 2016 14:38:27 +0100
parents 1d13354ddc44
children 3ef01276e15e
comparison
equal deleted inserted replaced
15:d907576aa299 16:913fc1d3710a
757 cr.outputs.push_back(toOutputDescriptor(o)); 757 cr.outputs.push_back(toOutputDescriptor(o));
758 } 758 }
759 759
760 return cr; 760 return cr;
761 } 761 }
762
763 static json11::Json
764 fromProcessRequest(const Vamp::HostExt::ProcessRequest &r,
765 PluginHandleMapper &mapper) {
766
767 json11::Json::object jo;
768 jo["pluginHandle"] = mapper.pluginToHandle(r.plugin);
769
770 json11::Json::object io;
771 io["timestamp"] = fromRealTime(r.timestamp);
772
773 json11::Json::array chans;
774 for (size_t i = 0; i < r.inputBuffers.size(); ++i) {
775 json11::Json::object c;
776 c["b64values"] = fromFloatBuffer(r.inputBuffers[i].data(),
777 r.inputBuffers[i].size());
778 chans.push_back(c);
779 }
780 io["inputBuffers"] = chans;
781
782 jo["processInput"] = io;
783 return json11::Json(jo);
784 }
762 }; 785 };
763 786
764 } 787 }
765 788
766 #endif 789 #endif