diff projects/d-box/main.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 901d205d1a3c
children 3c3a1357657d
line wrap: on
line diff
--- a/projects/d-box/main.cpp	Thu May 28 17:48:42 2015 -0400
+++ b/projects/d-box/main.cpp	Sat May 30 12:34:32 2015 -0500
@@ -33,7 +33,7 @@
 // get_opt_long
 #include <getopt.h>
 
-#include "../../include/RTAudio.h"
+#include "../../include/BeagleRT.h"
 #include "config.h"
 #include "sensors.h"
 #include "OscillatorBank.h"
@@ -262,11 +262,13 @@
 }
 
 
-void parseArguments(arg_data args, RTAudioSettings *settings)
+void parseArguments(arg_data args, BeagleRTInitSettings *settings)
 {
 	// Default filename;
 	gPartialFilename = strdup("D-Box_sound_250_60_40_h88_2.txt");
 
+	const int kOptionAudioTest = 1000;
+
 	// TODO: complete this
 	struct option long_option[] =
 	{
@@ -274,10 +276,10 @@
 		{"audioin", 1, NULL, 'i'},
 		{"file", 1, NULL, 'f'},
 		{"keyboard", 1, NULL, 'k'},
-		{"audio-test", 0, NULL, 'T'},
-		{"sensor-type", 1, NULL, 'S'},
-		{"sensor0", 1, NULL, 'Q'},
-		{"sensor1", 1, NULL, 'R'},
+		{"audio-test", 0, NULL, kOptionAudioTest},
+		{"sensor-type", 1, NULL, 't'},
+		{"sensor0", 1, NULL, 'q'},
+		{"sensor1", 1, NULL, 'r'},
 		{"log", 1, NULL, 'l'},
 		{"usesd", 1, NULL, 'u'},
 		{"oversamp", 1, NULL, 'o'},
@@ -293,7 +295,7 @@
 	while (1)
 	{
 		int c;
-		if ((c = BeagleRT_getopt_long(args.argc, args.argv, "hf:ki:sTQ:R:S:l:u:o:n:g:", long_option, settings)) < 0)
+		if ((c = BeagleRT_getopt_long(args.argc, args.argv, "hf:ki:sq:r:t:l:u:o:n:g:", long_option, settings)) < 0)
 				break;
 		switch (c)
 		{
@@ -313,16 +315,16 @@
 		case 's':
 				forceSensors = true;
 				break;
-		case 'T':
+		case kOptionAudioTest:
 				useAudioTest = true;
 				break;
-		case 'S':
+		case 't':
 				sensorType = atoi(optarg);
 				break;
-		case 'Q':
+		case 'q':
 				touchSensor0Address = atoi(optarg);
 				break;
-		case 'R':
+		case 'r':
 				touchSensor1Address = atoi(optarg);
 				break;
 		case 'l':
@@ -361,7 +363,7 @@
 
 int main(int argc, char *argv[])
 {
-	RTAudioSettings settings;	// Standard audio settings
+	BeagleRTInitSettings settings;	// Standard audio settings
 	RT_TASK rtSensorThread;
 	const char rtSensorThreadName[] = "dbox-sensor";
 	int oscBankHopSize;
@@ -371,7 +373,7 @@
 	args.argv = argv;
 	parseArguments(args, &settings);
 
-	setVerboseLevel(gVerbose);
+	BeagleRT_setVerboseLevel(gVerbose);
 	if(gVerbose == 1 && useAudioTest)
 		cout << "main() : running in audio test mode" << endl;
 
@@ -415,7 +417,7 @@
 		if(gVerbose==1)
 			cout << "main() : creating control thread" << endl;
 
-		if(rt_task_create(&rtSensorThread, rtSensorThreadName, 0, 95, T_JOINABLE | T_FPU)) {
+		if(rt_task_create(&rtSensorThread, rtSensorThreadName, 0, BEAGLERT_AUDIO_PRIORITY - 5, T_JOINABLE | T_FPU)) {
 			  cout << "Error:unable to create Xenomai control thread" << endl;
 			  return -1;
 		}