Mercurial > hg > beaglert
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/ClockSyncThread.h Sat Sep 12 20:05:55 2015 +0100 @@ -0,0 +1,48 @@ +#ifndef CLOCK_SYNC_THREAD_H_INCLUDED +#define CLOCK_SYNC_THREAD_H_INCLUDED + +#ifdef USE_JUCE +#include <JuceHeader.h> +#define IS_STATIC +#else +#define IS_STATIC static +#include <BeagleRT.h> +#endif /*USE_JUCE*/ + +#include "ClockSync.h" + +#ifdef USE_JUCE +class ClockSyncThread : public Thread { +#else +class ClockSyncThread { +#endif /* USE_JUCE */ +private: + IS_STATIC myClock_t lastTime; // Used for clock synchronization + IS_STATIC bool listening; + IS_STATIC ClockSync clockSync; + IS_STATIC VirtualClock *virtualClock; +#ifdef USE_JUCE +#else + IS_STATIC bool threadIsExiting; + IS_STATIC AuxiliaryTask clockSyncTask; +#endif /* USE_JUCE */ + +public: +#ifdef USE_JUCE + ClockSyncThread(const String &threadName); +#else + ClockSyncThread(); +#endif /* USE_JUCE */ + ~ClockSyncThread(); + IS_STATIC void init(bool isSlave, int aPort, VirtualClock &aVirtualClock); + IS_STATIC void setVirtualClock(VirtualClock &aVirtualClock); + + IS_STATIC void run(); +#ifdef USE_JUCE +#else + IS_STATIC void startThread(); + IS_STATIC void stopThread(); + IS_STATIC bool threadShouldExit(); +#endif // USE_JUCE +}; +#endif // CLOCK_SYNC_THREAD_H_INCLUDED