comparison projects/scope/render.cpp @ 151:e9c9404e3d1f ClockSync

Pff partially working. No PID. When setting the audio clock on the bbb to 44098 the master and slave clock keep diverging instead of converging ...
author Giulio Moro <giuliomoro@yahoo.it>
date Tue, 22 Sep 2015 04:10:07 +0100
parents 134bff10e561
children 8f98b32d0e23
comparison
equal deleted inserted replaced
150:ebbfb154351a 151:e9c9404e3d1f
74 static int count=0; 74 static int count=0;
75 if(count==0){ 75 if(count==0){
76 // BeagleRT_scheduleAuxiliaryTask(testTime); 76 // BeagleRT_scheduleAuxiliaryTask(testTime);
77 clockSyncThread.startThread(); //make sure you uncomment .init in setup() 77 clockSyncThread.startThread(); //make sure you uncomment .init in setup()
78 } 78 }
79 /*
80 switch (count){
81 case 5000:
82 gAudioCodec->setAudioSamplingRate(44101);
83 printf("0 0 0\n");
84 break;
85 case 10000:
86 gAudioCodec->setAudioSamplingRate(44100);
87 printf("0 0 0\n");
88 break;
89 case 15000:
90 gAudioCodec->setAudioSamplingRate(44099);
91 printf("0 0 0\n");
92 break;
93 case 20000:
94 gAudioCodec->setAudioSamplingRate(44100);
95 printf("0 0 0\n");
96 count = 0;
97 break;
98 }
99 */
79 static float phase=0; 100 static float phase=0;
80 float phaseInc=gFrequency1/44100.0*2*M_PI; 101 float phaseInc=gFrequency1/44100.0*2*M_PI;
81 // rt_printf("phaseInc: %f, phase: %f\n",phaseInc,phase); 102 // rt_printf("phaseInc: %f, phase: %f\n",phaseInc,phase);
82 for(unsigned int n=0; n<context->audioFrames; n++){ 103 for(unsigned int n=0; n<context->audioFrames; n++){
83 context->audioOut[n*2]=sinf(phase);//context->audioIn[n*2]; 104 context->audioOut[n*2]=sinf(phase);//context->audioIn[n*2];