Update SC classes
parent
0931042aff
commit
d0cbf95550
@ -1,36 +1,43 @@
|
|||||||
FluidBufAmpGate : UGen {
|
FluidBufAmpGate : FluidBufProcessor {
|
||||||
|
|
||||||
|
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, rampUp = 10, rampDown = 10, onThreshold = -90, offThreshold = -90, minSliceLength = 1, minSilenceLength = 1, minLengthAbove = 1, minLengthBelow = 1, lookBack = 0, lookAhead = 0, highPassFreq = 85, trig = 1, blocking = 0|
|
||||||
|
|
||||||
*new1 { |rate, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, rampUp = 10, rampDown = 10, onThreshold = -90, offThreshold = -90, minSliceLength = 1, minSilenceLength = 1, minLengthAbove = 1, minLengthBelow = 1, lookBack = 0, lookAhead = 0, highPassFreq = 85, trig = 1, blocking|
|
|
||||||
var maxSize = max(minLengthAbove + lookBack, max(minLengthBelow,lookAhead));
|
var maxSize = max(minLengthAbove + lookBack, max(minLengthBelow,lookAhead));
|
||||||
|
|
||||||
source = source.asUGenInput;
|
source = source.asUGenInput;
|
||||||
indices = indices.asUGenInput;
|
indices = indices.asUGenInput;
|
||||||
|
|
||||||
source.isNil.if {"FluidBufAmpSlice: Invalid source buffer".throw};
|
^FluidProxyUgen.kr(\FluidBufAmpGateTrigger,-1, source, startFrame, numFrames, startChan, numChans, indices, rampUp, rampDown, onThreshold, offThreshold, minSliceLength, minSilenceLength, minLengthAbove, minLengthBelow, lookBack, lookAhead, highPassFreq,maxSize, trig, blocking);
|
||||||
indices.isNil.if {"FluidBufAmpSlice: Invalid features buffer".throw};
|
|
||||||
|
|
||||||
^super.new1(rate, source, startFrame, numFrames, startChan, numChans, indices, rampUp, rampDown, onThreshold, offThreshold, minSliceLength, minSilenceLength, minLengthAbove, minLengthBelow, lookBack, lookAhead, highPassFreq, maxSize, trig, blocking);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, rampUp = 10, rampDown = 10, onThreshold = -90, offThreshold = -90, minSliceLength = 1, minSilenceLength = 1, minLengthAbove = 1, minLengthBelow = 1, lookBack = 0, lookAhead = 0, highPassFreq = 85, trig = 1, blocking = 0|
|
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, rampUp = 10, rampDown = 10, onThreshold = -90, offThreshold = -90, minSliceLength = 1, minSilenceLength = 1, minLengthAbove = 1, minLengthBelow = 1, lookBack = 0, lookAhead = 0, highPassFreq = 85, freeWhenDone = true, action |
|
||||||
^this.multiNew(\control, source, startFrame, numFrames, startChan, numChans, indices, rampUp, rampDown, onThreshold, offThreshold, minSliceLength, minSilenceLength, minLengthAbove, minLengthBelow, lookBack, lookAhead, highPassFreq, trig, blocking);
|
|
||||||
}
|
|
||||||
|
|
||||||
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, rampUp = 10, rampDown = 10, onThreshold = -90, offThreshold = -90, minSliceLength = 1, minSilenceLength = 1, minLengthAbove = 1, minLengthBelow = 1, lookBack = 0, lookAhead = 0, highPassFreq = 85, action |
|
var maxSize = max(minLengthAbove + lookBack, max(minLengthBelow,lookAhead));
|
||||||
|
|
||||||
^FluidNRTProcess.new(
|
source = source ? -1;
|
||||||
server, this, action, [indices]
|
indices = indices ? -1;
|
||||||
).process(
|
|
||||||
source, startFrame, numFrames, startChan, numChans, indices, rampUp, rampDown, onThreshold, offThreshold, minSliceLength, minSilenceLength, minLengthAbove, minLengthBelow, lookBack, lookAhead, highPassFreq
|
^this.new(
|
||||||
|
server, nil, [indices]
|
||||||
|
).processList(
|
||||||
|
[source, startFrame, numFrames, startChan, numChans, indices, rampUp, rampDown, onThreshold, offThreshold, minSliceLength, minSilenceLength, minLengthAbove, minLengthBelow, lookBack, lookAhead, highPassFreq, maxSize, 0],freeWhenDone,action
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, rampUp = 10, rampDown = 10, onThreshold = -90, offThreshold = -90, minSliceLength = 1, minSilenceLength = 1, minLengthAbove = 1, minLengthBelow = 1, lookBack = 0, lookAhead = 0, highPassFreq = 85, action|
|
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, rampUp = 10, rampDown = 10, onThreshold = -90, offThreshold = -90, minSliceLength = 1, minSilenceLength = 1, minLengthAbove = 1, minLengthBelow = 1, lookBack = 0, lookAhead = 0, highPassFreq = 85, freeWhenDone = true, action |
|
||||||
|
|
||||||
|
|
||||||
|
var maxSize = max(minLengthAbove + lookBack, max(minLengthBelow,lookAhead));
|
||||||
|
|
||||||
|
source = source ? -1;
|
||||||
|
indices = indices ? -1;
|
||||||
|
|
||||||
^FluidNRTProcess.new(
|
^this.new(
|
||||||
server, this, action, [indices], blocking: 1
|
server, nil, [indices]
|
||||||
).process(
|
).processList(
|
||||||
source, startFrame, numFrames, startChan, numChans, indices, rampUp, rampDown, onThreshold, offThreshold, minSliceLength, minSilenceLength, minLengthAbove, minLengthBelow, lookBack, lookAhead, highPassFreq
|
[source, startFrame, numFrames, startChan, numChans, indices, rampUp, rampDown, onThreshold, offThreshold, minSliceLength, minSilenceLength, minLengthAbove, minLengthBelow, lookBack, lookAhead, highPassFreq, maxSize, 1],freeWhenDone,action
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,31 +1,46 @@
|
|||||||
FluidBufFlatten : UGen {
|
FluidBufFlatten : FluidBufProcessor {
|
||||||
|
|
||||||
*new1 { |rate, source, destination, axis = 1, trig = 1, blocking|
|
|
||||||
|
*kr { |source, destination, axis = 1, trig = 1, blocking = 1|
|
||||||
|
|
||||||
source = source.asUGenInput;
|
source = source.asUGenInput;
|
||||||
destination = destination.asUGenInput;
|
destination = destination.asUGenInput;
|
||||||
|
|
||||||
source.isNil.if {"FluidBufFlatten: Invalid source buffer".throw};
|
source.isNil.if {"FluidBufFlatten: Invalid source buffer".throw};
|
||||||
destination.isNil.if {"FluidBufFlatten: Invalid destination buffer".throw};
|
destination.isNil.if {"FluidBufFlatten: Invalid destination buffer".throw};
|
||||||
^super.new1(rate, source, destination, axis, trig, blocking);
|
|
||||||
}
|
|
||||||
|
|
||||||
*kr { |source, destination, axis = 1, trig = 1, blocking = 1|
|
^FluidProxyUgen.kr(\FluidBufFlattenTrigger,-1, source, destination, axis, trig, blocking);
|
||||||
^this.new1('control', source, destination, axis, trig, blocking);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*process { |server, source, destination, axis = 1, action|
|
*process { |server, source, destination, axis = 1, freeWhenDone = true, action|
|
||||||
^FluidNRTProcess.new(
|
|
||||||
server, this, action, [destination], blocking:1
|
source = source.asUGenInput;
|
||||||
).process(
|
destination = destination.asUGenInput;
|
||||||
source, destination, axis
|
|
||||||
|
source.isNil.if {"FluidBufFlatten: Invalid source buffer".throw};
|
||||||
|
destination.isNil.if {"FluidBufFlatten: Invalid destination buffer".throw};
|
||||||
|
|
||||||
|
^this.new(
|
||||||
|
server, nil, [destination],
|
||||||
|
).processList(
|
||||||
|
[source, destination, axis,0],freeWhenDone,action
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*processBlocking { |server, source, destination, axis = 1, action|
|
*processBlocking { |server, source, destination, axis = 1, freeWhenDone = true, action|
|
||||||
^process(
|
|
||||||
source, destination, axis
|
source = source.asUGenInput;
|
||||||
|
destination = destination.asUGenInput;
|
||||||
|
|
||||||
|
source.isNil.if {"FluidBufFlatten: Invalid source buffer".throw};
|
||||||
|
destination.isNil.if {"FluidBufFlatten: Invalid destination buffer".throw};
|
||||||
|
|
||||||
|
^this.new(
|
||||||
|
server, nil, [destination],
|
||||||
|
).processList(
|
||||||
|
[source, destination, axis,1],freeWhenDone,action
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,47 +1,36 @@
|
|||||||
FluidBufNMF : UGen {
|
FluidBufNMF : FluidBufProcessor //: UGen {
|
||||||
|
{
|
||||||
*new1 {|rate, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, resynth, bases, basesMode = 0, activations, actMode = 0, components = 1, iterations = 100, windowSize = 1024, hopSize = -1, fftSize = -1, windowType = 0, randomSeed = -1, trig = 1, blocking = 0|
|
*kr {|source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, resynth, bases, basesMode = 0, activations, actMode = 0, components = 1, iterations = 100, windowSize = 1024, hopSize = -1, fftSize = -1, windowType = 0, randomSeed = -1, trig = 1, blocking = 0|
|
||||||
|
|
||||||
source = source.asUGenInput;
|
|
||||||
resynth = resynth.asUGenInput;
|
|
||||||
bases = bases.asUGenInput;
|
|
||||||
activations = activations.asUGenInput;
|
|
||||||
|
|
||||||
source.isNil.if {"FluidBufNMF: Invalid source buffer".throw};
|
source.isNil.if {"FluidBufNMF: Invalid source buffer".throw};
|
||||||
|
|
||||||
resynth = resynth ? -1;
|
resynth = resynth ? -1;
|
||||||
bases = bases ? -1;
|
bases = bases ? -1;
|
||||||
activations = activations ? -1;
|
activations = activations ? -1;
|
||||||
|
|
||||||
^super.new1(rate,source, startFrame, numFrames, startChan, numChans, resynth, bases, basesMode, activations, actMode, components, iterations, windowSize, hopSize, fftSize, trig, blocking);
|
^FluidProxyUgen.kr(\FluidBufNMFTrigger,-1,source, startFrame, numFrames, startChan, numChans, resynth, bases, basesMode, activations, actMode, components, iterations, windowSize, hopSize, fftSize, trig, blocking);
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
*kr {|source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, resynth, bases, basesMode = 0, activations, actMode = 0, components = 1, iterations = 100, windowSize = 1024, hopSize = -1, fftSize = -1, windowType = 0, randomSeed = -1, trig = 1, blocking = 0|
|
|
||||||
^this.new1(\control,source, startFrame, numFrames, startChan, numChans, resynth, bases, basesMode, activations, actMode, components, iterations, windowSize, hopSize, fftSize, trig, blocking);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, resynth = -1, bases = -1, basesMode = 0, activations = -1, actMode = 0, components = 1, iterations = 100, windowSize = 1024, hopSize = -1, fftSize = -1, windowType = 0, randomSeed = -1,freeWhenDone = true, action|
|
||||||
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, resynth = -1, bases = -1, basesMode = 0, activations = -1, actMode = 0, components = 1, iterations = 100, windowSize = 1024, hopSize = -1, fftSize = -1, windowType = 0, randomSeed = -1, action|
|
|
||||||
|
|
||||||
source.isNil.if {"FluidBufNMF: Invalid source buffer".throw};
|
source.isNil.if {"FluidBufNMF: Invalid source buffer".throw};
|
||||||
|
resynth = resynth ? -1;
|
||||||
|
bases = bases ? -1;
|
||||||
|
activations = activations ? -1;
|
||||||
|
|
||||||
^FluidNRTProcess.new(
|
^this.new(
|
||||||
server, this, action, [resynth, bases, activations].select{|x| x!= -1}
|
server,nil,[resynth, bases, activations].select{|x| x!= -1}
|
||||||
).process(
|
).processList([source, startFrame, numFrames, startChan, numChans, resynth, bases, basesMode, activations, actMode, components,iterations, windowSize, hopSize, fftSize,0],freeWhenDone,action);
|
||||||
source, startFrame, numFrames, startChan, numChans, resynth, bases, basesMode, activations, actMode, components,iterations, windowSize, hopSize, fftSize, windowType, randomSeed
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, resynth = -1, bases = -1, basesMode = 0, activations = -1, actMode = 0, components = 1, iterations = 100, windowSize = 1024, hopSize = -1, fftSize = -1, windowType = 0, randomSeed = -1, action|
|
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, resynth = -1, bases = -1, basesMode = 0, activations = -1, actMode = 0, components = 1, iterations = 100, windowSize = 1024, hopSize = -1, fftSize = -1, windowType = 0, randomSeed = -1,freeWhenDone = true, action|
|
||||||
|
|
||||||
source.isNil.if {"FluidBufNMF: Invalid source buffer".throw};
|
source.isNil.if {"FluidBufNMF: Invalid source buffer".throw};
|
||||||
|
resynth = resynth ? -1;
|
||||||
|
bases = bases ? -1;
|
||||||
|
activations = activations ? -1;
|
||||||
|
|
||||||
^FluidNRTProcess.new(
|
^this.new(
|
||||||
server, this, action, [resynth, bases, activations].select{|x| x!= -1},blocking: 1
|
server,nil,[resynth, bases, activations].select{|x| x!= -1}
|
||||||
).process(
|
).processList([source, startFrame, numFrames, startChan, numChans, resynth, bases, basesMode, activations, actMode, components,iterations, windowSize, hopSize, fftSize, 1],freeWhenDone,action);
|
||||||
source, startFrame, numFrames, startChan, numChans, resynth, bases, basesMode, activations, actMode, components,iterations, windowSize, hopSize, fftSize, windowType, randomSeed
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,31 +1,43 @@
|
|||||||
FluidBufScale : UGen {
|
FluidBufScale : FluidBufProcessor {
|
||||||
|
|
||||||
*new1 { |rate, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, inputLow = 0, inputHigh = 1, outputLow = 0, outputHigh = 1, trig = 1, blocking|
|
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, inputLow = 0, inputHigh = 1, outputLow = 0, outputHigh = 1, trig = 1, blocking = 1|
|
||||||
|
|
||||||
source = source.asUGenInput;
|
source = source.asUGenInput;
|
||||||
destination = destination.asUGenInput;
|
destination = destination.asUGenInput;
|
||||||
|
|
||||||
source.isNil.if {"FluidBufScale: Invalid source buffer".throw};
|
source.isNil.if {"FluidBufScale: Invalid source buffer".throw};
|
||||||
destination.isNil.if {"FluidBufScale: Invalid destination buffer".throw};
|
destination.isNil.if {"FluidBufScale: Invalid destination buffer".throw};
|
||||||
^super.new1(rate, source, startFrame, numFrames, startChan, numChans, destination, inputLow, inputHigh, outputLow, outputHigh, trig, blocking);
|
|
||||||
}
|
|
||||||
|
|
||||||
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, inputLow = 0, inputHigh = 1, outputLow = 0, outputHigh = 1, trig = 1, blocking = 1|
|
^FluidProxyUgen.kr(\FluidBufScaleTrigger, -1, source, startFrame, numFrames, startChan, numChans, destination, inputLow, inputHigh, outputLow, outputHigh, trig, blocking);
|
||||||
^this.new1('control', source, startFrame, numFrames, startChan, numChans, destination, inputLow, inputHigh, outputLow, outputHigh, trig, blocking);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, inputLow = 0, inputHigh = 1, outputLow = 0, outputHigh = 1, action|
|
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, inputLow = 0, inputHigh = 1, outputLow = 0, outputHigh = 1, freeWhenDone = true, action|
|
||||||
^FluidNRTProcess.new(
|
|
||||||
server, this, action, [destination], blocking:1
|
source = source.asUGenInput;
|
||||||
).process(
|
destination = destination.asUGenInput;
|
||||||
source, startFrame, numFrames, startChan, numChans, destination, inputLow, inputHigh, outputLow, outputHigh
|
|
||||||
);
|
source.isNil.if {"FluidBufScale: Invalid source buffer".throw};
|
||||||
|
destination.isNil.if {"FluidBufScale: Invalid destination buffer".throw};
|
||||||
|
|
||||||
|
^this.new(
|
||||||
|
server, nil, [destination]
|
||||||
|
).processList(
|
||||||
|
[source, startFrame, numFrames, startChan, numChans, destination, inputLow, inputHigh, outputLow, outputHigh, 0], freeWhenDone, action
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, inputLow = 0, inputHigh = 1, outputLow = 0, outputHigh = 1, action|
|
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, inputLow = 0, inputHigh = 1, outputLow = 0, outputHigh = 1, freeWhenDone = true, action|
|
||||||
^process(
|
|
||||||
source, startFrame, numFrames, startChan, numChans, destination, inputLow, inputHigh, outputLow, outputHigh
|
source = source.asUGenInput;
|
||||||
|
destination = destination.asUGenInput;
|
||||||
|
|
||||||
|
source.isNil.if {"FluidBufScale: Invalid source buffer".throw};
|
||||||
|
destination.isNil.if {"FluidBufScale: Invalid destination buffer".throw};
|
||||||
|
|
||||||
|
^this.new(
|
||||||
|
server, nil, [destination]
|
||||||
|
).processList(
|
||||||
|
[source, startFrame, numFrames, startChan, numChans, destination, inputLow, inputHigh, outputLow, outputHigh, 1], freeWhenDone, action
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,29 +1,33 @@
|
|||||||
FluidBufThreadDemo : UGen{
|
FluidBufThreadDemo : FluidBufProcessor{
|
||||||
|
|
||||||
|
*kr {|result, time, trig = 1, blocking = 0|
|
||||||
|
|
||||||
*new1 {|rate, result, time, trig = 1, blocking = 0 |
|
|
||||||
result = result.asUGenInput;
|
result = result.asUGenInput;
|
||||||
result.isNil.if {this.class.name+": Invalid output buffer".throw};
|
result.isNil.if {this.class.name+": Invalid output buffer".throw};
|
||||||
^super.new1(rate, result, time, trig, blocking);
|
|
||||||
|
^FluidProxyUgen.kr(\FluidBufThreadDemoTrigger, -1, result, time, trig, blocking);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*process { |server, result, time = 1000, freeWhenDone = true, action|
|
||||||
|
|
||||||
*kr {|result, time, trig = 1, blocking = 0|
|
|
||||||
^this.new1(\control, result, time, trig, blocking);
|
|
||||||
}
|
|
||||||
|
|
||||||
*process { |server, result, time = 1000, action|
|
result ?? {this.class.name+": Invalid output buffer".throw};
|
||||||
^FluidNRTProcess.new(
|
|
||||||
server, this, action, [result]
|
^this.new(
|
||||||
).process(
|
server, nil, [result]
|
||||||
result, time
|
).processList(
|
||||||
|
[result.asUGenInput, time, 0], freeWhenDone, action
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
*processBlocking { |server, result, time = 1000, action|
|
*processBlocking { |server, result, time = 1000, freeWhenDone = true, action|
|
||||||
^FluidNRTProcess.new(
|
|
||||||
server, this, action, [result], blocking: 1
|
result ?? {this.class.name+": Invalid output buffer".throw};
|
||||||
).process(
|
|
||||||
result, time
|
^this.new(
|
||||||
|
server, nil, [result]
|
||||||
|
).processList(
|
||||||
|
[result.asUGenInput, time, 1], freeWhenDone, action
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,31 +1,45 @@
|
|||||||
FluidBufThresh : UGen {
|
FluidBufThresh : FluidBufProcessor {
|
||||||
|
|
||||||
*new1 { |rate, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, threshold = 0, trig = 1, blocking|
|
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, threshold = 0, trig = 1, blocking = 1|
|
||||||
|
|
||||||
source = source.asUGenInput;
|
source = source.asUGenInput;
|
||||||
destination = destination.asUGenInput;
|
destination = destination.asUGenInput;
|
||||||
|
|
||||||
source.isNil.if {"FluidBufThresh: Invalid source buffer".throw};
|
source.isNil.if {"FluidBufThresh: Invalid source buffer".throw};
|
||||||
destination.isNil.if {"FluidBufThresh: Invalid destination buffer".throw};
|
destination.isNil.if {"FluidBufThresh: Invalid destination buffer".throw};
|
||||||
^super.new1(rate, source, startFrame, numFrames, startChan, numChans, destination, threshold, trig, blocking);
|
|
||||||
}
|
|
||||||
|
|
||||||
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, threshold = 0, trig = 1, blocking = 1|
|
^FluidProxyUgen.kr(\FluidBufThreshTrigger, -1, source, startFrame, numFrames, startChan, numChans, destination, threshold, trig, blocking);
|
||||||
^this.new1('control', source, startFrame, numFrames, startChan, numChans, destination, threshold, trig, blocking);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, threshold = 0, action|
|
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, threshold = 0, freeWhenDone = true, action|
|
||||||
^FluidNRTProcess.new(
|
|
||||||
server, this, action, [destination], blocking:1
|
source = source.asUGenInput;
|
||||||
).process(
|
destination = destination.asUGenInput;
|
||||||
source, startFrame, numFrames, startChan, numChans, destination, threshold
|
|
||||||
|
source.isNil.if {"FluidBufThresh: Invalid source buffer".throw};
|
||||||
|
destination.isNil.if {"FluidBufThresh: Invalid destination buffer".throw};
|
||||||
|
|
||||||
|
^this.new(
|
||||||
|
server, nil, [destination],
|
||||||
|
).processList(
|
||||||
|
[source, startFrame, numFrames, startChan, numChans, destination, threshold, 0], freeWhenDone, action
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, threshold = 0, action|
|
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, threshold = 0, freeWhenDone = true, action|
|
||||||
^process(
|
|
||||||
source, startFrame, numFrames, startChan, numChans, destination, threshold
|
source = source.asUGenInput;
|
||||||
|
destination = destination.asUGenInput;
|
||||||
|
|
||||||
|
source.isNil.if {"FluidBufThresh: Invalid source buffer".throw};
|
||||||
|
destination.isNil.if {"FluidBufThresh: Invalid destination buffer".throw};
|
||||||
|
|
||||||
|
^this.new(
|
||||||
|
server, nil, [destination],
|
||||||
|
).processList(
|
||||||
|
[source, startFrame, numFrames, startChan, numChans, destination, threshold, 1], freeWhenDone, action
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,36 +1,43 @@
|
|||||||
FluidBufTransients : UGen {
|
FluidBufTransients : FluidBufProcessor {
|
||||||
|
|
||||||
|
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, transients = -1, residual = -1, order = 20, blockSize = 256, padSize = 128, skew = 0, threshFwd = 2, threshBack = 1.1, windowSize = 14, clumpLength = 25, trig = 1, blocking = 0|
|
||||||
*new1 { |rate, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, transients = -1, residual = -1, order = 20, blockSize = 256, padSize = 128, skew = 0, threshFwd = 2, threshBack = 1.1, windowSize = 14, clumpLength = 25, trig = 1, blocking = 0 |
|
|
||||||
|
|
||||||
source = source.asUGenInput;
|
source = source.asUGenInput;
|
||||||
transients = transients.asUGenInput;
|
transients = transients ? -1;
|
||||||
residual = residual.asUGenInput;
|
residual = residual ? -1;
|
||||||
|
|
||||||
source.isNil.if {"FluidBufTransients: Invalid source buffer".throw};
|
source.isNil.if {"FluidBufTransients: Invalid source buffer".throw};
|
||||||
|
|
||||||
^super.new1(rate, source, startFrame, numFrames, startChan, numChans, transients, residual, order, blockSize, padSize, skew, threshFwd, threshBack, windowSize, clumpLength, trig, blocking);
|
^FluidProxyUgen.kr(\FluidBufTransientsTrigger, -1, source, startFrame, numFrames, startChan, numChans, transients, residual, order, blockSize, padSize, skew, threshFwd, threshBack, windowSize, clumpLength, trig, blocking);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, transients = -1, residual = -1, order = 20, blockSize = 256, padSize = 128, skew = 0, threshFwd = 2, threshBack = 1.1, windowSize = 14, clumpLength = 25, freeWhenDone = true, action|
|
||||||
|
|
||||||
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, transients = -1, residual = -1, order = 20, blockSize = 256, padSize = 128, skew = 0, threshFwd = 2, threshBack = 1.1, windowSize = 14, clumpLength = 25, trig = 1, blocking = 0|
|
source = source.asUGenInput;
|
||||||
^this.multiNew(\control, source, startFrame, numFrames, startChan, numChans, transients, residual, order, blockSize, padSize, skew, threshFwd, threshBack, windowSize, clumpLength, trig, blocking);
|
transients = transients ? -1;
|
||||||
|
residual = residual ? -1;
|
||||||
|
|
||||||
}
|
source.isNil.if {"FluidBufTransients: Invalid source buffer".throw};
|
||||||
|
|
||||||
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, transients = -1, residual = -1, order = 20, blockSize = 256, padSize = 128, skew = 0, threshFwd = 2, threshBack = 1.1, windowSize = 14, clumpLength = 25, action|
|
^this.new(
|
||||||
^FluidNRTProcess.new(
|
server, nil,[transients, residual].select{|x| x!= -1}
|
||||||
server, this, action,[transients, residual].select{|x| x!= -1}
|
).processList(
|
||||||
).process(
|
[source, startFrame, numFrames, startChan, numChans, transients, residual, order, blockSize, padSize, skew, threshFwd, threshBack, windowSize, clumpLength,0],freeWhenDone,action
|
||||||
source, startFrame, numFrames, startChan, numChans, transients, residual, order, blockSize, padSize, skew, threshFwd, threshBack, windowSize, clumpLength
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, transients = -1, residual = -1, order = 20, blockSize = 256, padSize = 128, skew = 0, threshFwd = 2, threshBack = 1.1, windowSize = 14, clumpLength = 25, action|
|
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, transients = -1, residual = -1, order = 20, blockSize = 256, padSize = 128, skew = 0, threshFwd = 2, threshBack = 1.1, windowSize = 14, clumpLength = 25, freeWhenDone = true, action|
|
||||||
^FluidNRTProcess.new(
|
|
||||||
server, this, action,[transients, residual].select{|x| x!= -1}, blocking: 1
|
source = source.asUGenInput;
|
||||||
).process(
|
transients = transients ? -1;
|
||||||
source, startFrame, numFrames, startChan, numChans, transients, residual, order, blockSize, padSize, skew, threshFwd, threshBack, windowSize, clumpLength
|
residual = residual ? -1;
|
||||||
|
|
||||||
|
source.isNil.if {"FluidBufTransients: Invalid source buffer".throw};
|
||||||
|
|
||||||
|
^this.new(
|
||||||
|
server, nil,[transients, residual].select{|x| x!= -1}
|
||||||
|
).processList(
|
||||||
|
[source, startFrame, numFrames, startChan, numChans, transients, residual, order, blockSize, padSize, skew, threshFwd, threshBack, windowSize, clumpLength,1],freeWhenDone = true,action
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,91 +1,64 @@
|
|||||||
|
|
||||||
FluidDataSetExistsError : Exception{
|
FluidDataSet : FluidDataObject
|
||||||
}
|
{
|
||||||
|
|
||||||
FluidDataSet : FluidManipulationClient {
|
|
||||||
|
|
||||||
var <id;
|
|
||||||
classvar serverCaches;
|
|
||||||
|
|
||||||
*initClass {
|
|
||||||
serverCaches = FluidServerCache.new;
|
|
||||||
}
|
|
||||||
|
|
||||||
*at{ |server, name|
|
|
||||||
^serverCaches.tryPerform(\at, server, name)
|
|
||||||
}
|
|
||||||
|
|
||||||
*new { |server, name|
|
|
||||||
if(this.at(server,name).notNil){
|
|
||||||
FluidDataSetExistsError("A FluidDataset called % already exists.".format(name)).throw;
|
|
||||||
^nil
|
|
||||||
}
|
|
||||||
^super.new(server,FluidManipulationClient.prServerString(name))!?{|inst|inst.init(name);inst}
|
|
||||||
}
|
|
||||||
|
|
||||||
init {|name|
|
|
||||||
this.baseinit(FluidManipulationClient.prServerString(name));
|
|
||||||
id = name;
|
|
||||||
this.cache;
|
|
||||||
}
|
|
||||||
|
|
||||||
cache {
|
|
||||||
serverCaches.initCache(server);
|
|
||||||
serverCaches.put(server,id,this);
|
|
||||||
}
|
|
||||||
|
|
||||||
*asUGenInput { |input|
|
addPointMsg{|label,buffer|
|
||||||
var ascii = input.asString.ascii;
|
buffer = this.prEncodeBuffer(buffer);
|
||||||
^[ascii.size].addAll(ascii)
|
^this.prMakeMsg(\addPoint,id,label.asSymbol,buffer);
|
||||||
}
|
|
||||||
|
|
||||||
asString {
|
|
||||||
^"FluidDataSet(%)".format(id).asString;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
asSymbol {
|
addPoint{|label, buffer, action|
|
||||||
^id.asSymbol
|
actions[\addPoint] = [nil,action];
|
||||||
|
this.prSendMsg(this.addPointMsg(label,buffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
addPoint{|label, buffer, action|
|
getPointMsg{|label,buffer|
|
||||||
buffer = this.prEncodeBuffer(buffer);
|
buffer = this.prEncodeBuffer(buffer);
|
||||||
this.prSendMsg(\addPoint,[label.asSymbol,buffer],action);
|
^this.prMakeMsg(\getPoint,id,label.asSymbol,buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
getPoint{|label, buffer, action|
|
getPoint{|label, buffer, action|
|
||||||
|
actions[\getPoint] = [nil,action];
|
||||||
|
this.prSendMsg(this.getPointMsg(label,buffer));
|
||||||
|
}
|
||||||
|
|
||||||
|
updatePointMsg{|label,buffer|
|
||||||
buffer = this.prEncodeBuffer(buffer);
|
buffer = this.prEncodeBuffer(buffer);
|
||||||
this.prSendMsg(\getPoint,[label.asSymbol,buffer],action,outputBuffers:[buffer]);
|
^this.prMakeMsg(\updatePoint,id,label.asSymbol,buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
updatePoint{|label, buffer, action|
|
updatePoint{|label, buffer, action|
|
||||||
buffer = this.prEncodeBuffer(buffer);
|
actions[\updatePoint] = [nil,action];
|
||||||
this.prSendMsg(\updatePoint,[label.asSymbol,buffer],action,outputBuffers:[buffer]);
|
this.prSendMsg(this.updatePointMsg(label,buffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
deletePoint{|label, action|
|
deletePointMsg{|label| ^this.prMakeMsg(\deletePoint,id);}
|
||||||
this.prSendMsg(\deletePoint,[label.asSymbol],action);
|
|
||||||
|
deletePoint{|label, buffer, action|
|
||||||
|
actions[\deletePoint] = [nil,action];
|
||||||
|
this.prSendMsg(this.deletePointMsg(label));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clearMsg { ^this.prMakeMsg(\clear,id); }
|
||||||
|
|
||||||
clear { |action|
|
clear { |action|
|
||||||
this.prSendMsg(\clear,[],action);
|
actions[\clear] = [nil,action];
|
||||||
|
this.prSendMsg(this.clearMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
merge{|sourceDataSet, overwrite = 0, action|
|
mergeMsg{|sourceDataSet, overwrite = 0|
|
||||||
this.prSendMsg(\merge,
|
^this.prMakeMsg(\merge,id,sourceDataSet.asUGenInput,overwrite);
|
||||||
[sourceDataSet.asSymbol, overwrite], action);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print { |action|
|
merge{|sourceDataSet, overwrite = 0, action|
|
||||||
action ?? {action = postit};
|
actions[\merge] = [nil,action];
|
||||||
this.prSendMsg(\print,[],action,[string(FluidMessageResponse,_,_)]);
|
this.prSendMsg(this.mergeMsg(sourceDataSet,overwrite));
|
||||||
}
|
}
|
||||||
|
|
||||||
free {
|
printMsg { ^this.prMakeMsg(\print,id); }
|
||||||
serverCaches.remove(server,id);
|
|
||||||
super.free;
|
|
||||||
}
|
|
||||||
|
|
||||||
*freeAll { |server|
|
print { |action=(postResponse)|
|
||||||
serverCaches.do(server,{|x|x.free;});
|
actions[\print] = [string(FluidMessageResponse,_,_),action];
|
||||||
|
this.prSendMsg(this.printMsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,52 +1,84 @@
|
|||||||
|
|
||||||
FluidDataSetQuery : FluidManipulationClient {
|
FluidDataSetQuery : FluidDataObject {
|
||||||
|
|
||||||
*new {|server|
|
addColumnMsg { |column|
|
||||||
var uid = UniqueID.next;
|
^this.prMakeMsg(\addColumn,id,column);
|
||||||
^super.new(server,uid)!?{|inst|inst.init(uid);inst}
|
|
||||||
}
|
|
||||||
|
|
||||||
init {|uid|
|
|
||||||
id = uid;
|
|
||||||
this.baseinit(uid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
addColumn{|column, action|
|
addColumn{|column, action|
|
||||||
this.prSendMsg(\addColumn, [column], action);
|
actions[\addColumn] = [nil,action];
|
||||||
|
this.prSendMsg(this.addColumnMsg(column));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addRangeMsg{|start,count|
|
||||||
|
^this.prMakeMsg(\addRange,id,start,count);
|
||||||
|
}
|
||||||
|
|
||||||
addRange{|start, count, action|
|
addRange{|start, count, action|
|
||||||
this.prSendMsg(\addRange, [start, count], action);
|
actions[\addRange] = [nil, action];
|
||||||
|
this.prSendMsg(this.addRangeMsg(start, count));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
filterMsg{|column, condition, value, action|
|
||||||
|
^this.prMakeMsg(\filter,id,column,condition.asSymbol,value);
|
||||||
|
}
|
||||||
|
|
||||||
filter{|column, condition, value, action|
|
filter{|column, condition, value, action|
|
||||||
this.prSendMsg(\filter, [column, condition.asSymbol, value], action);
|
actions[\filter] = [nil, action];
|
||||||
|
this.prSendMsg(this.filterMsg(column, condition, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
andMsg{ |column, condition, value|
|
||||||
|
^this.prMakeMsg(\and,id,column, condition.asSymbol, value);
|
||||||
|
}
|
||||||
|
|
||||||
and{|column, condition, value, action|
|
and{|column, condition, value, action|
|
||||||
this.prSendMsg(\and, [column, condition, value], action);
|
actions[\and] = [nil, action];
|
||||||
|
this.prSendMsg(this.andMsg(column,condition,value));
|
||||||
|
}
|
||||||
|
|
||||||
|
orMsg{|column, condition, value|
|
||||||
|
^this.prMakeMsg(\or,id,column, condition.asSymbol, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
or{|column, condition, value, action|
|
or{|column, condition, value, action|
|
||||||
this.prSendMsg(\or, [column, condition, value], action);
|
actions[\or] = [nil,action];
|
||||||
|
this.prSendMsg(this.orMsg(column, condition, value));
|
||||||
|
}
|
||||||
|
|
||||||
|
clearMsg{
|
||||||
|
^this.prMakeMsg(\clear,id);
|
||||||
}
|
}
|
||||||
|
|
||||||
clear{|action|
|
clear{|action|
|
||||||
this.prSendMsg(\clear, [], action);
|
actions[\clear] = [nil, action];
|
||||||
|
this.prSendMsg(this.clearMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
limitMsg{|rows|
|
||||||
|
^this.prMakeMsg(\limit,id,rows);
|
||||||
}
|
}
|
||||||
|
|
||||||
limit{|rows, action|
|
limit{|rows, action|
|
||||||
this.prSendMsg(\limit, [rows], action);
|
actions[\limit] = [nil,action];
|
||||||
|
this.prSendMsg(this.limitMsg(rows));
|
||||||
|
}
|
||||||
|
|
||||||
|
transformMsg{|sourceDataSet, destDataSet|
|
||||||
|
^this.prMakeMsg(\transform,id,sourceDataSet.id,destDataSet.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
transform{|sourceDataSet, destDataSet, action|
|
transform{|sourceDataSet, destDataSet, action|
|
||||||
this.prSendMsg(\transform,[sourceDataSet.asSymbol, destDataSet.asSymbol],action);
|
actions[\transform] = [nil,action];
|
||||||
|
this.prSendMsg(this.transformMsg(sourceDataSet,destDataSet));
|
||||||
|
}
|
||||||
|
|
||||||
|
transformJoinMsg{|source1DataSet, source2DataSet, destDataSet|
|
||||||
|
^this.prMakeMsg(\transformJoin,id,source1DataSet.id, source2DataSet.id, destDataSet.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
transformJoin{|source1DataSet, source2DataSet, destDataSet, action|
|
transformJoin{|source1DataSet, source2DataSet, destDataSet, action|
|
||||||
this.prSendMsg(\transformJoin,[source1DataSet.asSymbol, source2DataSet.asSymbol, destDataSet.asSymbol],action);
|
actions[\transformJoin] = [nil,action];
|
||||||
|
this.prSendMsg(this.transformJoinMsg(source1DataSet, source2DataSet, destDataSet));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,12 +1,11 @@
|
|||||||
FluidDataSetWr : UGen {
|
FluidDataSetWr : FluidBufProcessor {
|
||||||
|
*kr { |dataset,labelPrefix = "", labelOffset = 0,buf, trig=1, blocking = 1|
|
||||||
*new1 { |rate, dataset, labelPrefix = "", labelOffset = 0, buf, trig, blocking|
|
var args;
|
||||||
buf ?? {"No input buffer provided".error};
|
buf ?? {"No input buffer provided".error};
|
||||||
^super.new1(rate,*(FluidManipulationClient.prServerString(dataset.asSymbol)
|
labelPrefix = labelPrefix !? {[labelPrefix.asString.size] ++ labelPrefix.asString.ascii} ?? {0};
|
||||||
++ FluidDataSet.asUGenInput(labelPrefix.asSymbol) ++ labelOffset.asInteger.asUGenInput ++buf.asUGenInput ++ trig ++ blocking));
|
|
||||||
}
|
args = [-1] ++ dataset.asUGenInput ++labelPrefix ++ labelOffset.asInteger.asUGenInput ++buf.asUGenInput ++ trig ++ blocking;
|
||||||
|
|
||||||
*kr { |dataset,labelPrefix = "", labelOffset = 0,buf, trig=1, blocking = 0|
|
^FluidProxyUgen.kr(\FluidDataSetWrTrigger,*args);
|
||||||
^this.new1(\control,dataset,labelPrefix,labelOffset, buf, trig, blocking)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,41 +1,60 @@
|
|||||||
FluidKDTree : FluidRTDataClient {
|
FluidKDTree : FluidRealTimeModel
|
||||||
|
{
|
||||||
|
|
||||||
*new {|server,numNeighbours = 1, radius = 0, lookupDataSet = ""|
|
var neighbours,radius,lookup;
|
||||||
var env;
|
|
||||||
var names = [\numNeighbours, \radius]
|
|
||||||
++ this.prServerString(lookupDataSet.asSymbol).collect{|x,i|
|
|
||||||
("lookupDataSet"++i).asSymbol;
|
|
||||||
};
|
|
||||||
|
|
||||||
var values = [numNeighbours, radius] ++ this.prServerString(lookupDataSet.asSymbol);
|
*new{ |server, numNeighbours = 1, radius = 0, lookupDataSet|
|
||||||
var params = [names,values].lace;
|
^super.new(server,[numNeighbours,radius,lookupDataSet ? -1])
|
||||||
|
.numNeighbours_(numNeighbours)
|
||||||
|
.radius_(radius)
|
||||||
|
.lookupDataSet_(lookupDataSet);
|
||||||
|
}
|
||||||
|
|
||||||
|
numNeighbours_{|k|neighbours = k.asInteger; }
|
||||||
|
numNeighbours{ ^neighbours; }
|
||||||
|
|
||||||
/* env = Environment();
|
radius_{|r| radius = r.asUGenInput;}
|
||||||
synthControls[1..].do{|x|
|
radius{ ^radius; }
|
||||||
env.put(x,0);
|
|
||||||
};
|
|
||||||
env.put(\numNeighbours,1); */
|
|
||||||
|
|
||||||
^super.new1(server,params);
|
lookupDataSet_{|ds| lookup = ds ? -1; }
|
||||||
/* env,
|
lookupDataSet{|ds| ^ (lookup ? -1) }
|
||||||
[\numNeighbours]++lookupDataSet); */
|
|
||||||
}
|
prGetParams{^[this.numNeighbours,this.radius,this.lookupDataSet,-1,-1];}
|
||||||
|
|
||||||
|
fitMsg{ |dataSet| ^this.prMakeMsg(\fit,this.id,dataSet.id);}
|
||||||
|
|
||||||
fit{|dataSet,action|
|
fit{|dataSet,action|
|
||||||
this.prSendMsg(\fit, [dataSet.asSymbol], action);
|
actions[\fit] = [nil,action];
|
||||||
|
this.prSendMsg(this.fitMsg(dataSet));
|
||||||
|
}
|
||||||
|
|
||||||
|
kNearestMsg{|buffer|
|
||||||
|
^this.prMakeMsg(\kNearest,id,this.prEncodeBuffer(buffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
kNearest{ |buffer, action|
|
kNearest{ |buffer, action|
|
||||||
this.prSendMsg(\kNearest,
|
actions[\kNearest] = [strings(FluidMessageResponse,_,_),action];
|
||||||
[buffer.asUGenInput], action,
|
this.prSendMsg(this.kNearestMsg(buffer));
|
||||||
[strings(FluidMessageResponse,_,_)]
|
}
|
||||||
);
|
|
||||||
|
kNearestDistMsg {|buffer|
|
||||||
|
^this.prMakeMsg(\kNearestDist,id,this.prEncodeBuffer(buffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
kNearestDist { |buffer, action|
|
kNearestDist { |buffer, action|
|
||||||
this.prSendMsg(\kNearestDist, [buffer.asUGenInput], action,
|
actions[\kNearestDist] = [numbers(FluidMessageResponse,_,nil,_),action];
|
||||||
[numbers(FluidMessageResponse,_,nil,_)]
|
this.prSendMsg(this.kNearestDistMsg(buffer));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
kr{|trig, inputBuffer,outputBuffer, numNeighbours = 1, lookupDataSet|
|
||||||
|
this.numNeighbours_(numNeighbours);
|
||||||
|
lookupDataSet = lookupDataSet ? -1;
|
||||||
|
this.lookupDataSet_(lookupDataSet);
|
||||||
|
this.lookupDataSet.asUGenInput.postln;
|
||||||
|
^FluidProxyUgen.kr('FluidKDTree/query', K2A.ar(trig),
|
||||||
|
id, this.numNeighbours, this.radius, this.lookupDataSet.asUGenInput,
|
||||||
|
this.prEncodeBuffer(inputBuffer),
|
||||||
|
this.prEncodeBuffer(outputBuffer));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,35 +1,68 @@
|
|||||||
FluidKMeans : FluidRTDataClient {
|
FluidKMeans : FluidRealTimeModel {
|
||||||
|
|
||||||
|
var clusters, maxiter;
|
||||||
|
|
||||||
*new {|server, numClusters = 4, maxIter = 100|
|
*new {|server, numClusters = 4, maxIter = 100|
|
||||||
^super.new1(server,[\numClusters,numClusters,\maxIter,maxIter]);
|
^super.new(server,[numClusters,maxIter])
|
||||||
|
.numClusters_(numClusters)
|
||||||
|
.maxIter_(maxIter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
numClusters_{|n| clusters = n.asInteger}
|
||||||
|
numClusters{ ^clusters }
|
||||||
|
|
||||||
|
maxIter_{|i| maxiter = i.asInteger}
|
||||||
|
maxIter{ ^maxiter }
|
||||||
|
|
||||||
|
prGetParams{^[this.numClusters,this.maxIter,-1,-1];}
|
||||||
|
|
||||||
|
fitMsg{ |dataSet| ^this.prMakeMsg(\fit,id,dataSet.id);}
|
||||||
|
|
||||||
fit{|dataSet, action|
|
fit{|dataSet, action|
|
||||||
this.prSendMsg(\fit,
|
actions[\fit] = [
|
||||||
[dataSet.asSymbol], action,
|
numbers( FluidMessageResponse, _, this.numClusters ,_),
|
||||||
[numbers(FluidMessageResponse,_,this.numClusters,_)]
|
action
|
||||||
);
|
];
|
||||||
|
this.prSendMsg(this.fitMsg(dataSet));
|
||||||
|
}
|
||||||
|
|
||||||
|
fitPredictMsg{|dataSet, labelSet|
|
||||||
|
^this.prMakeMsg(\fitPredict, id, dataSet.id, labelSet.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
fitPredict{|dataSet, labelSet,action|
|
fitPredict{|dataSet, labelSet,action|
|
||||||
this.prSendMsg(\fitPredict,
|
actions[\fitPredict] = [
|
||||||
[dataSet.asSymbol,labelSet.asSymbol],
|
numbers(FluidMessageResponse, _, this.numClusters, _),
|
||||||
action,[numbers(FluidMessageResponse,_,this.numClusters,_)]
|
action
|
||||||
);
|
];
|
||||||
|
this.prSendMsg(this.fitPredictMsg(dataSet,labelSet));
|
||||||
|
}
|
||||||
|
|
||||||
|
predictMsg{|dataSet, labelSet|
|
||||||
|
^this.prMakeMsg(\predict, id, dataSet.id, labelSet.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
predict{ |dataSet, labelSet, action|
|
predict{ |dataSet, labelSet, action|
|
||||||
this.prSendMsg(\predict,
|
actions[\predict] = [
|
||||||
[dataSet.asSymbol, labelSet.asSymbol], action,
|
numbers(FluidMessageResponse, _, this.numClusters, _),
|
||||||
[numbers(FluidMessageResponse,_,this.numClusters,_)]
|
action
|
||||||
);
|
];
|
||||||
|
this.prSendMsg(this.predictMsg(dataSet,labelSet));
|
||||||
|
}
|
||||||
|
|
||||||
|
predictPointMsg{|buffer|
|
||||||
|
^this.prMakeMsg(\predictPoint, id, this.prEncodeBuffer(buffer))
|
||||||
}
|
}
|
||||||
|
|
||||||
predictPoint { |buffer, action|
|
predictPoint { |buffer, action|
|
||||||
buffer = this.prEncodeBuffer(buffer);
|
actions[\predictPoint] = [number(FluidMessageResponse,_,_),action];
|
||||||
this.prSendMsg(\predictPoint,
|
this.prSendMsg(this.predictPointMsg(buffer))
|
||||||
[buffer], action,
|
}
|
||||||
[number(FluidMessageResponse,_,_)]
|
|
||||||
);
|
kr{|trig, inputBuffer,outputBuffer|
|
||||||
|
^FluidProxyUgen.kr('FluidKMeans/query', K2A.ar(trig),
|
||||||
|
id, clusters, maxiter,
|
||||||
|
this.prEncodeBuffer(inputBuffer),
|
||||||
|
this.prEncodeBuffer(outputBuffer));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,24 +1,47 @@
|
|||||||
FluidKNNClassifier : FluidRTDataClient {
|
FluidKNNClassifier : FluidRealTimeModel {
|
||||||
|
|
||||||
|
var <>numNeighbours, <>weight;
|
||||||
|
|
||||||
*new {|server, numNeighbours = 3, weight = 1|
|
*new {|server, numNeighbours = 3, weight = 1|
|
||||||
^super.new1(server,[\numNeighbours,numNeighbours,\weight,weight]);
|
^super.new(server,[numNeighbours,weight])
|
||||||
|
.numNeighbours_(numNeighbours)
|
||||||
|
.weight_(weight);
|
||||||
|
}
|
||||||
|
|
||||||
|
prGetParams{^[this.numNeighbours,this.weight,-1,-1];}
|
||||||
|
|
||||||
|
fitMsg{|dataSet, labelSet|
|
||||||
|
^this.prMakeMsg(\fit, id, dataSet.id, labelSet.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
fit{|dataSet, labelSet, action|
|
fit{|dataSet, labelSet, action|
|
||||||
this.prSendMsg(\fit,[dataSet.asSymbol, labelSet.asSymbol], action);
|
actions[\fit] = [nil,action];
|
||||||
|
this.prSendMsg(this.fitMsg(dataSet, labelSet));
|
||||||
|
}
|
||||||
|
|
||||||
|
predictMsg{|dataSet, labelSet|
|
||||||
|
^this.prMakeMsg(\predict, id, dataSet.id, labelSet.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
predict{|dataSet, labelSet, action|
|
predict{|dataSet, labelSet, action|
|
||||||
this.prSendMsg(\predict,
|
actions[\predict] = [nil, action];
|
||||||
[dataSet.asSymbol, labelSet.asSymbol],
|
this.prSendMsg(this.predictMsg(dataSet, labelSet));
|
||||||
action);
|
}
|
||||||
|
|
||||||
|
predictPointMsg{|buffer|
|
||||||
|
^this.prMakeMsg(\predictPoint, id, this.prEncodeBuffer(buffer))
|
||||||
}
|
}
|
||||||
|
|
||||||
predictPoint {|buffer, action|
|
predictPoint {|buffer, action|
|
||||||
buffer = this.prEncodeBuffer(buffer);
|
actions[\predictPoint] = [string(FluidMessageResponse,_,_),action];
|
||||||
this.prSendMsg(\predictPoint,
|
this.prSendMsg(this.predictPointMsg(buffer));
|
||||||
[buffer.asUGenInput], action,
|
|
||||||
[string(FluidMessageResponse,_,_)]
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
kr{|trig, inputBuffer,outputBuffer|
|
||||||
|
^FluidProxyUgen.kr(this.class.name.asString++'/query', K2A.ar(trig),
|
||||||
|
id, this.numNeighbours, this.weight,
|
||||||
|
this.prEncodeBuffer(inputBuffer),
|
||||||
|
this.prEncodeBuffer(outputBuffer));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,25 +1,46 @@
|
|||||||
FluidKNNRegressor : FluidRTDataClient {
|
FluidKNNRegressor : FluidRealTimeModel {
|
||||||
|
|
||||||
|
var <>numNeighbours, <>weight;
|
||||||
|
|
||||||
*new {|server, numNeighbours = 3, weight = 1|
|
*new {|server, numNeighbours = 3, weight = 1|
|
||||||
^super.new1(server,[\numNeighbours,numNeighbours,\weight,weight]);
|
^super.new(server,[numNeighbours,weight])
|
||||||
|
.numNeighbours_(numNeighbours)
|
||||||
|
.weight_(weight);
|
||||||
|
}
|
||||||
|
|
||||||
|
prGetParams{^[this.numNeighbours,this.weight,-1,-1];}
|
||||||
|
|
||||||
|
fitMsg{|sourceDataSet, targetDataSet|
|
||||||
|
^this.prMakeMsg(\fit,this.id,sourceDataSet.id,targetDataSet.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
fit{|sourceDataSet, targetDataSet, action|
|
fit{|sourceDataSet, targetDataSet, action|
|
||||||
this.prSendMsg(\fit,
|
actions[\fit] = [nil,action];
|
||||||
[sourceDataSet.asSymbol, targetDataSet.asSymbol],
|
this.prSendMsg(this.fitMsg(sourceDataSet, targetDataSet));
|
||||||
action
|
}
|
||||||
);
|
|
||||||
|
predictMsg{ |sourceDataSet, targetDataSet|
|
||||||
|
^this.prMakeMsg(\predict,this.id,sourceDataSet.id,targetDataSet.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
predict{ |sourceDataSet, targetDataSet,action|
|
predict{ |sourceDataSet, targetDataSet,action|
|
||||||
this.prSendMsg(\predict,
|
actions[\predict] = [nil, action];
|
||||||
[sourceDataSet.asSymbol, targetDataSet.asSymbol],
|
this.prSendMsg(this.predictMsg(sourceDataSet, targetDataSet));
|
||||||
action);
|
}
|
||||||
|
|
||||||
|
predictPointMsg { |buffer|
|
||||||
|
^this.prMakeMsg(\predictPoint,id, this.prEncodeBuffer(buffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
predictPoint { |buffer, action|
|
predictPoint { |buffer, action|
|
||||||
buffer = this.prEncodeBuffer(buffer);
|
actions[\predictPoint] = [number(FluidMessageResponse,_,_),action];
|
||||||
this.prSendMsg(\predictPoint, [buffer], action,
|
this.prSendMsg(this.predictPointMsg(buffer));
|
||||||
[number(FluidMessageResponse,_,_)]);
|
}
|
||||||
|
|
||||||
|
kr{|trig, inputBuffer,outputBuffer|
|
||||||
|
^FluidProxyUgen.kr(this.class.name.asString++'/query', K2A.ar(trig),
|
||||||
|
id, this.numNeighbours, this.weight,
|
||||||
|
this.prEncodeBuffer(inputBuffer),
|
||||||
|
this.prEncodeBuffer(outputBuffer));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,81 +1,52 @@
|
|||||||
FluidLabelSetExistsError : Exception{
|
FluidLabelSet : FluidDataObject {
|
||||||
}
|
|
||||||
|
|
||||||
FluidLabelSet : FluidManipulationClient {
|
|
||||||
|
|
||||||
var <id;
|
addLabelMsg{|identifier,label|
|
||||||
classvar serverCaches;
|
^this.prMakeMsg(\addLabel,id,identifier.asSymbol,label.asSymbol);
|
||||||
|
|
||||||
*initClass {
|
|
||||||
serverCaches = FluidServerCache.new;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*at{ |server, name|
|
addLabel{|identifier, label, action|
|
||||||
^serverCaches.tryPerform(\at, server, name)
|
actions[\addLabel] = [nil, action];
|
||||||
|
this.prSendMsg(this.addLabelMsg(identifier,label));
|
||||||
}
|
}
|
||||||
|
|
||||||
*new { |server,name|
|
updateLabelMsg{|identifier, label|
|
||||||
serverCaches.at(server,name) !? {
|
^this.prMakeMsg(\updateLabel, id, identifier.asSymbol, label.asSymbol);
|
||||||
FluidLabelSetExistsError("A FluidLabelSet called % already exists.".format(name)).throw;
|
|
||||||
};
|
|
||||||
^super.new(server,FluidManipulationClient.prServerString(name))!?{|inst|inst.init(name);inst}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
init { |name|
|
updateLabel{|identifier, label, action|
|
||||||
this.baseinit(FluidManipulationClient.prServerString(name));
|
actions[\updateLabel] = [nil,action];
|
||||||
id = name;
|
this.prSendMsg(this.updateLabelMsg(identifier,label));
|
||||||
this.cache;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cache {
|
getLabelMsg{|identifier|
|
||||||
serverCaches.initCache(server);
|
^this.prMakeMsg(\getLabel, id, identifier.asSymbol);
|
||||||
serverCaches.put(server,id,this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
asString {
|
getLabel{|identifier, action|
|
||||||
^"FluidLabelSet(%)".format(id).asString;
|
actions[\getLabel] = [string(FluidMessageResponse,_,_),action];
|
||||||
|
this.prSendMsg(this.getLabelMsg(identifier));
|
||||||
}
|
}
|
||||||
|
|
||||||
asSymbol {
|
deleteLabelMsg{|identifier, action|
|
||||||
^id
|
^this.prMakeMsg(\deleteLabel, id, identifier.asSymbol);
|
||||||
}
|
}
|
||||||
|
|
||||||
*asUGenInput { |input|
|
deleteLabel{|identifier, action|
|
||||||
var ascii = input.asString.ascii;
|
actions[\deleteLabel] = [nil, action];
|
||||||
^[ascii.size].addAll(ascii)
|
this.prSendMsg(this.deleteLabelMsg(identifier));
|
||||||
}
|
}
|
||||||
|
|
||||||
addLabel{|id, label, action|
|
clearMsg { ^this.prMakeMsg(\clear,id); }
|
||||||
this.prSendMsg(\addLabel, [id.asString, label.asString],action);
|
|
||||||
}
|
|
||||||
|
|
||||||
updateLabel{|id, label, action|
|
|
||||||
this.prSendMsg(\updateLabel, [id.asString, label.asString],action);
|
|
||||||
}
|
|
||||||
|
|
||||||
getLabel{|id, action|
|
|
||||||
this.prSendMsg(\getLabel, [id.asString], action,[string(FluidMessageResponse,_,_)]);
|
|
||||||
}
|
|
||||||
|
|
||||||
deleteLabel{|id, action|
|
|
||||||
this.prSendMsg(\deleteLabel, [id.asString],action);
|
|
||||||
}
|
|
||||||
|
|
||||||
clear { |action|
|
clear { |action|
|
||||||
this.prSendMsg(\clear,[], action);
|
actions[\clear] = [nil,action];
|
||||||
|
this.prSendMsg(this.clearMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
free {|action|
|
printMsg { ^this.prMakeMsg(\print,id); }
|
||||||
serverCaches.remove(server, id);
|
|
||||||
super.free;
|
|
||||||
}
|
|
||||||
|
|
||||||
*freeAll {|server|
|
|
||||||
serverCaches.do(server,{|x| x.free;});
|
|
||||||
}
|
|
||||||
|
|
||||||
print { |action|
|
print { |action=(postResponse)|
|
||||||
action ?? {action = postit};
|
actions[\print] = [string(FluidMessageResponse,_,_),action];
|
||||||
this.prSendMsg(\print,[], action, [string(FluidMessageResponse,_,_)]);
|
this.prSendMsg(this.printMsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,103 +1,151 @@
|
|||||||
FluidMLPRegressor : FluidRTDataClient {
|
FluidMLPRegressor : FluidRealTimeModel {
|
||||||
|
|
||||||
const <identity = 0;
|
const <identity = 0;
|
||||||
const <sigmoid = 1;
|
const <sigmoid = 1;
|
||||||
const <relu = 2;
|
const <relu = 2;
|
||||||
const <tanh = 3;
|
const <tanh = 3;
|
||||||
|
|
||||||
|
var <>hidden, <>activation, <>outputActivation, <>tapIn, <>tapOut, <>maxIter, <>learnRate, <>momentum, <>batchSize, <>validation;
|
||||||
|
|
||||||
*new {|server, hidden = #[3,3] , activation = 2, outputActivation = 0, tapIn = 0, tapOut = -1,maxIter = 1000, learnRate = 0.0001, momentum = 0.9, batchSize = 50, validation = 0.2|
|
*new {|server, hidden = #[3,3] , activation = 2, outputActivation = 0, tapIn = 0, tapOut = -1,maxIter = 1000, learnRate = 0.0001, momentum = 0.9, batchSize = 50, validation = 0.2|
|
||||||
var hiddenCtrlLabels;
|
|
||||||
hidden = [hidden.size]++hidden;
|
^super.new(server, [hidden.size] ++ hidden ++ [activation, outputActivation, tapIn, tapOut, maxIter, learnRate, momentum, batchSize, validation])
|
||||||
|
.hidden_(hidden)
|
||||||
hiddenCtrlLabels = hidden.collect{|x,i| \hidden++i};
|
.activation_(activation)
|
||||||
|
.outputActivation_(outputActivation)
|
||||||
^super.new1(server,
|
.tapIn_(tapIn)
|
||||||
[hiddenCtrlLabels,hidden].lace ++
|
.tapOut_(tapOut)
|
||||||
[
|
.maxIter_(maxIter)
|
||||||
\activation,activation,
|
.learnRate_(learnRate)
|
||||||
\outputActivation, outputActivation,
|
.momentum_(momentum)
|
||||||
\tapIn, tapIn,
|
.batchSize_(batchSize)
|
||||||
\tapOut, tapOut,
|
.validation_(validation);
|
||||||
\maxIter, maxIter,
|
}
|
||||||
\learnRate,learnRate,
|
|
||||||
\momentum, momentum,
|
prGetParams{
|
||||||
\batchsize,batchSize,
|
^[this.hidden.size] ++ this.hidden ++ [this.activation, this.outputActivation, this.tapIn, this.tapOut, this.maxIter, this.learnRate, this.momentum, this.batchSize, this.validation, -1, -1]
|
||||||
\validation,validation,
|
|
||||||
])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clearMsg{ ^this.prMakeMsg(\clear, id) }
|
||||||
|
|
||||||
clear{ |action|
|
clear{ |action|
|
||||||
this.prSendMsg(\clear,action:action);
|
actions[\clear] = [nil, action];
|
||||||
|
this.prSendMsg(this.clearMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
fitMsg{|sourceDataSet, targetDataSet|
|
||||||
|
^this.prMakeMsg(\fit,id,sourceDataSet.id, targetDataSet.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
fit{|sourceDataSet, targetDataSet, action|
|
fit{|sourceDataSet, targetDataSet, action|
|
||||||
this.prSendMsg(\fit,
|
actions[\fit] = [numbers(FluidMessageResponse,_,1,_),action];
|
||||||
[sourceDataSet.asSymbol, targetDataSet.asSymbol],
|
this.prSendMsg(this.fitMsg(sourceDataSet,targetDataSet));
|
||||||
action,numbers(FluidMessageResponse,_,1,_)
|
}
|
||||||
);
|
|
||||||
|
predictMsg{|sourceDataSet, targetDataSet|
|
||||||
|
^this.prMakeMsg(\predict,id,sourceDataSet.id, targetDataSet.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
predict{|sourceDataSet, targetDataSet, action|
|
predict{|sourceDataSet, targetDataSet, action|
|
||||||
this.prSendMsg(\predict,
|
actions[\predict] = [nil,action];
|
||||||
[sourceDataSet.asSymbol, targetDataSet.asSymbol],
|
this.prSendMsg(this.predictMsg(sourceDataSet,targetDataSet));
|
||||||
action);
|
}
|
||||||
|
|
||||||
|
|
||||||
|
predictPointMsg { |sourceBuffer, targetBuffer|
|
||||||
|
^this.prMakeMsg(\predictPoint,id,
|
||||||
|
this.prEncodeBuffer(sourceBuffer),
|
||||||
|
this.prEncodeBuffer(targetBuffer),
|
||||||
|
["/b_query", targetBuffer.asUGenInput]);
|
||||||
}
|
}
|
||||||
|
|
||||||
predictPoint { |sourceBuffer, targetBuffer, action|
|
predictPoint { |sourceBuffer, targetBuffer, action|
|
||||||
sourceBuffer = this.prEncodeBuffer(sourceBuffer);
|
actions[\predictPoint] = [nil,{action.value(targetBuffer)}];
|
||||||
targetBuffer = this.prEncodeBuffer(targetBuffer);
|
this.predictPointMsg(sourceBuffer, targetBuffer).postln;
|
||||||
this.prSendMsg(\predictPoint,
|
this.prSendMsg(this.predictPointMsg(sourceBuffer, targetBuffer));
|
||||||
[sourceBuffer.asUGenInput, targetBuffer.asUGenInput], action,outputBuffers:[targetBuffer]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
kr{|trig, inputBuffer,outputBuffer, tapIn = 0, tapOut = -1|
|
||||||
|
var params;
|
||||||
|
tapIn = tapIn ? this.tapIn;
|
||||||
|
tapOut = tapOut ? this.tapOut;
|
||||||
|
|
||||||
|
this.tapIn_(tapIn).tapOut_(tapOut);
|
||||||
|
|
||||||
|
params = this.prGetParams.drop(-2) ++ [this.prEncodeBuffer(inputBuffer),
|
||||||
|
this.prEncodeBuffer(outputBuffer)];
|
||||||
|
|
||||||
|
^FluidProxyUgen.kr(this.class.name.asString++'/query', K2A.ar(trig),
|
||||||
|
id, *params);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FluidMLPClassifier : FluidRTDataClient {
|
FluidMLPClassifier : FluidRealTimeModel {
|
||||||
|
|
||||||
const <identity = 0;
|
const <identity = 0;
|
||||||
const <sigmoid = 1;
|
const <sigmoid = 1;
|
||||||
const <relu = 2;
|
const <relu = 2;
|
||||||
const <tanh = 3;
|
const <tanh = 3;
|
||||||
|
|
||||||
*new {|server, hidden = #[3,3] , activation = 2, maxIter = 1000, learnRate = 0.0001, momentum = 0.9, batchSize = 50, validation = 0.2|
|
var <>hidden, <>activation, <> maxIter, <>learnRate, <> momentum, <>batchSize, <>validation;
|
||||||
var hiddenCtrlLabels;
|
|
||||||
hidden = [hidden.size]++hidden;
|
|
||||||
|
|
||||||
hiddenCtrlLabels = hidden.collect{|x,i| \hidden++i};
|
*new {|server, hidden = #[3,3] , activation = 2, maxIter = 1000, learnRate = 0.0001, momentum = 0.9, batchSize = 50, validation = 0.2|
|
||||||
|
^super.new(server,[hidden.size] ++ hidden ++ [activation, maxIter, learnRate, momentum, batchSize, validation])
|
||||||
|
.hidden_(hidden)
|
||||||
|
.activation_(activation)
|
||||||
|
.maxIter_(maxIter)
|
||||||
|
.learnRate_(learnRate)
|
||||||
|
.momentum_(momentum)
|
||||||
|
.batchSize_(batchSize)
|
||||||
|
.validation_(validation);
|
||||||
|
}
|
||||||
|
|
||||||
^super.new1(server,
|
prGetParams{
|
||||||
[hiddenCtrlLabels,hidden].lace ++
|
^[ this.hidden.size] ++ this.hidden ++ [this.activation, this.maxIter, this.learnRate, this.momentum, this.batchSize, this.validation, -1, -1];
|
||||||
[
|
|
||||||
\activation,activation,
|
|
||||||
\maxIter, maxIter,
|
|
||||||
\learnRate,learnRate,
|
|
||||||
\momentum, momentum,
|
|
||||||
\batchsize,batchSize,
|
|
||||||
\validation,validation,
|
|
||||||
])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clearMsg{ ^this.prMakeMsg(\clear,id) }
|
||||||
|
|
||||||
clear{ |action|
|
clear{ |action|
|
||||||
this.prSendMsg(\clear,action:action);
|
actions[\clear] = [nil,action];
|
||||||
|
this.prSendMsg(this.clearMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fitMsg{|sourceDataSet, targetLabelSet|
|
||||||
|
^this.prMakeMsg(\fit,id,sourceDataSet.id, targetLabelSet.id);
|
||||||
|
}
|
||||||
|
|
||||||
fit{|sourceDataSet, targetLabelSet, action|
|
fit{|sourceDataSet, targetLabelSet, action|
|
||||||
this.prSendMsg(\fit,
|
actions[\fit] = [numbers(FluidMessageResponse,_,1,_),action];
|
||||||
[sourceDataSet.asSymbol, targetLabelSet.asSymbol],
|
this.prSendMsg(this.fitMsg(sourceDataSet,targetLabelSet));
|
||||||
action,numbers(FluidMessageResponse,_,1,_)
|
}
|
||||||
);
|
|
||||||
|
predictMsg{|sourceDataSet, targetLabelSet|
|
||||||
|
^this.prMakeMsg(\predict,id,sourceDataSet.id, targetLabelSet.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
predict{ |sourceDataSet, targetLabelSet, action|
|
predict{ |sourceDataSet, targetLabelSet, action|
|
||||||
this.prSendMsg(\predict,
|
actions[\predict]=[nil,action];
|
||||||
[sourceDataSet.asSymbol, targetLabelSet.asSymbol],
|
this.prSendMsg(this.predictMsg(sourceDataSet,targetLabelSet));
|
||||||
action);
|
}
|
||||||
|
|
||||||
|
predictPointMsg { |sourceBuffer|
|
||||||
|
^this.prMakeMsg(\predictPoint,id,this.prEncodeBuffer(sourceBuffer))
|
||||||
}
|
}
|
||||||
|
|
||||||
predictPoint { |sourceBuffer, action|
|
predictPoint { |sourceBuffer, action|
|
||||||
sourceBuffer = this.prEncodeBuffer(sourceBuffer);
|
actions[\predictPoint] = [string(FluidMessageResponse,_,_),action];
|
||||||
this.prSendMsg(\predictPoint,
|
this.prSendMsg(this.predictPointMsg(sourceBuffer));
|
||||||
[sourceBuffer], action, string(FluidMessageResponse,_,_));
|
}
|
||||||
|
|
||||||
|
kr{|trig, inputBuffer,outputBuffer|
|
||||||
|
|
||||||
|
var params = this.prGetParams.drop(-2) ++ [this.prEncodeBuffer(inputBuffer),
|
||||||
|
this.prEncodeBuffer(outputBuffer)];
|
||||||
|
|
||||||
|
^FluidProxyUgen.kr(this.class.name.asString++'/query', K2A.ar(trig),
|
||||||
|
id, *params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,31 +1,68 @@
|
|||||||
FluidNormalize : FluidRTDataClient {
|
FluidNormalize : FluidRealTimeModel {
|
||||||
|
|
||||||
|
var <>min, <>max, <>invert;
|
||||||
|
|
||||||
*new {|server, min = 0, max = 1, invert = 0|
|
*new {|server, min = 0, max = 1, invert = 0|
|
||||||
^super.new1(server,[\min,min,\max,max, \invert, invert]);
|
^super.new(server,[min,max,invert])
|
||||||
|
.min_(min).max_(max).invert_(invert);
|
||||||
|
}
|
||||||
|
|
||||||
|
prGetParams{
|
||||||
|
^[this.min,this.max,this.invert,-1,-1];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fitMsg{|dataSet|
|
||||||
|
^this.prMakeMsg(\fit,id,dataSet.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
fit{|dataSet, action|
|
fit{|dataSet, action|
|
||||||
this.prSendMsg(\fit,[dataSet.asSymbol], action);
|
actions[\fit] = [nil,action];
|
||||||
|
this.prSendMsg(this.fitMsg(dataSet));
|
||||||
|
}
|
||||||
|
|
||||||
|
transformMsg{|sourceDataSet, destDataSet|
|
||||||
|
^this.prMakeMsg(\transform,id,sourceDataSet.id,destDataSet.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
transform{|sourceDataSet, destDataSet, action|
|
transform{|sourceDataSet, destDataSet, action|
|
||||||
this.prSendMsg(\transform,
|
actions[\transform] = [nil,action];
|
||||||
[sourceDataSet.asSymbol, destDataSet.asSymbol], action
|
this.prSendMsg(this.transformMsg(sourceDataSet, destDataSet));
|
||||||
);
|
}
|
||||||
|
|
||||||
|
fitTransformMsg{|sourceDataSet, destDataSet|
|
||||||
|
^this.prMakeMsg(\fitTransform,id,sourceDataSet.id,destDataSet.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
fitTransform{|sourceDataSet, destDataSet, action|
|
fitTransform{|sourceDataSet, destDataSet, action|
|
||||||
this.prSendMsg(\fitTransform,
|
actions[\fitTransform] = [nil,action];
|
||||||
[sourceDataSet.asSymbol, destDataSet.asSymbol], action
|
this.prSendMsg(this.fitTransformMsg(sourceDataSet, destDataSet));
|
||||||
|
}
|
||||||
|
|
||||||
|
transformPointMsg{|sourceBuffer, destBuffer|
|
||||||
|
^this.prMakeMsg(\transformPoint,id,
|
||||||
|
this.prEncodeBuffer(sourceBuffer),
|
||||||
|
this.prEncodeBuffer(destBuffer),
|
||||||
|
["/b_query",destBuffer.asUGenInput]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
transformPoint{|sourceBuffer, destBuffer, action|
|
transformPoint{|sourceBuffer, destBuffer, action|
|
||||||
sourceBuffer = this.prEncodeBuffer(sourceBuffer);
|
actions[\transformPoint] = [nil,{action.value(destBuffer)}];
|
||||||
destBuffer = this.prEncodeBuffer(destBuffer);
|
this.prSendMsg(this.transformPointMsg(sourceBuffer, destBuffer));
|
||||||
this.prSendMsg(\transformPoint,
|
}
|
||||||
[sourceBuffer, destBuffer], action,
|
|
||||||
outputBuffers:[destBuffer]
|
kr{|trig, inputBuffer,outputBuffer,min,max,invert|
|
||||||
);
|
|
||||||
|
min = min ? this.min;
|
||||||
|
max = max ? this.max;
|
||||||
|
invert = invert ? this.invert;
|
||||||
|
|
||||||
|
this.min_(min).max_(max).invert_(invert);
|
||||||
|
|
||||||
|
^FluidProxyUgen.kr(this.class.name.asString++'/query', K2A.ar(trig),
|
||||||
|
id, this.min, this.max, this.invert, this.prEncodeBuffer(inputBuffer), this.prEncodeBuffer(outputBuffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,24 +1,62 @@
|
|||||||
FluidPCA : FluidRTDataClient {
|
FluidPCA : FluidRealTimeModel{
|
||||||
|
|
||||||
|
var <>numDimensions;
|
||||||
|
|
||||||
*new {|server, numDimensions = 2|
|
*new {|server, numDimensions = 2|
|
||||||
^super.new1(server,[\numDimensions,numDimensions]);
|
^super.new(server,[numDimensions]).numDimensions_(numDimensions);
|
||||||
|
}
|
||||||
|
|
||||||
|
prGetParams{
|
||||||
|
^[numDimensions,-1,-1];
|
||||||
|
}
|
||||||
|
|
||||||
|
fitMsg{|dataSet|
|
||||||
|
^this.prMakeMsg(\fit,id, dataSet.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
fit{|dataSet, action|
|
fit{|dataSet, action|
|
||||||
this.prSendMsg(\fit,[dataSet.asSymbol], action);
|
actions[\fit] = [nil, action];
|
||||||
|
this.prSendMsg(this.fitMsg(dataSet));
|
||||||
|
}
|
||||||
|
|
||||||
|
transformMsg{|sourceDataSet, destDataSet|
|
||||||
|
^this.prMakeMsg(\transform, id, sourceDataSet.id, destDataSet.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
transform{|sourceDataSet, destDataSet, action|
|
transform{|sourceDataSet, destDataSet, action|
|
||||||
this.prSendMsg(\transform,[sourceDataSet.asSymbol, destDataSet.asSymbol], action, [numbers(FluidMessageResponse,_,1,_)]);
|
actions[\transform] = [numbers(FluidMessageResponse,_,1,_),action];
|
||||||
|
this.prSendMsg(this.transformMsg(sourceDataSet,destDataSet));
|
||||||
|
}
|
||||||
|
|
||||||
|
fitTransformMsg{|sourceDataSet, destDataSet|
|
||||||
|
^this.prMakeMsg(\fitTransform,id, sourceDataSet.id, destDataSet.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
fitTransform{|sourceDataSet, destDataSet, action|
|
fitTransform{|sourceDataSet, destDataSet, action|
|
||||||
this.prSendMsg(\fitTransform,[sourceDataSet.asSymbol, destDataSet.asSymbol], action, [numbers(FluidMessageResponse,_,1,_)]);
|
actions[\fitTransform] = [numbers(FluidMessageResponse,_,1,_),action];
|
||||||
|
this.prSendMsg(this.fitTransformMsg(sourceDataSet,destDataSet));
|
||||||
|
}
|
||||||
|
|
||||||
|
transformPointMsg{|sourceBuffer, destBuffer|
|
||||||
|
^this.prMakeMsg(\transformPoint,id,
|
||||||
|
this.prEncodeBuffer(sourceBuffer),
|
||||||
|
this.prEncodeBuffer(destBuffer),
|
||||||
|
["/b_query",destBuffer.asUGenInput]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
transformPoint{|sourceBuffer, destBuffer, action|
|
transformPoint{|sourceBuffer, destBuffer, action|
|
||||||
sourceBuffer = this.prEncodeBuffer(sourceBuffer);
|
actions[\transformPoint] = [nil,{action.value(destBuffer)}];
|
||||||
destBuffer = this.prEncodeBuffer(destBuffer);
|
this.prSendMsg(this.transformPointMsg(sourceBuffer,destBuffer));
|
||||||
this.prSendMsg(\transformPoint,[sourceBuffer, destBuffer], action, outputBuffers:[destBuffer]);
|
}
|
||||||
|
|
||||||
|
kr{|trig, inputBuffer,outputBuffer,numDimensions|
|
||||||
|
|
||||||
|
numDimensions = numDimensions ? this.numDimensions;
|
||||||
|
this.numDimensions_(numDimensions);
|
||||||
|
|
||||||
|
^FluidProxyUgen.kr(this.class.name.asString++'/query', K2A.ar(trig),
|
||||||
|
id, this.numDimensions, this.prEncodeBuffer(inputBuffer), this.prEncodeBuffer(outputBuffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,85 @@
|
|||||||
|
FluidProxyUgen : UGen {
|
||||||
|
|
||||||
|
var <>pluginname;
|
||||||
|
|
||||||
|
*kr { |pluginname...args|
|
||||||
|
pluginname.postln;
|
||||||
|
^this.new1('control', pluginname,*args)
|
||||||
|
}
|
||||||
|
|
||||||
|
init { |pluginname...args|
|
||||||
|
this.pluginname = pluginname;
|
||||||
|
inputs = args;
|
||||||
|
rate = 'control';
|
||||||
|
}
|
||||||
|
|
||||||
|
name{
|
||||||
|
^pluginname.asString;
|
||||||
|
}
|
||||||
|
|
||||||
|
poll{ |trig = 10, label, trigid = -1|
|
||||||
|
^super.poll(trig, label ? this.name, trigid)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FluidServerCache {
|
||||||
|
|
||||||
|
var <cache;
|
||||||
|
|
||||||
|
*new{ ^super.new.init }
|
||||||
|
|
||||||
|
init{
|
||||||
|
cache = IdentityDictionary.new;
|
||||||
|
}
|
||||||
|
|
||||||
|
do { |server, func|
|
||||||
|
cache[server]!?{cache[server].do{|x|func.value(x)}}
|
||||||
|
}
|
||||||
|
|
||||||
|
doAll {|func|
|
||||||
|
cache.do{|subCache|
|
||||||
|
subCache.do{|item|
|
||||||
|
func.value(item)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
postln{
|
||||||
|
cache.postln;
|
||||||
|
}
|
||||||
|
|
||||||
|
at { |server,id|
|
||||||
|
^cache[server].tryPerform(\at,id)
|
||||||
|
}
|
||||||
|
|
||||||
|
includesKey{|server,key|
|
||||||
|
^cache[server].tryPerform(\includesKey,key)
|
||||||
|
}
|
||||||
|
|
||||||
|
put {|server,id,x|
|
||||||
|
cache[server][id] = x;
|
||||||
|
}
|
||||||
|
|
||||||
|
remove { |server,id|
|
||||||
|
cache[server]!? {cache[server].removeAt(id)};
|
||||||
|
}
|
||||||
|
|
||||||
|
initCache {|server|
|
||||||
|
cache[server] ?? {
|
||||||
|
cache[server] = IdentityDictionary.new;
|
||||||
|
NotificationCenter.register(server,\newAllocators,this,
|
||||||
|
{
|
||||||
|
this.clearCache(server);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
clearCache { |server|
|
||||||
|
cache[server] !?
|
||||||
|
{
|
||||||
|
cache[server].do(_.free);
|
||||||
|
cache.removeAt(server)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,299 @@
|
|||||||
|
FluidServerObject
|
||||||
|
{
|
||||||
|
classvar serverCaches;
|
||||||
|
classvar count;
|
||||||
|
classvar persistent = true;
|
||||||
|
var <server,<id;
|
||||||
|
|
||||||
|
*initClass {
|
||||||
|
// serverCaches = FluidServerCache.new;
|
||||||
|
serverCaches = IdentityDictionary.new;
|
||||||
|
count = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
*initCache {|server|
|
||||||
|
serverCaches[this] ?? {serverCaches[this] = FluidServerCache.new};
|
||||||
|
serverCaches[this].initCache(server);
|
||||||
|
NotificationCenter.register(server,\newAllocators,this,{ count = 0; });
|
||||||
|
}
|
||||||
|
|
||||||
|
*newMsg{|id, params|
|
||||||
|
params = params !? {params.collect(_.asUGenInput)};
|
||||||
|
// ("Newms"++params).postln;
|
||||||
|
^['/cmd',this.objectClassName ++ '/new',id] ++ params
|
||||||
|
}
|
||||||
|
|
||||||
|
*new{ |server, id, params, action, callNew = true|
|
||||||
|
var newObj;
|
||||||
|
server ?? {server = Server.default};
|
||||||
|
if(server.serverRunning.not){"Server not running".warn};
|
||||||
|
id !? { id = id.asInteger }
|
||||||
|
?? { id = count; count = count + 1; };
|
||||||
|
newObj = super.newCopyArgs(server,id,action);
|
||||||
|
// params.postln;
|
||||||
|
if(callNew) {server.listSendMsg(this.newMsg(id,params))};
|
||||||
|
^newObj.cache
|
||||||
|
}
|
||||||
|
|
||||||
|
cache {
|
||||||
|
this.class.initCache(server);
|
||||||
|
serverCaches[this.class].put(server,this.id,this);
|
||||||
|
}
|
||||||
|
|
||||||
|
uncache{
|
||||||
|
serverCaches[this.class].remove(server,id);
|
||||||
|
}
|
||||||
|
|
||||||
|
prMakeMsg{|msg,id...args|
|
||||||
|
^['/cmd',"%/%".format(this.class.objectClassName,msg),id].addAll(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
freeMsg {
|
||||||
|
var msg;
|
||||||
|
id ?? {" % already freed".format(this.class.name).warn; ^nil};
|
||||||
|
this.uncache;
|
||||||
|
msg = this.prMakeMsg(\free,id);
|
||||||
|
id = nil;
|
||||||
|
^msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
free{
|
||||||
|
var msg = this.freeMsg;
|
||||||
|
msg !? {server.listSendMsg(msg)} ?? {^nil};
|
||||||
|
}
|
||||||
|
|
||||||
|
asUGenInput{ ^id }
|
||||||
|
|
||||||
|
asString {
|
||||||
|
^"%(%)".format(this.class.name,id).asString;
|
||||||
|
}
|
||||||
|
|
||||||
|
asSymbol {
|
||||||
|
^id.asSymbol
|
||||||
|
}
|
||||||
|
|
||||||
|
*objectClassName { ^this.name.asSymbol }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
FluidBufProcessor : FluidServerObject
|
||||||
|
{
|
||||||
|
var <processAction;
|
||||||
|
var <outputBuffers;
|
||||||
|
var <freeWhenDone;
|
||||||
|
classvar responder;
|
||||||
|
|
||||||
|
*cmdPeriod {
|
||||||
|
serverCaches[this].doAll{|processor| processor.free; };
|
||||||
|
count = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
*initCache {|server|
|
||||||
|
// "initcache".postln;
|
||||||
|
// this.done.postln;
|
||||||
|
super.initCache(server);
|
||||||
|
CmdPeriod.add(this);
|
||||||
|
if(serverCaches[this].includesKey(server,\processResponder).not)
|
||||||
|
{
|
||||||
|
serverCaches[this].put(server,\processResponder,OSCFunc({|m|
|
||||||
|
var id = m.last.asInteger;
|
||||||
|
// "I'm in the pizza hut".postln;
|
||||||
|
serverCaches[this].at(server,id) !? {|p|
|
||||||
|
// "I'm in the taco bell".postln ;
|
||||||
|
p!?{
|
||||||
|
p.processAction!?{|a|
|
||||||
|
var bufs = p.outputBuffers;
|
||||||
|
|
||||||
|
bufs = bufs.collect{|b|
|
||||||
|
if(b.isKindOf(Buffer))
|
||||||
|
{b}
|
||||||
|
{Buffer.cachedBufferAt(server,b)};
|
||||||
|
};
|
||||||
|
a.valueArray(valueArray(bufs));
|
||||||
|
};
|
||||||
|
if(p.freeWhenDone){p.free};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},this.done ,server.addr).fix)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*new {|server,id,outputBuffers|
|
||||||
|
^super.new(server,id, nil, nil,false).init(outputBuffers);
|
||||||
|
}
|
||||||
|
|
||||||
|
init{ |ob|
|
||||||
|
outputBuffers = ob;
|
||||||
|
}
|
||||||
|
|
||||||
|
*done {
|
||||||
|
^"/%/process".format(this.objectClassName);
|
||||||
|
}
|
||||||
|
|
||||||
|
wait {
|
||||||
|
var condition = Condition.new;
|
||||||
|
OSCFunc({
|
||||||
|
condition.unhang;
|
||||||
|
},this.class.done,server.addr).oneShot;
|
||||||
|
condition.hang;
|
||||||
|
}
|
||||||
|
|
||||||
|
processMsg {|params|
|
||||||
|
var msg;
|
||||||
|
var completionMsg = outputBuffers !? {
|
||||||
|
[["/sync"]] ++ outputBuffers.collect{|b| ["/b_query", b.asUGenInput]}
|
||||||
|
} ?? {[]};
|
||||||
|
|
||||||
|
// completionMsg.postln;
|
||||||
|
id ?? {Error("% already freed".format(this.class.name)).throw};
|
||||||
|
msg = this.prMakeMsg(\processNew,id).addAll(params).add(completionMsg);
|
||||||
|
// msg.postln;
|
||||||
|
^msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
processList { |params,shouldFree,action|
|
||||||
|
freeWhenDone = shouldFree;
|
||||||
|
processAction = action;
|
||||||
|
params = params.collect(_.asUGenInput);
|
||||||
|
server.listSendMsg(this.processMsg(params));
|
||||||
|
}
|
||||||
|
|
||||||
|
cancelMsg{
|
||||||
|
id ?? {Error("% already freed".format(this.class.name)).throw};
|
||||||
|
^this.prMakeMsg(\cancel, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
cancel{
|
||||||
|
server.listSendMsg(this.cancelMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
kr{ ^FluidProxyUgen.kr(this.objectClassName ++ "Monitor",id) }
|
||||||
|
}
|
||||||
|
|
||||||
|
FluidOSCPatternInversion : OSCMessageDispatcher
|
||||||
|
{
|
||||||
|
value {|msg, time, addr, recvPort|
|
||||||
|
var msgpath = msg[0];
|
||||||
|
active.keysValuesDo({|key, func|
|
||||||
|
if(msgpath.matchOSCAddressPattern(key), {func.value(msg, time, addr, recvPort);});
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FluidDataObject : FluidServerObject
|
||||||
|
{
|
||||||
|
classvar postResponse;
|
||||||
|
|
||||||
|
var <actions;
|
||||||
|
|
||||||
|
*initClass{
|
||||||
|
postResponse = _.postln;
|
||||||
|
}
|
||||||
|
|
||||||
|
*initCache{ |server|
|
||||||
|
super.initCache(server);
|
||||||
|
if(serverCaches[this].includesKey(server,\messageResponder).not)
|
||||||
|
{
|
||||||
|
serverCaches[this].put(server,\messageResponder,OSCFunc.new({|m|
|
||||||
|
var id = m[2].asInteger;
|
||||||
|
var method;
|
||||||
|
// "I'm in the maccydees".postln;
|
||||||
|
serverCaches[this].at(server,id) !? { |p|
|
||||||
|
// "I'm in the burger king".postln ;
|
||||||
|
// m.postln;
|
||||||
|
method = m[0].asString.findRegexp("/"++this.name++"/(.*)")[1][1].asSymbol;
|
||||||
|
/* p.postln;
|
||||||
|
p.actions[method].postln;*/
|
||||||
|
p.actions[method] !? {|a|
|
||||||
|
//two items: parser and action
|
||||||
|
var parser = a[0];
|
||||||
|
var action = a[1];
|
||||||
|
var result = FluidMessageResponse.collectArgs(parser,m[3..]);
|
||||||
|
action.value(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},'/' ++ this.objectClassName ++ '/*',server.addr, dispatcher:FluidOSCPatternInversion.new).fix)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*new{|server...args|
|
||||||
|
// args.flatten.postln;
|
||||||
|
^super.new(server,params:args.flatten).init;
|
||||||
|
}
|
||||||
|
|
||||||
|
*cachedInstanceAt{|server,id|
|
||||||
|
this.initCache;
|
||||||
|
^serverCaches[this].at(server,id);
|
||||||
|
}
|
||||||
|
|
||||||
|
init {
|
||||||
|
actions = IdentityDictionary.new;
|
||||||
|
}
|
||||||
|
|
||||||
|
prEncodeBuffer { |buf| buf !? {^buf.asUGenInput} ?? {^-1} }
|
||||||
|
|
||||||
|
prSendMsg {|msg| server !? {server.listSendMsg(msg)};}
|
||||||
|
|
||||||
|
colsMsg { ^this.prMakeMsg(\cols,id);}
|
||||||
|
|
||||||
|
cols{ |action=(postResponse)|
|
||||||
|
actions[\cols] = [numbers(FluidMessageResponse,_,1,_),action];
|
||||||
|
this.prSendMsg(this.colsMsg)
|
||||||
|
}
|
||||||
|
|
||||||
|
readMsg { |filename| ^this.prMakeMsg(\read,id,filename.asString);}
|
||||||
|
|
||||||
|
read{|filename, action|
|
||||||
|
actions[\read] = [nil,action];
|
||||||
|
this.prSendMsg(this.readMsg(filename));
|
||||||
|
}
|
||||||
|
|
||||||
|
writeMsg {|filename|
|
||||||
|
// ^['/cmd',this.class.name ++ '/write',id,filename.asString]
|
||||||
|
^this.prMakeMsg(\write,id,filename.asString);
|
||||||
|
}
|
||||||
|
|
||||||
|
write{|filename, action|
|
||||||
|
actions[\write] = [nil,action];
|
||||||
|
this.prSendMsg(this.writeMsg(filename));
|
||||||
|
}
|
||||||
|
|
||||||
|
sizeMsg{
|
||||||
|
// ^['/cmd',this.class.name ++ '/size',id]
|
||||||
|
^this.prMakeMsg(\size,id);
|
||||||
|
}
|
||||||
|
|
||||||
|
size {|action=(postResponse)|
|
||||||
|
actions[\size] = [numbers(FluidMessageResponse,_,1,_),action];
|
||||||
|
this.prSendMsg(this.sizeMsg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FluidModelObject : FluidDataObject
|
||||||
|
{
|
||||||
|
prGetParams{
|
||||||
|
"Subclass should provide this".throw;
|
||||||
|
}
|
||||||
|
|
||||||
|
prUpdateStateMsg{
|
||||||
|
var params = this.prGetParams.value.collect(_.asUGenInput);
|
||||||
|
^this.prMakeMsg(\setParams,id) ++ params;
|
||||||
|
}
|
||||||
|
|
||||||
|
prSendMsg {|msg|
|
||||||
|
server !? { server.bind(
|
||||||
|
{
|
||||||
|
super.prSendMsg(this.prUpdateStateMsg);
|
||||||
|
super.prSendMsg(msg);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FluidRealTimeModel : FluidModelObject
|
||||||
|
{
|
||||||
|
*new{ |server, params|
|
||||||
|
^super.new(server,params++[-1,-1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,29 +1,58 @@
|
|||||||
FluidStandardize : FluidRTDataClient {
|
FluidStandardize : FluidRealTimeModel {
|
||||||
|
|
||||||
|
var <>invert;
|
||||||
|
|
||||||
*new {|server, invert = 0|
|
*new {|server, invert = 0|
|
||||||
^super.new1(server,[\invert, invert]);
|
^super.new(server,[invert]).invert_(invert);
|
||||||
|
}
|
||||||
|
|
||||||
|
prGetParams{
|
||||||
|
^[this.invert, -1, 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
fitMsg{|dataSet|
|
||||||
|
^this.prMakeMsg(\fit,id,dataSet.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
fit{|dataSet, action|
|
fit{|dataSet, action|
|
||||||
this.prSendMsg(\fit, [dataSet.asSymbol], action);
|
actions[\fit] = [nil, action];
|
||||||
|
this.prSendMsg(this.fitMsg(dataSet));
|
||||||
|
}
|
||||||
|
|
||||||
|
transformMsg{|sourceDataSet, destDataSet|
|
||||||
|
^this.prMakeMsg(\transform,id,sourceDataSet.id,destDataSet.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
transform{|sourceDataSet, destDataSet, action|
|
transform{|sourceDataSet, destDataSet, action|
|
||||||
this.prSendMsg(\transform,
|
actions[\transform] = [nil,action];
|
||||||
[sourceDataSet.asSymbol, destDataSet.asSymbol], action
|
this.prSendMsg(this.transformMsg(sourceDataSet,destDataSet));
|
||||||
);
|
}
|
||||||
|
|
||||||
|
fitTransformMsg{|sourceDataSet, destDataSet|
|
||||||
|
^this.prMakeMsg(\fitTransform,id,sourceDataSet.id,destDataSet.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
fitTransform{|sourceDataSet, destDataSet, action|
|
fitTransform{|sourceDataSet, destDataSet, action|
|
||||||
this.prSendMsg(\fitTransform,
|
actions[\fitTransform] = [nil,action];
|
||||||
[sourceDataSet.asSymbol, destDataSet.asSymbol], action
|
this.prSendMsg(this.fitTransformMsg(sourceDataSet, destDataSet));
|
||||||
);
|
}
|
||||||
|
|
||||||
|
|
||||||
|
transformPointMsg{|sourceBuffer, destBuffer|
|
||||||
|
^this.prMakeMsg(\transformPoint, id, this.prEncodeBuffer(sourceBuffer), this.prEncodeBuffer(destBuffer),["/b_query",destBuffer.asUGenInput]);
|
||||||
}
|
}
|
||||||
|
|
||||||
transformPoint{|sourceBuffer, destBuffer, action|
|
transformPoint{|sourceBuffer, destBuffer, action|
|
||||||
sourceBuffer = this.prEncodeBuffer(sourceBuffer);
|
actions[\transformPoint] = [nil, {action.value(destBuffer)}];
|
||||||
destBuffer = this.prEncodeBuffer(destBuffer);
|
this.prSendMsg(this.transformPointMsg(sourceBuffer,destBuffer));
|
||||||
this.prSendMsg(\transformPoint,
|
}
|
||||||
[sourceBuffer, destBuffer], action, outputBuffers:[destBuffer]
|
|
||||||
);
|
kr{|trig, inputBuffer,outputBuffer,invert|
|
||||||
|
|
||||||
|
invert = invert ? this.invert;
|
||||||
|
this.invert_(invert);
|
||||||
|
|
||||||
|
^FluidProxyUgen.kr(this.class.name.asString++'/query', K2A.ar(trig),
|
||||||
|
id, this.invert, this.prEncodeBuffer(inputBuffer), this.prEncodeBuffer(outputBuffer));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue