diff projects/scope/render.cpp @ 128:2696a7f00053 scope-refactoring

ReceiveAudioThread is now the same with/without JUCE
author Giulio Moro <giuliomoro@yahoo.it>
date Mon, 24 Aug 2015 18:55:19 +0100
parents bc514f29c3aa
children ff28e56e5b7e
line wrap: on
line diff
--- a/projects/scope/render.cpp	Mon Aug 24 15:36:09 2015 +0100
+++ b/projects/scope/render.cpp	Mon Aug 24 18:55:19 2015 +0100
@@ -7,7 +7,7 @@
 float gFrequency1, gFrequency2;
 float gInverseSampleRate;
 
-Scope scope(2);   //create a scope object with 2 channels
+//Scope scope(2);   //create a scope object with 2 channels
 NetworkSend networkSend;
 
 // initialise_render() is called once before the audio rendering starts.
@@ -18,17 +18,17 @@
 // in from the call to initAudio().
 //
 // Return true on success; returning false halts the program.
-ReceiveAudioThread receiveAudio0;
-ReceiveAudioThread receiveAudio1;
+//ReceiveAudioThread receiveAudio0;
+//ReceiveAudioThread receiveAudio1;
 bool setup(BeagleRTContext *context, void *userData)
 {
-	receiveAudio0.init(9999, context->audioFrames, 0);
-	receiveAudio1.init(10000, context->audioFrames, 1);
-
-	scope.setup();  //call this once in setup to initialise the scope
-	scope.setPort(0, 9999);
-	scope.setPort(1, 10000);
-//	networkSend.setup(context->audioSampleRate, 0, 9999, "192.168.7.1");
+//	receiveAudio0.init(9999, context->audioFrames, 0);
+//	receiveAudio1.init(10000, context->audioFrames, 1);
+//
+//	scope.setup();  //call this once in setup to initialise the scope
+//	scope.setPort(0, 9999);
+//	scope.setPort(1, 10000);
+	networkSend.setup(context->audioSampleRate, 0, 9999, "192.168.7.1");
 	 
 	gInverseSampleRate = 1.0/context->audioSampleRate;
 	
@@ -49,10 +49,10 @@
 void render(BeagleRTContext *context, void *userData)
 {
 	static int count=0;
-	if(count==0){
-		printf("startHread\n");
-		ReceiveAudioThread::startThread();
-	}
+//	if(count==0){
+//		printf("startHread\n");
+//		ReceiveAudioThread::startThread();
+//	}
 	for(unsigned int n = 0; n < context->audioFrames; n++) {
 	    
 		float chn0 = sinf(gPhase1);
@@ -63,8 +63,9 @@
 
     //  float chn4 = context->analogIn[(int)n/2*8 + 0];
     //  float chn5 = context->analogIn[(int)n/2*8 + 1];
-			scope.log(0, chn0);
-		  scope.log(1, chn1);
+		networkSend.log(chn0);
+//			scope.log(0, chn0);
+//		  scope.log(1, chn1);
 		//  scope.log(2, chn2);
 		//  scope.log(3, chn3);
 		//  scope.log(4, chn4);
@@ -86,8 +87,8 @@
 		
 	}
 	if(count>0){
-		int readPointer0=receiveAudio0.getSamplesSrc(context->audioOut, context->audioFrames, 1, 2, 0);
-		int readPointer1=receiveAudio1.getSamplesSrc(context->audioOut, context->audioFrames, 1, 2, 1);
+//		int readPointer0=receiveAudio0.getSamplesSrc(context->audioOut, context->audioFrames, 1, 2, 0);
+//		int readPointer1=receiveAudio1.getSamplesSrc(context->audioOut, context->audioFrames, 1, 2, 1);
 	}
 	count++;
 }