Mercurial > hg > beaglert
changeset 118:26ad97b8aa9e scope-refactoring
Missing file from previous commit
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Fri, 21 Aug 2015 14:37:19 +0100 |
parents | ada68d50e56a |
children | c692827083e1 |
files | projects/scope/render.cpp |
diffstat | 1 files changed, 24 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- 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; n<context->audioFrames; n++){ + context->audioOut[n*2]=buffer[n]; + context->audioOut[n*2+1]=buffer[n]; + } + } count++; }