c@78: c@78: #include "stub.h" c@78: c@80: #include "vamp-capnp/VampnProto.h" c@80: c@80: #include "vamp-support/AssignedPluginHandleMapper.h" c@80: c@81: namespace piper { //!!! probably something different c@80: c@80: class PiperClient : public PiperClientBase c@80: { c@81: // unsigned to avoid undefined behaviour on possible wrap c@81: typedef uint32_t ReqId; c@81: c@80: public: c@81: c@81: PiperClient() { } c@81: c@81: Vamp::Plugin * c@81: load(std::string key, float inputSampleRate, int adapterFlags) { c@81: c@81: Vamp::HostExt::LoadRequest request; c@81: request.pluginKey = key; c@81: request.inputSampleRate = inputSampleRate; c@81: request.adapterFlags = adapterFlags; c@81: c@81: ::capnp::MallocMessageBuilder message; c@81: RpcRequest::Builder builder = message.initRoot(); c@81: c@81: VampnProto::buildRpcRequest_Load(builder, request); c@81: ReqId id = getId(); c@81: builder.getId().setNumber(id); c@81: }; c@80: c@80: virtual c@80: Vamp::Plugin::OutputList c@80: configure(PiperStubPlugin *plugin, c@80: Vamp::HostExt::PluginConfiguration config) { c@80: c@80: Vamp::HostExt::ConfigurationRequest request; c@80: request.plugin = plugin; c@80: request.configuration = config; c@80: c@80: ::capnp::MallocMessageBuilder message; c@80: RpcRequest::Builder builder = message.initRoot(); c@80: c@80: VampnProto::buildRpcRequest_Configure(builder, request, m_mapper); c@81: ReqId id = getId(); c@81: builder.getId().setNumber(id); c@80: c@80: //!!! now what? c@81: }; c@80: c@80: c@80: virtual c@80: Vamp::Plugin::FeatureSet c@80: process(PiperStubPlugin *plugin, c@80: const float *const *inputBuffers, c@80: Vamp::RealTime timestamp) = 0; c@80: c@80: virtual Vamp::Plugin::FeatureSet c@80: finish(PiperStubPlugin *plugin) = 0; c@80: c@80: private: c@80: AssignedPluginHandleMapper m_mapper; c@81: int getId() { c@81: //!!! todo: mutex c@81: static ReqId m_nextId = 0; c@81: return m_nextId++; c@81: } c@80: }; c@80: c@80: } c@80: