Update info output buffers in point processing methods for data clients; make sure nil buffers transmit -1, not 0

nix
Owen Green 5 years ago
parent dd528d663b
commit 5aaeced5e4

@ -48,15 +48,18 @@ FluidDataSet : FluidManipulationClient {
} }
addPoint{|label, buffer, action| 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| 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| 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| deletePoint{|label, action|

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

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

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

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

@ -116,7 +116,9 @@ FluidManipulationClient {
this.prSendMsg(\size,[],action,[numbers(FluidMessageResponse,_,1,_)]); 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}); if(this.server.serverRunning.not,{(this.asString + " server not running").error; ^nil});
forkIfNeeded{ forkIfNeeded{
synth ?? {onSynthFree.value; server.sync}; synth ?? {onSynthFree.value; server.sync};
@ -125,7 +127,16 @@ FluidManipulationClient {
defer{ defer{
var result; var result;
result = FluidMessageResponse.collectArgs(parser,msg.drop(3)); 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; },'/'++msg, server.addr, nil,[synth.nodeID]).oneShot;
server.listSendMsg(['/u_cmd', synth.nodeID, ugen.synthIndex, msg].addAll(args)); server.listSendMsg(['/u_cmd', synth.nodeID, ugen.synthIndex, msg].addAll(args));

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

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

Loading…
Cancel
Save