Merge branch 'nrt-threading' of https://bitbucket.org/flucoma/flucoma-supercollider into nrt-threading

nix
Pierre Alexandre Tremblay 6 years ago
commit 60f71b17cf

@ -194,8 +194,6 @@ public:
});
}
/// Final input is the doneAction, not a param, so we skip it in the controlsIterator
NonRealTime() :
mControlsIterator{mInBuf,static_cast<size_t>(static_cast<ptrdiff_t>(mNumInputs) - mSpecialIndex - 1)}
@ -210,7 +208,6 @@ public:
{
mFifoMsg.Set(mWorld, initNRTJob, nullptr, this);
mWorld->ft->fSendMsgFromRT(mWorld,mFifoMsg);
//we want to poll thread roughly every 20ms
checkThreadInterval = static_cast<size_t>(0.02 / controlDur());
set_calc_function<NonRealTime, &NonRealTime::poll>();
@ -219,26 +216,16 @@ public:
/// The calc function. Checks to see if we've cancelled, spits out progress, launches tidy up when complete
void poll(int)
{
// if(!mClient.done())
// {
out0(0) = static_cast<float>(mClient.progress());
// }
// else {
if(0 == pollCounter++)
{
mWorld->ft->fDoAsynchronousCommand(mWorld, nullptr, Wrapper::getName(), this,
postProcess, exchangeBuffers, tidyUp, destroy,
0, nullptr);
}
pollCounter %= checkThreadInterval;
// if(mClient.state() == kDone)
// mDone = true;
// mCalcFunc = mWorld->ft->fClearUnitOutputs;
// if(!mDone)
out0(0) = static_cast<float>(mClient.progress());
// }
if(0 == pollCounter++)
{
mWorld->ft->fDoAsynchronousCommand(mWorld, nullptr, Wrapper::getName(), this,
postProcess, exchangeBuffers, tidyUp, destroy,
0, nullptr);
mCalcFunc = nop;
}
pollCounter %= checkThreadInterval;
}
static void nop(Unit*, int) {}
@ -248,16 +235,14 @@ public:
{
auto w = static_cast<Wrapper*>(f->mData);
w->mDone = false;
Result result = validateParameters(w);
if (!result.ok())
{
std::cout << "ERROR: " << Wrapper::getName() << ": " << result.message().c_str() << std::endl;
// w->mDone = true;
return;
}
// w->mClient.setSynchronous(mSynchronous);
// mClient.setQueu
w->mClient.enqueue(w->mParams);
w->mClient.process();
}
@ -284,9 +269,9 @@ public:
std::cout << "ERROR: " << Wrapper::getName() << ": " << r.message().c_str() << '\n';
return false;
}
return true;
}
w->template set_calc_function<NonRealTime, &NonRealTime::poll>();
return false;
}
@ -302,7 +287,6 @@ public:
if(w->mDone && w->mNumInputs > 0) //don't check for doneAction if UGen has no ins
{
int doneAction = static_cast<int>(w->in0(static_cast<int>(w->mNumInputs - 1))); //doneAction is last input; THIS IS THE LAW
if(doneAction >= 2) w->mCalcFunc = nop;
world->ft->fDoneAction(doneAction,w);
}
}
@ -311,8 +295,6 @@ public:
{
static_cast<Wrapper *>(unit)->mClient.cancel();
}
private:
static Result validateParameters(NonRealTime *w)

Loading…
Cancel
Save