diff --git a/fdNMF.cpp b/fdNMF.cpp index f270dca..f5e7080 100644 --- a/fdNMF.cpp +++ b/fdNMF.cpp @@ -13,32 +13,32 @@ using fluid::nmf::NMFClient; static InterfaceTable *ft; -void BufNMF(World *world, struct SndBuf *dstBuf, struct sc_msg_iter *msg) +void BufNMF(World *world, struct SndBuf *srcBuf, struct sc_msg_iter *msg) { - size_t dstFrameCount = dstBuf->frames; - size_t dstChanCount = dstBuf->channels; + size_t srcFrameCount = srcBuf->frames; + size_t srcChanCount = srcBuf->channels; - uint32 srcBufNum = msg->geti(); - long rank = msg->geti(); - long iterations = msg->geti(); - long fftSize = msg->geti(); - long windowSize = msg->geti(); - long hopSize = msg->geti(); + size_t dstBufNum = msg->geti(); + size_t rank = msg->geti(); + size_t iterations = msg->geti(); + size_t fftSize = msg->geti(); + size_t windowSize = msg->geti(); + size_t hopSize = msg->geti(); - if (srcBufNum >= world->mNumSndBufs){ - Print("fdNMF is not happy because the source buffer does not exist.\n"); + if (dstBufNum >= world->mNumSndBufs){ + Print("fdNMF is not happy because the destination buffer does not exist.\n"); return; } - SndBuf* srcBuf = world->mSndBufs + srcBufNum; + SndBuf* dstBuf = world->mSndBufs + dstBufNum; if (srcBuf->data == dstBuf->data){ - Print("fdNMF is not happy because the source buffer is the same as the destination buffer.\n"); + Print("fdNMF is not happy because the destination buffer is the same as the source buffer.\n"); return; } - size_t srcFrameCount = srcBuf->frames; - size_t srcChanCount = srcBuf->channels; + size_t dstFrameCount = dstBuf->frames; + size_t dstChanCount = dstBuf->channels; if (dstChanCount < rank) { Print("fdNMF is not happy because the destination buffer has a lower channel count than the number of ranks.\n"); diff --git a/fdfNMF.sc b/fdfNMF.sc index 4658c14..e2ab467 100644 --- a/fdfNMF.sc +++ b/fdfNMF.sc @@ -7,13 +7,12 @@ // responder idea stolen from getToFloatArray resp = OSCFunc({ arg msg; - if(msg[1]== '/b_gen' && msg[2]== dstBuf.bufnum, { - // ("received" + msg).postln; + if(msg[1]== '/b_gen' && msg[2]== bufnum, { resp.clear; - action.value(dstBuf.bufnum); + action.value(bufnum); }); }, '/done', server.addr); - server.listSendMsg([\b_gen, dstBuf.bufnum, "BufNMF", bufnum, rank, iterations, fftSize, windowSize, hopSize]) + server.listSendMsg([\b_gen, bufnum, "BufNMF", dstBuf.bufnum, rank, iterations, fftSize, windowSize, hopSize]) } } diff --git a/tests.scd b/tests.scd index 8971214..11be1f8 100644 --- a/tests.scd +++ b/tests.scd @@ -1,5 +1,4 @@ -s.quit -s.boot +s.reboot //////////////////////////// // test for efficiency @@ -12,7 +11,7 @@ d = Main.elapsedTime; b.fdNMF(c,5, 100, 1024,1024,256,{e = Main.elapsedTime; (e- {(PlayBuf.ar(5,c.bufnum,doneAction:2).sum)+(-1*PlayBuf.ar(1,b.bufnum,doneAction:2))}.play {Splay.ar(PlayBuf.ar(5,c.bufnum,doneAction:2))}.play -{PlayBuf.ar(5,c.bufnum,doneAction:2)[2].dup}.play +{PlayBuf.ar(5,c.bufnum,doneAction:2)[0].dup}.play ////////////////////////////