From 0d99d71246d63d46ce3ac22b6f899de788788d91 Mon Sep 17 00:00:00 2001 From: Owen Green Date: Wed, 2 Oct 2019 16:10:13 +0100 Subject: [PATCH] Messages that have side effects on buffers need to make sure they do the nrt->rt buffer swap thing --- include/FluidSCWrapper.hpp | 43 +++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/include/FluidSCWrapper.hpp b/include/FluidSCWrapper.hpp index 07b8d49..88bbea0 100644 --- a/include/FluidSCWrapper.hpp +++ b/include/FluidSCWrapper.hpp @@ -24,6 +24,26 @@ class FluidSCWrapper; namespace impl { + template + struct AssignBuffer + { + void operator()(const typename BufferT::type &p, World *w) + { + if (auto b = static_cast(p.get())) + b->assignToRT(w); + } + }; + + template + struct CleanUpBuffer + { + void operator()(const typename BufferT::type &p) + { + if (auto b = static_cast(p.get())) b->cleanUp(); + } + }; + + // Iterate over kr/ir inputs via callbacks from params object struct FloatControlsIter { @@ -295,33 +315,17 @@ private: bool exchangeBuffers(World *world) { - mParams.template forEachParamType(world); + mParams.template forEachParamType(world); return true; } bool tidyUp(World *) { - mParams.template forEachParamType(); + mParams.template forEachParamType(); return true; } - template - struct AssignBuffer - { - void operator()(const typename BufferT::type &p, World *w) - { - if (auto b = static_cast(p.get())) b->assignToRT(w); - } - }; - template - struct CleanUpBuffer - { - void operator()(const typename BufferT::type &p) - { - if (auto b = static_cast(p.get())) b->cleanUp(); - } - }; FloatControlsIter mControlsIterator; FifoMsg mFifoMsg; @@ -627,9 +631,10 @@ class FluidSCWrapper : public impl::FluidSCWrapperBase } return true; }, - [](World*, void* data) //RT thread: response + [](World* world, void* data) //RT thread: response { MessageData* m = static_cast(data); + MessageDescriptor::template forEachArg(m->args, world); messageOutput(m->wrapper,m->name,m->result); return true; }