diff include/ReceiveAudioThread.h @ 132:e24c531220ee scope-refactoring

Added some sort of synchronization, not working great though
author Giulio Moro <giuliomoro@yahoo.it>
date Thu, 27 Aug 2015 01:42:04 +0100
parents ff28e56e5b7e
children
line wrap: on
line diff
--- a/include/ReceiveAudioThread.h	Wed Aug 26 02:02:10 2015 +0100
+++ b/include/ReceiveAudioThread.h	Thu Aug 27 01:42:04 2015 +0100
@@ -4,12 +4,14 @@
 #ifdef USE_JUCE
 #include <JuceHeader.h>
 #else
+#include <BeagleRT.h>
+#include <UdpServer.h>
 #include <vector>
 #include <iostream>
-#include <UdpServer.h>
-#include <BeagleRT.h>
 #include <native/task.h>
+#include <native/timer.h>
 #include <math.h>
+
 #endif /*USE_JUCE*/
 
 #ifdef USE_JUCE
@@ -50,6 +52,7 @@
     int bytesToRead;
     int threadPriority;
     int channel;
+    int timestamp;
     void dealloc();
     void wrapWritePointer();
     void pushPayload(int startIndex);
@@ -57,6 +60,7 @@
     int readUdpToBuffer();
 #ifdef USE_JUCE
 #else
+    RTIME lastTime; // Used for clock synchronization
     static bool threadShouldExit();
 	static bool staticConstructed;
     static void staticConstructor();
@@ -85,10 +89,12 @@
     		float samplingRateRatio, int numChannelsInDestination,
     		int channelToWriteTo);
     bool isBufferReady();
+    int getTimestamp();
 #ifdef USE_JUCE // if we are in Juce, then we run a separate thread for each receiver
     		// (as each of them are typically receiving on a mono or stereo track)
     void run();
 #else
+    RTIME getLastTime();
     void static run(); //while in BeagleRT we have a single thread that receives for all the instances.
     //TODO: make run() private in BeagleRT
     static void startThread();