nix
Gerard 5 years ago
parent de8e5110f3
commit 04f0db5267

@ -307,7 +307,7 @@ public:
auto& client = mWrapper->client();
auto& params = mWrapper->params();
const Unit* unit = this;
bool trig = IsModel_t<Client>::value ? mPrevTrig && in0(0) > 0 : false;
bool trig = IsModel_t<Client>::value ? !mPrevTrig && in0(0) > 0 : false;
bool shouldProcess = IsModel_t<Client>::value ? trig : true;
mPrevTrig = trig;
@ -318,7 +318,7 @@ public:
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)])
@ -337,7 +337,7 @@ public:
mOutputs[asUnsigned(i)].reset(out(static_cast<int>(i)), 0, 1);
}
client.process(mAudioInputs, mOutputs, mContext);
}
// }
}
private:
std::vector<bool> mInputConnections;
@ -594,7 +594,7 @@ public:
return true;
}
static void destroy(World* world, void* data)
static void destroy(World* /*world*/, void* data)
{
if(!data) return;
auto& s = *static_cast<SharedState<Client>*>(data);
@ -995,17 +995,17 @@ class FluidSCWrapper : public impl::FluidSCWrapperBase<C>
return std::string(recv ? recv : "");
}
static auto fromArgs(Unit* x, FloatControlsIter& args, std::string, int)
static auto fromArgs(Unit* /*x*/, FloatControlsIter& args, std::string, int)
{
// first is string size, then chars
index size = static_cast<index>(args.next());
auto ft = FluidSCWrapper::getInterfaceTable();
auto w = x->mWorld;
// auto ft = FluidSCWrapper::getInterfaceTable();
// auto w = x->mWorld;
// char* chunk =
// static_cast<char*>(ft->fRTAlloc(w, asUnsigned(size + 1)));
std::string res;
res.resize(size);
res.resize(asUnsigned(size));
// if (!chunk)
// {
@ -1015,7 +1015,7 @@ class FluidSCWrapper : public impl::FluidSCWrapperBase<C>
// }
for (index i = 0; i < size; ++i)
res[i] = static_cast<char>(args.next());
res[asUnsigned(i)] = static_cast<char>(args.next());
// res[size] = 0; // terminate string
// auto res = std::string{chunk};
@ -1415,7 +1415,7 @@ class FluidSCWrapper : public impl::FluidSCWrapperBase<C>
return true;
},
nullptr, // NRT Thread: No-op
[](World* w, void* data) // RT thread: clean up
[](World* /*w*/, void* data) // RT thread: clean up
{
MessageData* m = static_cast<MessageData*>(data);
// m->~MessageData();
@ -1451,7 +1451,7 @@ class FluidSCWrapper : public impl::FluidSCWrapperBase<C>
// float* values = static_cast<float*>(
// ft->fRTAlloc(x->mNode->mWorld, asUnsigned(numArgs) * sizeof(float)));
float* values = new float[numArgs];
float* values = new float[asUnsigned(numArgs)];
// copy return data
ToFloatArray::convert(values, static_cast<T>(result));
@ -1492,7 +1492,7 @@ class FluidSCWrapper : public impl::FluidSCWrapperBase<C>
// float* values = static_cast<float*>(
// ft->fRTAlloc(x->mNode->mWorld, asUnsigned(numArgs) * sizeof(float)));
float* values = new float[numArgs];
float* values = new float[asUnsigned(numArgs)];
ToFloatArray::convert(values, std::tuple<Ts...>(result), offsets,
std::index_sequence_for<Ts...>());

@ -48,15 +48,18 @@ FluidDataSet : FluidManipulationClient {
}
addPoint{|label, buffer, action|
this.prSendMsg(\addPoint,[label.asSymbol,buffer.asUGenInput],action);
buffer = this.prEncodeBuffer(buffer);
this.prSendMsg(\addPoint,[label.asSymbol,buffer],action);
}
getPoint{|label, buffer, action|
this.prSendMsg(\getPoint,[label.asSymbol,buffer.asUGenInput],action);
buffer = this.prEncodeBuffer(buffer);
this.prSendMsg(\getPoint,[label.asSymbol,buffer],action,outputBuffers:[buffer]);
}
updatePoint{|label, buffer, action|
this.prSendMsg(\updatePoint,[label.asSymbol,buffer.asUGenInput],action);
buffer = this.prEncodeBuffer(buffer);
this.prSendMsg(\updatePoint,[label.asSymbol,buffer],action,outputBuffers:[buffer]);
}
deletePoint{|label, action|

@ -26,9 +26,10 @@ FluidKMeans : FluidRTDataClient {
}
predictPoint { |buffer, action|
buffer = this.prEncodeBuffer(buffer);
this.prSendMsg(\predictPoint,
[buffer.asUGenInput], action,
[number(FluidMessageResponse,_,_)]
[buffer], action,
[number(FluidMessageResponse,_,_)],outputBuffers:[buffer]
);
}
}

@ -15,9 +15,10 @@ FluidKNNClassifier : FluidRTDataClient {
}
predictPoint {|buffer, action|
buffer = this.prEncodeBuffer(buffer);
this.prSendMsg(\predictPoint,
[buffer.asUGenInput], action,
[string(FluidMessageResponse,_,_)]
[string(FluidMessageResponse,_,_)],outputBuffers:[buffer]
);
}
}

@ -18,7 +18,8 @@ FluidKNNRegressor : FluidRTDataClient {
}
predictPoint { |buffer, action|
this.prSendMsg(\predictPoint, [buffer.asUGenInput], action,
[number(FluidMessageResponse,_,_)]);
buffer = this.prEncodeBuffer(buffer);
this.prSendMsg(\predictPoint, [buffer], action,
[number(FluidMessageResponse,_,_)],outputBuffers:[buffer]);
}
}

@ -44,8 +44,10 @@ FluidMLPRegressor : FluidRTDataClient {
}
predictPoint { |sourceBuffer, targetBuffer, action|
sourceBuffer = this.prEncodeBuffer(sourceBuffer);
targetBuffer = this.prEncodeBuffer(targetBuffer);
this.prSendMsg(\predictPoint,
[sourceBuffer.asUGenInput, targetBuffer.asUGenInput], action);
[sourceBuffer.asUGenInput, targetBuffer.asUGenInput], action,outputBuffers:[targetBuffer]);
}
}
@ -94,7 +96,8 @@ FluidMLPClassifier : FluidRTDataClient {
}
predictPoint { |sourceBuffer, action|
sourceBuffer = this.prEncodeBuffer(sourceBuffer);
this.prSendMsg(\predictPoint,
[sourceBuffer.asUGenInput], action, string(FluidMessageResponse,_,_));
[sourceBuffer], action, string(FluidMessageResponse,_,_));
}
}

@ -116,7 +116,9 @@ FluidManipulationClient {
this.prSendMsg(\size,[],action,[numbers(FluidMessageResponse,_,1,_)]);
}
prSendMsg { |msg, args, action,parser|
prEncodeBuffer { |buf| buf !? {^buf.asUGenInput} ?? {^-1} }
prSendMsg { |msg, args, action,parser,outputBuffers|
if(this.server.serverRunning.not,{(this.asString + " server not running").error; ^nil});
forkIfNeeded{
synth ?? {onSynthFree.value; server.sync};
@ -125,7 +127,16 @@ FluidManipulationClient {
defer{
var result;
result = FluidMessageResponse.collectArgs(parser,msg.drop(3));
if(action.notNil){action.value(result)}{action.value};
if(outputBuffers.notNil) {
forkIfNeeded {
outputBuffers.collectInPlace{ |b|
server.cachedBufferAt(b) !? {|x| x.updateInfo}
};
server.sync;
if(action.notNil){action.value(*(outputBuffers++result))}{action.value};
};
}
{if(action.notNil){action.value(result)}{action.value};}
}
},'/'++msg, server.addr, nil,[synth.nodeID]).oneShot;
server.listSendMsg(['/u_cmd', synth.nodeID, ugen.synthIndex, msg].addAll(args));

@ -21,8 +21,11 @@ FluidNormalize : FluidRTDataClient {
}
transformPoint{|sourceBuffer, destBuffer, action|
sourceBuffer = this.prEncodeBuffer(sourceBuffer);
destBuffer = this.prEncodeBuffer(destBuffer);
this.prSendMsg(\transformPoint,
[sourceBuffer.asUGenInput, destBuffer.asUGenInput], action
[sourceBuffer, destBuffer], action,
outputBuffers:[destBuffer]
);
}
}

@ -17,6 +17,8 @@ FluidPCA : FluidRTDataClient {
}
transformPoint{|sourceBuffer, destBuffer, action|
this.prSendMsg(\transformPoint,[sourceBuffer.asUGenInput, destBuffer.asUGenInput], action);
sourceBuffer = this.prEncodeBuffer(sourceBuffer);
destBuffer = this.prEncodeBuffer(destBuffer);
this.prSendMsg(\transformPoint,[sourceBuffer, destBuffer], action, outputBuffers:[destBuffer]);
}
}

@ -20,8 +20,10 @@ FluidStandardize : FluidRTDataClient {
}
transformPoint{|sourceBuffer, destBuffer, action|
sourceBuffer = this.prEncodeBuffer(sourceBuffer);
destBuffer = this.prEncodeBuffer(destBuffer);
this.prSendMsg(\transformPoint,
[sourceBuffer.asUGenInput, destBuffer.asUGenInput], action
[sourceBuffer, destBuffer], action, outputBuffers:[destBuffer]
);
}
}

@ -186,8 +186,7 @@ code::
//pitching
{
var trig = Impulse.kr(MouseX.kr(0,1).exprange(0.5,ControlRate.ir / 2));
var step = Stepper.kr(trig,max:3);
var point = TRand.kr(-0.1, [0.1, 0.1], trig) + [step.mod(2).linlin(0,1,-0.6,0.6),step.div(2).linlin(0,1,-0.6,0.6)] ;
var point = 2.collect{ TIRand.kr(0,3,trig).linlin(0,3,-1,1) };
point.collect{|p,i| BufWr.kr([p],~inpPoint,i)};
Out.kr(~ib.index,[trig]);
T2A.ar(trig)*0.1;

@ -182,8 +182,7 @@ code::
//pitching
{
var trig = Impulse.kr(MouseX.kr(0,1).exprange(0.5,ControlRate.ir /2).poll);
var step = Stepper.kr(trig,max:3);
var point = TRand.kr(-0.1, [0.1, 0.1], trig) + [step.mod(2).linlin(0,1,-0.6,0.6),step.div(2).linlin(0,1,-0.6,0.6)] ;
var point = 2.collect{TIRand.kr(0,3,trig).linlin(0,3,-1,1)};
point.collect{|p,i| BufWr.kr([p],~inpPoint,i)};
Out.kr(~ib.index,[trig]);
T2A.ar(trig)*0.1;

@ -192,8 +192,7 @@ code::
//pitching
{
var trig = Impulse.kr(MouseX.kr(0,1).exprange(0.5,ControlRate.ir /2).poll);
var step = Stepper.kr(trig,max:3);
var point = TRand.kr(-0.1, [0.1, 0.1], trig) + [step.mod(2).linlin(0,1,-0.6,0.6),step.div(2).linlin(0,1,-0.6,0.6)] ;
var point = 2.collect{TIRand.kr(0,3,trig).linlin(0,3,-1,1)};
point.collect{|p,i| BufWr.kr([p],~inpPoint,i)};
Out.kr(~ib.index,[trig]);
T2A.ar(trig)*0.1;

Loading…
Cancel
Save