Mercurial > hg > beaglert
annotate include/ClockSyncThread.h @ 135:e77e2e712fbc ClockSync
To work with the ClockSync plugin
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Sat, 12 Sep 2015 20:05:55 +0100 |
parents | |
children |
rev | line source |
---|---|
giuliomoro@135 | 1 #ifndef CLOCK_SYNC_THREAD_H_INCLUDED |
giuliomoro@135 | 2 #define CLOCK_SYNC_THREAD_H_INCLUDED |
giuliomoro@135 | 3 |
giuliomoro@135 | 4 #ifdef USE_JUCE |
giuliomoro@135 | 5 #include <JuceHeader.h> |
giuliomoro@135 | 6 #define IS_STATIC |
giuliomoro@135 | 7 #else |
giuliomoro@135 | 8 #define IS_STATIC static |
giuliomoro@135 | 9 #include <BeagleRT.h> |
giuliomoro@135 | 10 #endif /*USE_JUCE*/ |
giuliomoro@135 | 11 |
giuliomoro@135 | 12 #include "ClockSync.h" |
giuliomoro@135 | 13 |
giuliomoro@135 | 14 #ifdef USE_JUCE |
giuliomoro@135 | 15 class ClockSyncThread : public Thread { |
giuliomoro@135 | 16 #else |
giuliomoro@135 | 17 class ClockSyncThread { |
giuliomoro@135 | 18 #endif /* USE_JUCE */ |
giuliomoro@135 | 19 private: |
giuliomoro@135 | 20 IS_STATIC myClock_t lastTime; // Used for clock synchronization |
giuliomoro@135 | 21 IS_STATIC bool listening; |
giuliomoro@135 | 22 IS_STATIC ClockSync clockSync; |
giuliomoro@135 | 23 IS_STATIC VirtualClock *virtualClock; |
giuliomoro@135 | 24 #ifdef USE_JUCE |
giuliomoro@135 | 25 #else |
giuliomoro@135 | 26 IS_STATIC bool threadIsExiting; |
giuliomoro@135 | 27 IS_STATIC AuxiliaryTask clockSyncTask; |
giuliomoro@135 | 28 #endif /* USE_JUCE */ |
giuliomoro@135 | 29 |
giuliomoro@135 | 30 public: |
giuliomoro@135 | 31 #ifdef USE_JUCE |
giuliomoro@135 | 32 ClockSyncThread(const String &threadName); |
giuliomoro@135 | 33 #else |
giuliomoro@135 | 34 ClockSyncThread(); |
giuliomoro@135 | 35 #endif /* USE_JUCE */ |
giuliomoro@135 | 36 ~ClockSyncThread(); |
giuliomoro@135 | 37 IS_STATIC void init(bool isSlave, int aPort, VirtualClock &aVirtualClock); |
giuliomoro@135 | 38 IS_STATIC void setVirtualClock(VirtualClock &aVirtualClock); |
giuliomoro@135 | 39 |
giuliomoro@135 | 40 IS_STATIC void run(); |
giuliomoro@135 | 41 #ifdef USE_JUCE |
giuliomoro@135 | 42 #else |
giuliomoro@135 | 43 IS_STATIC void startThread(); |
giuliomoro@135 | 44 IS_STATIC void stopThread(); |
giuliomoro@135 | 45 IS_STATIC bool threadShouldExit(); |
giuliomoro@135 | 46 #endif // USE_JUCE |
giuliomoro@135 | 47 }; |
giuliomoro@135 | 48 #endif // CLOCK_SYNC_THREAD_H_INCLUDED |