Mercurial > hg > beaglert
comparison core/ClockSyncThread.cpp @ 139:4e2dd3eb1d28 ClockSync
The reported offset is now meaningful. The whole thing is waaay too jittery.
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Sun, 13 Sep 2015 21:34:47 +0100 |
parents | e77e2e712fbc |
children | 44d07fa9bd03 |
comparison
equal
deleted
inserted
replaced
138:53e3c0a3295d | 139:4e2dd3eb1d28 |
---|---|
29 clockSync.init(isSlave, aPort, *virtualClock); | 29 clockSync.init(isSlave, aPort, *virtualClock); |
30 #ifdef USE_JUCE | 30 #ifdef USE_JUCE |
31 startThread(5); | 31 startThread(5); |
32 #else | 32 #else |
33 threadIsExiting=false; | 33 threadIsExiting=false; |
34 clockSyncTask=BeagleRT_createAuxiliaryTask(&ClockSyncThread::run,98, "clockSyncTask"); | 34 clockSyncTask=BeagleRT_createAuxiliaryTask(&ClockSyncThread::run,60, "clockSyncTask"); |
35 //TODO: the thread cannot be started here at the moment because init() is called in setup(), where tasks cannot be scheduled | 35 //TODO: the thread cannot be started here at the moment because init() is called in setup(), where tasks cannot be scheduled |
36 #endif /* USE_JUCE */ | 36 #endif /* USE_JUCE */ |
37 } | 37 } |
38 | 38 |
39 #ifdef USE_JUCE | 39 #ifdef USE_JUCE |
56 }; | 56 }; |
57 | 57 |
58 void ClockSyncThread::run(){ | 58 void ClockSyncThread::run(){ |
59 while(!threadShouldExit()){ | 59 while(!threadShouldExit()){ |
60 clockSync.sendReceiveLoop(); | 60 clockSync.sendReceiveLoop(); |
61 usleep(5000); | |
62 // double now=virtualClock->getNow(); | 61 // double now=virtualClock->getNow(); |
63 // printf("th(end+1)=%f;\n", now/44100.0f); | 62 // printf("th(end+1)=%f;\n", now); |
64 // printf("act(end+1)=%lld;\n", Clock::getTimeUs()); | 63 // printf("act(end+1)=%lld;\n", Clock::getTimeUs()); |
65 } | 64 } |
66 printf("Thread is not running \n"); | 65 printf("Thread is not running \n"); |
67 } | 66 } |