diff core/NetworkSend.cpp @ 129:cce58e6ec2a2 scope-refactoring

Added ifdefs USE_JUCE to NetworkSend. Juce part not added yet
author Giulio Moro <giuliomoro@yahoo.it>
date Mon, 24 Aug 2015 20:53:26 +0100
parents cdd441a304a9
children ff28e56e5b7e
line wrap: on
line diff
--- a/core/NetworkSend.cpp	Mon Aug 24 18:55:19 2015 +0100
+++ b/core/NetworkSend.cpp	Mon Aug 24 20:53:26 2015 +0100
@@ -1,30 +1,30 @@
-//scope.cpp
 #include <NetworkSend.h>
 
-#define BUILD_FOR_UDPRECEIVE_PLUGIN
-#define NETWORK_AUDIO_BUFFER_SIZE 302
-
+#ifdef USE_JUCE
+#else
 //initialize the static members of NetworkSend
 bool NetworkSend::staticConstructed=false;
 std::vector<NetworkSend*> NetworkSend::objAddrs(0);
 AuxiliaryTask NetworkSend::sendDataTask=NULL;
 
-void transmitAudio(){
+void sendData(){
 	NetworkSend::sendAllData();
 }
-
+void NetworkSend::staticConstructor(){
+	if(staticConstructed==true)
+		return;
+	staticConstructed=true;
+	sendDataTask = BeagleRT_createAuxiliaryTask(::sendData, 95, "sendDataTask"); //TODO: allow variable priority
+}
 void NetworkSend::sendAllData(){
 	for(unsigned int n=0; n<NetworkSend::objAddrs.size(); n++){
 		NetworkSend::objAddrs[n]->sendData();
 	}
 }
-
-void NetworkSend::staticConstructor(){
-	if(staticConstructed==true)
-		return;
-	staticConstructed=true;
-	sendDataTask = BeagleRT_createAuxiliaryTask(transmitAudio, 95, "sendDataTask"); //TODO: allow variable priority
-};
+int NetworkSend::getNumInstances(){
+	return objAddrs.size();
+}
+#endif /* USE_JUCE */
 
 NetworkSend::NetworkSend()
 {
@@ -44,9 +44,10 @@
 	}
 }
 
-void NetworkSend::setup(float aSampleRate){
+void NetworkSend::setup(float aSampleRate){//TODO: remove this method
 	setup(aSampleRate, 0, 9999, "192.168.7.1");//channelNumber=0
 }
+
 void NetworkSend::setup(float aSampleRate, int aChannelNumber, int aPort, const char *aServer){
 	staticConstructor(); //FIXME: ideally this should be in the constructor, but this is not currently possible
 						//because of limitations in BeagleRT_createAuxiliaryTask()
@@ -112,10 +113,8 @@
 	}
 }
 
-int NetworkSend::getNumInstances(){
-	return objAddrs.size();
-};
-
+#ifdef USE_JUCE
+#else
 Scope::Scope(int aNumChannels):
 		channels(aNumChannels)
 {};
@@ -154,3 +153,4 @@
 void Scope::sendData(){
 	NetworkSend::sendAllData();
 }
+#endif