Mercurial > hg > beaglert
diff projects/scope/render.cpp @ 149:134bff10e561 ClockSync
Added simple one-variable one-measurement Kalman filter, Pid controller(which output is not used). Virtual clock is now much more precise and reactive for period. Still it is lagging behind a bit on the overall offset.
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Mon, 21 Sep 2015 03:12:21 +0100 |
parents | 55c1e591cb2e |
children | e9c9404e3d1f |
line wrap: on
line diff
--- a/projects/scope/render.cpp Mon Sep 21 03:11:32 2015 +0100 +++ b/projects/scope/render.cpp Mon Sep 21 03:12:21 2015 +0100 @@ -49,7 +49,7 @@ // scope.setPort(1, 10000); // networkSend.setup(context->audioSampleRate, context->audioFrames, 0, 9999, "192.168.7.1"); // clockSynchronizer.setup(); - virtualClock.init(); + virtualClock.init(context->audioFrames / context->audioSampleRate * 1e6); clockSyncThread.init(true, 5000, virtualClock); //start as slave gInverseSampleRate = 1.0/context->audioSampleRate; @@ -84,7 +84,7 @@ phase+=200.0/44100.0*2*M_PI; if(phase>=2*M_PI) phase-=2*M_PI; - context->audioOut[n*2+1]=rand()/(float)RAND_MAX;context->audioIn[n*2]; + context->audioOut[n*2+1]=rand()/(float)RAND_MAX;//context->audioIn[n*2]; } count++; /*