diff include/ReceiveAudioThread.h @ 125:850a4a9bd832 scope-refactoring

Added ifdefs and unified the code with udpioplugin ... the latter has not been tested (or committed). TODO: still it hangs after ctrl-c BeagleRT (auxiliary tasks do not terminate). TODO: sometimes you can hear dropouts in the transmission. Maybe it is due to pointer drifting. Rebooting BBB fixes/affects this issue.
author Giulio Moro <giuliomoro@yahoo.it>
date Sat, 22 Aug 2015 02:53:36 +0100
parents cdd441a304a9
children 2696a7f00053
line wrap: on
line diff
--- a/include/ReceiveAudioThread.h	Sat Aug 22 02:51:39 2015 +0100
+++ b/include/ReceiveAudioThread.h	Sat Aug 22 02:53:36 2015 +0100
@@ -1,21 +1,31 @@
 #ifndef RECEIVEAUDIOTHREAD_H_INCLUDED
 #define RECEIVEAUDIOTHREAD_H_INCLUDED
+#ifdef JUCE
+#else
 #include <vector>
 #include <iostream>
 #include <UdpServer.h>
 #include <BeagleRT.h>
 #include <native/task.h>
+#endif /*JUCE*/
 
+#ifdef JUCE
+class ReceiveAudioThread : public Thread {
+#else
 class ReceiveAudioThread{
+#endif /* JUCE */
 private:
     //  FILE *fd; //DEBUG
     //  FILE *fd2; //DEBUG
+#ifdef JUCE
+	DatagramSocket socket;
+#else
     UdpServer socket;
-//JUCE    DatagramSocket socket;
+#endif /* JUCE */
     bool listening;
     bool bufferReady;
 #ifdef JUCE
-    bool threadRunning;
+    bool threadRunning; //do we really need this ?
 #else
     static bool threadRunning;
     static bool threadIsExiting;
@@ -51,10 +61,13 @@
     static std::vector<ReceiveAudioThread *> objAddrs;
 #endif
 public:
+#ifdef JUCE
+    ReceiveAudioThread(const String &threadName);
+#else
     ReceiveAudioThread();
+#endif
     ~ReceiveAudioThread();
     void init(int port, int aSamplesPerBlock, int channel);
-    void setup();
     void bindToPort(int aPort);
     bool isListening();
     float* getCurrentBuffer(int length);