diff --git a/include/FluidSCWrapper.hpp b/include/FluidSCWrapper.hpp index 5877166..515b469 100644 --- a/include/FluidSCWrapper.hpp +++ b/include/FluidSCWrapper.hpp @@ -306,31 +306,38 @@ public: auto& client = mWrapper->client(); auto& params = mWrapper->params(); - - mWrapper->mControlsIterator.reset(mInBuf + mSpecialIndex + - 1); // mClient.audioChannelsIn()); - Wrapper::setParams(mWrapper, - params, mWrapper->mControlsIterator); // forward on inputs N + audio inputs as params - params.constrainParameterValues(); const Unit* unit = this; - for (index i = 0; i < client.audioChannelsIn(); ++i) - { - if (mInputConnections[asUnsigned(i)]) - { mAudioInputs[asUnsigned(i)].reset(IN(i), 0, fullBufferSize()); } - } - for (index i = 0; i < client.audioChannelsOut(); ++i) - { - assert(i <= std::numeric_limits::max()); - if (mOutputConnections[asUnsigned(i)]) - mOutputs[asUnsigned(i)].reset(out(static_cast(i)), 0, - fullBufferSize()); - } - for (index i = 0; i < client.controlChannelsOut(); ++i) + bool trig = IsModel_t::value ? mPrevTrig && in0(0) > 0 : false; + bool shouldProcess = IsModel_t::value ? trig : true; + mPrevTrig = trig; + + if(shouldProcess) { - assert(i <= std::numeric_limits::max()); - mOutputs[asUnsigned(i)].reset(out(static_cast(i)), 0, 1); + mWrapper->mControlsIterator.reset(mInBuf + mSpecialIndex + + 1); // mClient.audioChannelsIn()); + Wrapper::setParams(mWrapper, + params, mWrapper->mControlsIterator); // forward on inputs N + audio inputs as params + params.constrainParameterValues(); + + for (index i = 0; i < client.audioChannelsIn(); ++i) + { + if (mInputConnections[asUnsigned(i)]) + { mAudioInputs[asUnsigned(i)].reset(IN(i), 0, fullBufferSize()); } + } + for (index i = 0; i < client.audioChannelsOut(); ++i) + { + assert(i <= std::numeric_limits::max()); + if (mOutputConnections[asUnsigned(i)]) + mOutputs[asUnsigned(i)].reset(out(static_cast(i)), 0, + fullBufferSize()); + } + for (index i = 0; i < client.controlChannelsOut(); ++i) + { + assert(i <= std::numeric_limits::max()); + mOutputs[asUnsigned(i)].reset(out(static_cast(i)), 0, 1); + } + client.process(mAudioInputs, mOutputs, mContext); } - client.process(mAudioInputs, mOutputs, mContext); } private: std::vector mInputConnections; @@ -339,6 +346,7 @@ private: std::vector mOutputs; FluidContext mContext; Wrapper* mWrapper{static_cast(this)}; + bool mPrevTrig; }; //////////////////////////////////////////////////////////////////////////////// @@ -1555,8 +1563,19 @@ public: // We won't even try and set params if the arguments don't match // if (inputs.size() == C::getParameterDescriptors().count()) // { - p.template setParameterValues(x->mWorld->mVerbosity > 0, x, inputs); - if (constrain) p.constrainParameterValues(); + FluidSCWrapper* w = static_cast(x); + bool verbose = w->mWorld->mVerbosity > 0; + p.template setParameterValuesRT(verbose ? &w->mReportage : nullptr , x, inputs); + if (constrain) p.constrainParameterValuesRT(verbose ? &w->mReportage : nullptr); + if(verbose) + { + for(auto& r:w->mReportage) if(!r.ok()) + { + printResult(w->state(), r); + } + } +// p.template forEachParam(x,inputs, + // } // else // { @@ -1603,7 +1622,7 @@ private: UnitDtorFunc dtor = impl::FluidSCWrapperBase::destroyClass; (*ft->fDefineUnit)(name, sizeof(FluidSCWrapper), ctor, dtor, 0); } - + std::array mReportage; FloatControlsIter mControlsIterator; std::shared_ptr> mState; };