diff core/RTAudioCommandLine.cpp @ 12:a6beeba3a648

Initial support for higher matrix sample rates by reducing the number of channels. Input not tested yet, and not all examples updated to new format.
author andrewm
date Thu, 22 Jan 2015 19:00:22 +0000
parents 09f03ac40fcc
children 670be80463a3
line wrap: on
line diff
--- a/core/RTAudioCommandLine.cpp	Thu Nov 13 16:02:59 2014 +0100
+++ b/core/RTAudioCommandLine.cpp	Thu Jan 22 19:00:22 2015 +0000
@@ -18,6 +18,7 @@
 	{"period", 1, NULL, 'p'},
 	{"verbose", 0, NULL, 'v'},
 	{"use-matrix", 1, NULL, 'm'},
+	{"matrix-channels", 1, NULL, 'C'},
 	{"mute-speaker", 1, NULL, 'M'},
 	{"dac-level", 1, NULL, 'D'},
 	{"adc-level", 1, NULL, 'A'},
@@ -25,7 +26,7 @@
 	{NULL, 0, NULL, 0}
 };
 
-const char gDefaultShortOptions[] = "p:vm:M:D:A:H:";
+const char gDefaultShortOptions[] = "p:vm:M:C:D:A:H:";
 
 // This function sets the default settings for the RTAudioSettings structure
 void BeagleRT_defaultSettings(RTAudioSettings *settings)
@@ -37,6 +38,7 @@
 	settings->adcLevel = DEFAULT_ADC_LEVEL;
 	settings->headphoneLevel = DEFAULT_HP_LEVEL;
 	settings->useMatrix = 1;
+	settings->numMatrixChannels = 8;
 	settings->verbose = 0;
 	settings->codecI2CAddress = CODEC_I2C_ADDRESS;
 	settings->ampMutePin = kAmplifierMutePin;
@@ -123,6 +125,15 @@
 		case 'm':
 			settings->useMatrix = atoi(optarg);
 			break;
+		case 'C':
+			settings->numMatrixChannels = atoi(optarg);
+			if(settings->numMatrixChannels >= 8)
+				settings->numMatrixChannels = 8;
+			else if(settings->numMatrixChannels >= 4)
+				settings->numMatrixChannels = 4;
+			else
+				settings->numMatrixChannels = 2;
+			break;
 		case 'M':
 			settings->beginMuted = atoi(optarg);
 			break;
@@ -146,11 +157,12 @@
 // Call from within your own usage function
 void BeagleRT_usage()
 {
-	std::cerr << "   --period [-p] period:    Set the hardware period (buffer) size in matrix samples\n";
-	std::cerr << "   --dac-level [-D] dBs:    Set the DAC output level (0dB max; -63.5dB min)\n";
-	std::cerr << "   --adc-level [-A] dBs:    Set the ADC input level (0dB max; -12dB min)\n";
-	std::cerr << "   --hp-level [-H] dBs:     Set the headphone output level (0dB max; -63.5dB min)\n";
-	std::cerr << "   --mute-speaker [-M] val: Set whether to mute the speaker initially (default: no)\n";
-	std::cerr << "   --use-matrix [-m] val:   Set whether to use ADC/DAC matrix\n";
-	std::cerr << "   --verbose [-v]:          Enable verbose logging information\n";
+	std::cerr << "   --period [-p] period:       Set the hardware period (buffer) size in matrix samples\n";
+	std::cerr << "   --dac-level [-D] dBs:       Set the DAC output level (0dB max; -63.5dB min)\n";
+	std::cerr << "   --adc-level [-A] dBs:       Set the ADC input level (0dB max; -12dB min)\n";
+	std::cerr << "   --hp-level [-H] dBs:        Set the headphone output level (0dB max; -63.5dB min)\n";
+	std::cerr << "   --mute-speaker [-M] val:    Set whether to mute the speaker initially (default: no)\n";
+	std::cerr << "   --use-matrix [-m] val:      Set whether to use ADC/DAC matrix\n";
+	std::cerr << "   --matrix-channels [-C] val: Set the number of ADC/DAC channels (default: 8)\n";
+	std::cerr << "   --verbose [-v]:             Enable verbose logging information\n";
 }