Add FluidBufSelect and FluidBufSelectEvery
parent
6ace31d7fb
commit
731b04a208
@ -0,0 +1,67 @@
|
|||||||
|
FluidBufSelect : FluidBufProcessor {
|
||||||
|
|
||||||
|
*kr { |source, destination, indices=#[-1], channels=#[-1], trig = 1, blocking = 1|
|
||||||
|
|
||||||
|
var params;
|
||||||
|
|
||||||
|
source = source.asUGenInput;
|
||||||
|
destination = destination.asUGenInput;
|
||||||
|
|
||||||
|
indices = indices.asArray;
|
||||||
|
channels = channels.asArray;
|
||||||
|
|
||||||
|
indices = [indices.size] ++ indices;
|
||||||
|
channels = [channels.size] ++ channels;
|
||||||
|
|
||||||
|
source.isNil.if {"FluidBufSelect: Invalid source buffer".throw};
|
||||||
|
destination.isNil.if {"FluidBufSelect: Invalid destination buffer".throw};
|
||||||
|
|
||||||
|
params = indices ++ channels ++ [trig, blocking]
|
||||||
|
|
||||||
|
^FluidProxyUgen.kr(\FluidBufSelectTrigger,-1, source, destination, *params);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
*process { |server, source, destination, indices=#[-1], channels=#[-1], freeWhenDone = true, action|
|
||||||
|
|
||||||
|
source = source.asUGenInput;
|
||||||
|
destination = destination.asUGenInput;
|
||||||
|
|
||||||
|
source.isNil.if {"FluidBufSelect: Invalid source buffer".throw};
|
||||||
|
destination.isNil.if {"FluidBufSelect: Invalid destination buffer".throw};
|
||||||
|
|
||||||
|
|
||||||
|
indices = indices.asArray;
|
||||||
|
channels = channels.asArray;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
indices = [indices.size] ++ indices;
|
||||||
|
channels = [channels.size] ++ channels;
|
||||||
|
|
||||||
|
indices.postln;
|
||||||
|
|
||||||
|
^this.new(server, nil, [destination]).processList([source, destination]++ indices ++ channels ++ [1], freeWhenDone, action);//NB always blocking
|
||||||
|
}
|
||||||
|
|
||||||
|
*processBlocking { |server, source, destination, indices=#[-1], channels=#[-1], freeWhenDone = true, action|
|
||||||
|
|
||||||
|
source = source.asUGenInput;
|
||||||
|
destination = destination.asUGenInput;
|
||||||
|
|
||||||
|
source.isNil.if {"FluidBufSelect: Invalid source buffer".throw};
|
||||||
|
destination.isNil.if {"FluidBufSelect: Invalid destination buffer".throw};
|
||||||
|
|
||||||
|
indices = indices.asArray;
|
||||||
|
channels = channels.asArray;
|
||||||
|
|
||||||
|
indices = [indices.size] ++ indices;
|
||||||
|
channels = [channels.size] ++ channels;
|
||||||
|
|
||||||
|
|
||||||
|
^this.new(
|
||||||
|
server, nil, [destination]
|
||||||
|
).processList([source, destination]++ indices ++ channels ++ [1], freeWhenDone, action);//NB always blocking
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FluidBufSelectTrigger : FluidProxyUgen {}
|
||||||
@ -0,0 +1,44 @@
|
|||||||
|
FluidBufSelectEvery : FluidBufProcessor {
|
||||||
|
|
||||||
|
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, frameHop = 1, channelHop = 1, trig = 1, blocking = 1|
|
||||||
|
|
||||||
|
source = source.asUGenInput;
|
||||||
|
destination = destination.asUGenInput;
|
||||||
|
|
||||||
|
source.isNil.if {"FluidBufSelectEvery: Invalid source buffer".throw};
|
||||||
|
destination.isNil.if {"FluidBufSelectEvery: Invalid destination buffer".throw};
|
||||||
|
|
||||||
|
^FluidProxyUgen.kr(\FluidBufSelectEveryTrigger, -1, source, startFrame, numFrames, startChan, numChans, destination, frameHop, channelHop, trig, blocking);
|
||||||
|
}
|
||||||
|
|
||||||
|
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, frameHop = 1, channelHop = 1, freeWhenDone = true, action|
|
||||||
|
|
||||||
|
source = source.asUGenInput;
|
||||||
|
destination = destination.asUGenInput;
|
||||||
|
|
||||||
|
source.isNil.if {"FluidBufSelectEvery: Invalid source buffer".throw};
|
||||||
|
destination.isNil.if {"FluidBufSelectEvery: Invalid destination buffer".throw};
|
||||||
|
|
||||||
|
^this.new(
|
||||||
|
server, nil, [destination]
|
||||||
|
).processList(
|
||||||
|
[source, startFrame, numFrames, startChan, numChans, destination, frameHop, channelHop, 0], freeWhenDone, action
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, frameHop = 1, channelHop = 1, freeWhenDone = true, action|
|
||||||
|
|
||||||
|
source = source.asUGenInput;
|
||||||
|
destination = destination.asUGenInput;
|
||||||
|
|
||||||
|
source.isNil.if {"FluidBufSelectEvery: Invalid source buffer".throw};
|
||||||
|
destination.isNil.if {"FluidBufSelectEvery: Invalid destination buffer".throw};
|
||||||
|
|
||||||
|
^this.new(
|
||||||
|
server, nil, [destination]
|
||||||
|
).processList(
|
||||||
|
[source, startFrame, numFrames, startChan, numChans, destination, frameHop, channelHop, 1], freeWhenDone, action
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FluidBufSelectEveryTrigger : FluidProxyUgen {}
|
||||||
Loading…
Reference in New Issue