# HG changeset patch # User Giulio Moro # Date 1440164239 -3600 # Node ID 26ad97b8aa9eb85b0aa86a0c183830bb606e4328 # Parent ada68d50e56a24bd05fa7ef402ce3009f1ea0977 Missing file from previous commit diff -r ada68d50e56a -r 26ad97b8aa9e projects/scope/render.cpp --- a/projects/scope/render.cpp Thu Aug 20 16:37:15 2015 +0100 +++ b/projects/scope/render.cpp Fri Aug 21 14:37:19 2015 +0100 @@ -51,19 +51,19 @@ for(unsigned int n = 0; n < context->audioFrames; n++) { float chn0 = sinf(gPhase1); - float chn1 = sinf(gPhase2); + // float chn1 = sinf(gPhase2); - float chn2 = context->audioIn[n*2 + 0]; - float chn3 = context->audioIn[n*2 + 1]; + // float chn2 = context->audioIn[n*2 + 0]; + // float chn3 = context->audioIn[n*2 + 1]; - float chn4 = context->analogIn[(int)n/2*8 + 0]; - float chn5 = context->analogIn[(int)n/2*8 + 1]; - scope.log(0, chn0); - scope.log(1, chn1); - scope.log(2, chn2); - scope.log(3, chn3); - scope.log(4, chn4); - scope.log(5, chn5); + // float chn4 = context->analogIn[(int)n/2*8 + 0]; + // float chn5 = context->analogIn[(int)n/2*8 + 1]; + scope.log(0, chn0); + // scope.log(1, chn1); + // scope.log(2, chn2); + // scope.log(3, chn3); + // scope.log(4, chn4); + // scope.log(5, chn5); // scope.log(chn1, chn2, chn3, chn4, chn5, chn6); //call this once every audio frame @@ -73,15 +73,25 @@ //then click the big red button on the toolbar on this page gPhase1 += 2.0 * M_PI * gFrequency1 * gInverseSampleRate * ((count&4095)/4096.0+1); - gPhase2 += 2.0 * M_PI * gFrequency2 * gInverseSampleRate; + gPhase2 += 2.0 * M_PI * gFrequency2 * gInverseSampleRate; if(gPhase1 > 2.0 * M_PI) gPhase1 -= 2.0 * M_PI; if(gPhase2 > 2.0 * M_PI) gPhase2 -= 2.0 * M_PI; } - if(count>100) - receiveAudio.getSamplesSrc(context->audioOut, context->audioFrames, 1); + static float buffer[32]; //this should be context->audioFrames + if(count==0){ + for(int n=0; n<32; n++) + buffer[n]=0; + } + if(count>0){ + int readPointer=receiveAudio.getSamplesSrc(buffer, context->audioFrames, 1); + for(int n=0; naudioFrames; n++){ + context->audioOut[n*2]=buffer[n]; + context->audioOut[n*2+1]=buffer[n]; + } + } count++; }