fdCompose: reformated class definition, and basic example/tests
parent
1e88c6c451
commit
de78afad68
@ -1,11 +1,14 @@
|
||||
FDCompose{
|
||||
*process { arg server, src, offsetframes1 = 0, numframes1 = -1, offsetchans1 = 0, numchans1 = -1, src1gain = 1, src1dstoffset = 0, src1dstchanoffset = 0, src2, offsetframes2 = 0, numframes2 = -1, offsetchans2 = 0, numchans2 = -1, src2gain = 1, src2dstoffset = 0, src2dstchanoffset = 0, dstbuf;
|
||||
*process { arg server, srcBufNumA, startAtA = 0, nFramesA = -1, startChanA = 0, nChansA = -1, srcGainA = 1, dstStartAtA = 0, dstStartChanA = 0, srcBufNumB, startAtB = 0, nFramesB = -1, startChanB = 0, nChansB = -1, srcGainB = 1, dstStartAtB = 0, dstStartChanB = 0, dstBufNum;
|
||||
|
||||
if(srcBufNumA.isNil) {Error("Invalid Buffer").format(thisMethod.name, this.class.name).throw};
|
||||
if(srcBufNumB.isNil) {Error("Invalid Buffer").format(thisMethod.name, this.class.name).throw};
|
||||
if(dstBufNum.isNil) {Error("Invalid Buffer").format(thisMethod.name, this.class.name).throw};
|
||||
|
||||
server = server ? Server.default;
|
||||
if(src.bufNum.isNil) {Error("Invalid Buffer").format(thisMethod.name, this.class.name).throw};
|
||||
|
||||
server.sendMsg(\cmd, \BufCompose, src.buNum, offsetframes1, numframes1, offsetchans1, numchans1, src1gain, src1dstoffset, src1dstchanoffset,
|
||||
if( src2.isNil, -1, {src2.bufNum}), offsetframes2, numframes2, offsetchans2, numchans2, src2gain, src2dstoffset, src2dstchanoffset,
|
||||
if( dstbuf.isNil, -1, {dstbuf.bufNum}));
|
||||
server.sendMsg(\cmd, \BufCompose, srcBufNumA, startAtA, nFramesA, startChanA, nChansA, srcGainA, dstStartAtA, dstStartChanA,
|
||||
srcBufNumB, startAtB, nFramesB, startChanB, nChansB, srcGainB, dstStartAtB, dstStartChanB,
|
||||
dstBufNum);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
s.reboot
|
||||
////////////////////////////
|
||||
// test for efficiency
|
||||
|
||||
(
|
||||
b = Buffer.read(s,"/Users/pa/Documents/documents@hudd/research/projects/fluid corpus navigation/research/archives-2017-18/denoise_stn/sources/01-mix.wav");
|
||||
c = Buffer.read(s,"/Users/pa/Documents/documents@hudd/research/projects/fluid corpus navigation/research/archives-2017-18/denoise_stn/sources/02-guit.wav");
|
||||
d = Buffer.new(s);
|
||||
)
|
||||
|
||||
(
|
||||
// without basic params
|
||||
Routine{
|
||||
t = Main.elapsedTime;
|
||||
FDCompose.process(s, srcBufNumA: b.bufnum, srcBufNumB: c.bufnum, dstBufNum: d.bufnum);
|
||||
s.sync;
|
||||
(Main.elapsedTime - t).postln;
|
||||
}.play
|
||||
);
|
||||
|
||||
d.query;
|
||||
d.play;
|
||||
d.plot
|
||||
Loading…
Reference in New Issue