comparison 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
comparison
equal deleted inserted replaced
11:517715b23df0 12:a6beeba3a648
16 struct option gDefaultLongOptions[] = 16 struct option gDefaultLongOptions[] =
17 { 17 {
18 {"period", 1, NULL, 'p'}, 18 {"period", 1, NULL, 'p'},
19 {"verbose", 0, NULL, 'v'}, 19 {"verbose", 0, NULL, 'v'},
20 {"use-matrix", 1, NULL, 'm'}, 20 {"use-matrix", 1, NULL, 'm'},
21 {"matrix-channels", 1, NULL, 'C'},
21 {"mute-speaker", 1, NULL, 'M'}, 22 {"mute-speaker", 1, NULL, 'M'},
22 {"dac-level", 1, NULL, 'D'}, 23 {"dac-level", 1, NULL, 'D'},
23 {"adc-level", 1, NULL, 'A'}, 24 {"adc-level", 1, NULL, 'A'},
24 {"hp-level", 1, NULL, 'H'}, 25 {"hp-level", 1, NULL, 'H'},
25 {NULL, 0, NULL, 0} 26 {NULL, 0, NULL, 0}
26 }; 27 };
27 28
28 const char gDefaultShortOptions[] = "p:vm:M:D:A:H:"; 29 const char gDefaultShortOptions[] = "p:vm:M:C:D:A:H:";
29 30
30 // This function sets the default settings for the RTAudioSettings structure 31 // This function sets the default settings for the RTAudioSettings structure
31 void BeagleRT_defaultSettings(RTAudioSettings *settings) 32 void BeagleRT_defaultSettings(RTAudioSettings *settings)
32 { 33 {
33 // Set default values for settings 34 // Set default values for settings
35 settings->beginMuted = 0; 36 settings->beginMuted = 0;
36 settings->dacLevel = DEFAULT_DAC_LEVEL; 37 settings->dacLevel = DEFAULT_DAC_LEVEL;
37 settings->adcLevel = DEFAULT_ADC_LEVEL; 38 settings->adcLevel = DEFAULT_ADC_LEVEL;
38 settings->headphoneLevel = DEFAULT_HP_LEVEL; 39 settings->headphoneLevel = DEFAULT_HP_LEVEL;
39 settings->useMatrix = 1; 40 settings->useMatrix = 1;
41 settings->numMatrixChannels = 8;
40 settings->verbose = 0; 42 settings->verbose = 0;
41 settings->codecI2CAddress = CODEC_I2C_ADDRESS; 43 settings->codecI2CAddress = CODEC_I2C_ADDRESS;
42 settings->ampMutePin = kAmplifierMutePin; 44 settings->ampMutePin = kAmplifierMutePin;
43 } 45 }
44 46
121 settings->verbose = 1; 123 settings->verbose = 1;
122 break; 124 break;
123 case 'm': 125 case 'm':
124 settings->useMatrix = atoi(optarg); 126 settings->useMatrix = atoi(optarg);
125 break; 127 break;
128 case 'C':
129 settings->numMatrixChannels = atoi(optarg);
130 if(settings->numMatrixChannels >= 8)
131 settings->numMatrixChannels = 8;
132 else if(settings->numMatrixChannels >= 4)
133 settings->numMatrixChannels = 4;
134 else
135 settings->numMatrixChannels = 2;
136 break;
126 case 'M': 137 case 'M':
127 settings->beginMuted = atoi(optarg); 138 settings->beginMuted = atoi(optarg);
128 break; 139 break;
129 case 'D': 140 case 'D':
130 settings->dacLevel = atof(optarg); 141 settings->dacLevel = atof(optarg);
144 155
145 // This function prints standard usage information for default arguments 156 // This function prints standard usage information for default arguments
146 // Call from within your own usage function 157 // Call from within your own usage function
147 void BeagleRT_usage() 158 void BeagleRT_usage()
148 { 159 {
149 std::cerr << " --period [-p] period: Set the hardware period (buffer) size in matrix samples\n"; 160 std::cerr << " --period [-p] period: Set the hardware period (buffer) size in matrix samples\n";
150 std::cerr << " --dac-level [-D] dBs: Set the DAC output level (0dB max; -63.5dB min)\n"; 161 std::cerr << " --dac-level [-D] dBs: Set the DAC output level (0dB max; -63.5dB min)\n";
151 std::cerr << " --adc-level [-A] dBs: Set the ADC input level (0dB max; -12dB min)\n"; 162 std::cerr << " --adc-level [-A] dBs: Set the ADC input level (0dB max; -12dB min)\n";
152 std::cerr << " --hp-level [-H] dBs: Set the headphone output level (0dB max; -63.5dB min)\n"; 163 std::cerr << " --hp-level [-H] dBs: Set the headphone output level (0dB max; -63.5dB min)\n";
153 std::cerr << " --mute-speaker [-M] val: Set whether to mute the speaker initially (default: no)\n"; 164 std::cerr << " --mute-speaker [-M] val: Set whether to mute the speaker initially (default: no)\n";
154 std::cerr << " --use-matrix [-m] val: Set whether to use ADC/DAC matrix\n"; 165 std::cerr << " --use-matrix [-m] val: Set whether to use ADC/DAC matrix\n";
155 std::cerr << " --verbose [-v]: Enable verbose logging information\n"; 166 std::cerr << " --matrix-channels [-C] val: Set the number of ADC/DAC channels (default: 8)\n";
167 std::cerr << " --verbose [-v]: Enable verbose logging information\n";
156 } 168 }