# HG changeset patch # User Chris Cannam # Date 1476199552 -3600 # Node ID c6b6051b1b1a2009d4045da0e8bb342bc129a639 # Parent d9e85a65d45bac5ff3ba8bff3c7c34055fd6cd7b Build rpcrequest types. May be a misdirection diff -r d9e85a65d45b -r c6b6051b1b1a vamp-client/client.cpp --- a/vamp-client/client.cpp Tue Oct 11 15:49:28 2016 +0100 +++ b/vamp-client/client.cpp Tue Oct 11 16:25:52 2016 +0100 @@ -5,11 +5,32 @@ #include "vamp-support/AssignedPluginHandleMapper.h" -namespace piper { +namespace piper { //!!! probably something different class PiperClient : public PiperClientBase { + // unsigned to avoid undefined behaviour on possible wrap + typedef uint32_t ReqId; + public: + + PiperClient() { } + + Vamp::Plugin * + load(std::string key, float inputSampleRate, int adapterFlags) { + + Vamp::HostExt::LoadRequest request; + request.pluginKey = key; + request.inputSampleRate = inputSampleRate; + request.adapterFlags = adapterFlags; + + ::capnp::MallocMessageBuilder message; + RpcRequest::Builder builder = message.initRoot(); + + VampnProto::buildRpcRequest_Load(builder, request); + ReqId id = getId(); + builder.getId().setNumber(id); + }; virtual Vamp::Plugin::OutputList @@ -24,9 +45,11 @@ RpcRequest::Builder builder = message.initRoot(); VampnProto::buildRpcRequest_Configure(builder, request, m_mapper); + ReqId id = getId(); + builder.getId().setNumber(id); //!!! now what? - } + }; virtual @@ -40,6 +63,11 @@ private: AssignedPluginHandleMapper m_mapper; + int getId() { + //!!! todo: mutex + static ReqId m_nextId = 0; + return m_nextId++; + } }; } diff -r d9e85a65d45b -r c6b6051b1b1a vamp-support/PluginHandleMapper.h --- a/vamp-support/PluginHandleMapper.h Tue Oct 11 15:49:28 2016 +0100 +++ b/vamp-support/PluginHandleMapper.h Tue Oct 11 16:25:52 2016 +0100 @@ -60,7 +60,7 @@ class PluginHandleMapper { public: - typedef int32_t Handle; + typedef uint32_t Handle; // unsigned to avoid undefined behaviour on possible wrap const Handle INVALID_HANDLE = 0; virtual ~PluginHandleMapper() noexcept { }