diff core/RTAudio.cpp @ 50:be427da6fb9c newapi

Removed old testing code that stopped audio after 10 seconds; command line parameter updates; D-Box updates (not fully working yet)
author andrewm
date Sat, 30 May 2015 12:34:32 -0500
parents 643cbee74eda
children 3c3a1357657d
line wrap: on
line diff
--- a/core/RTAudio.cpp	Thu May 28 17:48:42 2015 -0400
+++ b/core/RTAudio.cpp	Sat May 30 12:34:32 2015 -0500
@@ -52,7 +52,9 @@
 
 // Real-time tasks and objects
 RT_TASK gRTAudioThread;
+#ifdef BEAGLERT_USE_XENOMAI_INTERRUPTS
 RT_INTR gRTAudioInterrupt;
+#endif
 PRU *gPRU = 0;
 I2c_Codec *gAudioCodec = 0;
 
@@ -257,8 +259,11 @@
 				}
 			}
 
+#ifdef BEAGLERT_USE_XENOMAI_INTERRUPTS
 			gPRU->loop(&gRTAudioInterrupt, gUserData);
-
+#else
+			gPRU->loop(0, gUserData);
+#endif
 			// Now clean up
 			// gPRU->waitForFinish();
 			gPRU->disable();
@@ -341,12 +346,14 @@
 		  return -1;
 	}
 
+#ifdef BEAGLERT_USE_XENOMAI_INTERRUPTS
 	// Create an interrupt which the audio thread receives from the PRU
 	int result = 0;
 	if((result = rt_intr_create(&gRTAudioInterrupt, gRTAudioInterruptName, PRU_RTAUDIO_IRQ, I_NOAUTOENA)) != 0) {
 		cout << "Error: unable to create Xenomai interrupt for PRU (error " << result << ")" << endl;
 		return -1;
 	}
+#endif
 
 	// Start all RT threads
 	if(rt_task_start(&gRTAudioThread, &audioLoop, 0)) {
@@ -413,7 +420,9 @@
 	gAuxTasks.clear();
 
 	// Delete the audio task and its interrupt
+#ifdef BEAGLERT_USE_XENOMAI_INTERRUPTS
 	rt_intr_delete(&gRTAudioInterrupt);
+#endif
 	rt_task_delete(&gRTAudioThread);
 
 	if(gPRU != 0)