diff core/RTAudioCommandLine.cpp @ 280:c55c6f6c233c prerelease

Added support for multiplexer capelet and command-line support for choosing PRU
author andrewm
date Tue, 17 May 2016 17:49:23 +0100
parents 1fd334f64f0a
children e4392164b458
line wrap: on
line diff
--- a/core/RTAudioCommandLine.cpp	Tue May 17 16:07:45 2016 +0100
+++ b/core/RTAudioCommandLine.cpp	Tue May 17 17:49:23 2016 +0100
@@ -14,6 +14,7 @@
 #define OPT_PRU_FILE 1000
 #define OPT_PGA_GAIN_LEFT 1001
 #define OPT_PGA_GAIN_RIGHT 1002
+#define OPT_PRU_NUMBER 1003
 
 
 enum {
@@ -39,6 +40,7 @@
 	{"transmit-port", 1, NULL, 'T'},
 	{"server-name", 1, NULL, 'S'},
 	{"pru-file", 1, NULL, OPT_PRU_FILE},
+	{"pru-number", 1, NULL, OPT_PRU_NUMBER},
 	{NULL, 0, NULL, 0}
 };
 
@@ -60,8 +62,10 @@
 	for(int n = 0; n < 2; n++)
 		settings->pgaGain[n] = DEFAULT_PGA_GAIN;
 	settings->headphoneLevel = DEFAULT_HP_LEVEL;
+	settings->numMuxChannels = 0;
 
 	settings->verbose = 0;
+	settings->pruNumber = 0;
 	settings->pruFilename[0] = '\0';
 
 	// These two deliberately have no command-line flags by default.
@@ -166,8 +170,16 @@
 			break;
 		case 'C':
 			settings->numAnalogChannels = atoi(optarg);
-			if(settings->numAnalogChannels >= 8)
+			if(settings->numAnalogChannels >= 8) {
+				// Use multiplexer capelet to run larger numbers of channels
+				if(settings->numAnalogChannels >= 64)
+					settings->numMuxChannels = 8;
+				else if(settings->numAnalogChannels >= 32)
+					settings->numMuxChannels = 4;
+				else if(settings->numAnalogChannels >= 16)
+					settings->numMuxChannels = 2;
 				settings->numAnalogChannels = 8;
+			}
 			else if(settings->numAnalogChannels >= 4)
 				settings->numAnalogChannels = 4;
 			else
@@ -220,6 +232,9 @@
 		case OPT_PGA_GAIN_RIGHT:
 			settings->pgaGain[1] = atof(optarg);
 			break;
+		case OPT_PRU_NUMBER:
+			settings->pruNumber = atoi(optarg);
+			break;
 		case '?':
 		default:
 			return c;
@@ -246,6 +261,7 @@
 	std::cerr << "   --transmit-port [-T] val:        Set the transmit port (default: 9999)\n";
 	std::cerr << "   --server-name [-S] val:          Set the destination server name (default: '127.0.0.1')\n";
 	std::cerr << "   --pru-file val:                  Set an optional external file to use for the PRU binary code\n";
+	std::cerr << "   --pru-number val:                Set the PRU to use for I/O (options: 0 or 1, default: 0)\n";
 	std::cerr << "   --verbose [-v]:                  Enable verbose logging information\n";
 }