nix
Till 4 years ago
parent 4e91cc363e
commit cb690283fa

@ -18,28 +18,25 @@ FluidKrToBuf {
FluidBufToKr {
*kr {
arg buffer, numFrames = -1;
arg buffer numFrames, startFrame=0;
if((buffer.isKindOf(Buffer).or(buffer.isKindOf(LocalBuf))).not.and(numFrames.isNil),{
Error("FluidBufToKr:kr needs to be passed either an existing buffer or an OutputProxy and a number of frames for the buffer that will be supplied").throw;
});
if(numFrames == -1,{
numFrames = buffer.numFrames;
if(buffer.isKindOf(Buffer) or: {buffer.isKindOf(LocalBuf)}, {
numFrames = numFrames ?? {buffer.numFrames - startFrame};
}, {
numFrames = numFrames ? 1;
});
if(numFrames == 0) {"FluidKrToBuf:kr indicated numFrames is zero.".warn};
if(numFrames > 1000) {
Error("FluidKrToBuf: Buffer is indicated to have % frames. This is probably not the buffer you intended.".format(numFrames)).throw;
Error("%: numframes is % frames. This is probably not what you intended.".format(this.class, numFrames)).throw;
};
if(numFrames > 1,{
^numFrames.collect{
arg i;
BufRd.kr(1,buffer,i,0,0);
BufRd.kr(1,buffer,i+startFrame,0,0);
}
},{
^BufRd.kr(1,buffer,0,0,0);
^BufRd.kr(1,buffer,startFrame,0,0);
});
}
}

@ -12,7 +12,15 @@ METHOD:: kr
Initialize an instance of this pseudo UGen
ARGUMENT:: buffer
The link::Classes/Buffer:: that this pseudo UGen will read out of. Must be a one-channel buffer.
Either a link::Classes/Buffer:: object or an index opointing to a buffer that this pseudo UGen will read out of. Must be a one-channel buffer.
ARGUMENT:: numFrames
number of frames to read from the buffer.
Needs to be set, if buffer is not a code::Buffer:: object but a buffer index. If code::nil::, read whole buffer starting at code::startFrame::.
ARGUMENT:: startFrame
offset of reading position in the buffer
ARGUMENT:: numFrames
How many frames the buffer is that will evenutally passed. If providing a buffer directly (instead of as an argument to a SynthDef), the default of -1 will get the number of frames from the buffer passed.

@ -15,10 +15,9 @@ ARGUMENT:: krStream
The Kr stream to write into the buffer.
ARGUMENT:: buffer
The link::Classes/Buffer:: to write the Kr stream into.
returns:: Nothing.
The buffer to write the Kr stream into. Can be either a link::Classes/Buffer:: object, or an index poiting to a buffer.
returns:: This class.
INSTANCEMETHODS::

Loading…
Cancel
Save