Mercurial > hg > beaglert
comparison core/RTAudioCommandLine.cpp @ 19:c98863e63174 matrix_gpio
Renamed matrixGpio to digital and matrix to analog
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Thu, 30 Apr 2015 16:58:41 +0100 |
parents | 670be80463a3 |
children | 182ae9367104 |
comparison
equal
deleted
inserted
replaced
18:31503d9de101 | 19:c98863e63174 |
---|---|
14 // Default command-line options for RTAudio | 14 // Default command-line options for RTAudio |
15 struct option gDefaultLongOptions[] = | 15 struct option gDefaultLongOptions[] = |
16 { | 16 { |
17 {"period", 1, NULL, 'p'}, | 17 {"period", 1, NULL, 'p'}, |
18 {"verbose", 0, NULL, 'v'}, | 18 {"verbose", 0, NULL, 'v'}, |
19 {"use-matrix", 1, NULL, 'm'}, | 19 {"use-analog", 1, NULL, 'm'}, |
20 {"use-matrix-gpio", 1, NULL, 'g'}, | 20 {"use-analog-gpio", 1, NULL, 'g'}, |
21 {"matrix-channels", 1, NULL, 'C'}, | 21 {"analog-channels", 1, NULL, 'C'}, |
22 {"matrix-gpio-channels", 1, NULL, 'G'}, | 22 {"analog-gpio-channels", 1, NULL, 'G'}, |
23 {"mute-speaker", 1, NULL, 'M'}, | 23 {"mute-speaker", 1, NULL, 'M'}, |
24 {"dac-level", 1, NULL, 'D'}, | 24 {"dac-level", 1, NULL, 'D'}, |
25 {"adc-level", 1, NULL, 'A'}, | 25 {"adc-level", 1, NULL, 'A'}, |
26 {"hp-level", 1, NULL, 'H'}, | 26 {"hp-level", 1, NULL, 'H'}, |
27 {"pru-file",1,NULL,'P'}, | 27 {"pru-file",1,NULL,'P'}, |
37 settings->periodSize = 8; | 37 settings->periodSize = 8; |
38 settings->beginMuted = 0; | 38 settings->beginMuted = 0; |
39 settings->dacLevel = DEFAULT_DAC_LEVEL; | 39 settings->dacLevel = DEFAULT_DAC_LEVEL; |
40 settings->adcLevel = DEFAULT_ADC_LEVEL; | 40 settings->adcLevel = DEFAULT_ADC_LEVEL; |
41 settings->headphoneLevel = DEFAULT_HP_LEVEL; | 41 settings->headphoneLevel = DEFAULT_HP_LEVEL; |
42 settings->useMatrix = 1; | 42 settings->useAnalog = 1; |
43 settings->useMatrixGpio = 1; | 43 settings->useDigital = 1; |
44 settings->numMatrixChannels = 8; | 44 settings->numAnalogChannels = 8; |
45 settings->numMatrixGpioChannels = 16; | 45 settings->numDigitalChannels = 16; |
46 settings->verbose = 0; | 46 settings->verbose = 0; |
47 settings->pruFilename[0]='\0'; | 47 settings->pruFilename[0]='\0'; |
48 settings->codecI2CAddress = CODEC_I2C_ADDRESS; | 48 settings->codecI2CAddress = CODEC_I2C_ADDRESS; |
49 settings->ampMutePin = kAmplifierMutePin; | 49 settings->ampMutePin = kAmplifierMutePin; |
50 } | 50 } |
126 break; | 126 break; |
127 case 'v': | 127 case 'v': |
128 settings->verbose = 1; | 128 settings->verbose = 1; |
129 break; | 129 break; |
130 case 'm': | 130 case 'm': |
131 settings->useMatrix = atoi(optarg); | 131 settings->useAnalog = atoi(optarg); |
132 break; | 132 break; |
133 case 'g': | 133 case 'g': |
134 settings->useMatrixGpio = atoi(optarg); | 134 settings->useDigital = atoi(optarg); |
135 settings->numMatrixGpioChannels = 0; | 135 settings->numDigitalChannels = 0; |
136 break; | 136 break; |
137 case 'C': | 137 case 'C': |
138 settings->numMatrixChannels = atoi(optarg); | 138 settings->numAnalogChannels = atoi(optarg); |
139 if(settings->numMatrixChannels >= 8) | 139 if(settings->numAnalogChannels >= 8) |
140 settings->numMatrixChannels = 8; | 140 settings->numAnalogChannels = 8; |
141 else if(settings->numMatrixChannels >= 4) | 141 else if(settings->numAnalogChannels >= 4) |
142 settings->numMatrixChannels = 4; | 142 settings->numAnalogChannels = 4; |
143 else | 143 else |
144 settings->numMatrixChannels = 2; | 144 settings->numAnalogChannels = 2; |
145 break; | 145 break; |
146 case 'G': | 146 case 'G': |
147 settings->numMatrixGpioChannels = atoi(optarg); | 147 settings->numDigitalChannels = atoi(optarg); |
148 if(settings->numMatrixGpioChannels >= 16) | 148 if(settings->numDigitalChannels >= 16) |
149 settings->numMatrixGpioChannels = 16; | 149 settings->numDigitalChannels = 16; |
150 else if (settings->numMatrixGpioChannels < 1){ | 150 else if (settings->numDigitalChannels < 1){ |
151 settings->numMatrixGpioChannels = 0; | 151 settings->numDigitalChannels = 0; |
152 settings->useMatrixGpio = 0; //TODO: this actually works only if -G 0 is specified after -g 1. | 152 settings->useDigital = 0; //TODO: this actually works only if -G 0 is specified after -g 1. |
153 //No worries, though: disabling numMatrixGpio will only prevent the pins from being exported. | 153 //No worries, though: disabling numDigital will only prevent the pins from being exported. |
154 } | 154 } |
155 break; | 155 break; |
156 case 'M': | 156 case 'M': |
157 settings->beginMuted = atoi(optarg); | 157 settings->beginMuted = atoi(optarg); |
158 break; | 158 break; |
180 | 180 |
181 // This function prints standard usage information for default arguments | 181 // This function prints standard usage information for default arguments |
182 // Call from within your own usage function | 182 // Call from within your own usage function |
183 void BeagleRT_usage() | 183 void BeagleRT_usage() |
184 { | 184 { |
185 std::cerr << " --period [-p] period: Set the hardware period (buffer) size in matrix samples\n"; | 185 std::cerr << " --period [-p] period: Set the hardware period (buffer) size in analog samples\n"; |
186 std::cerr << " --dac-level [-D] dBs: Set the DAC output level (0dB max; -63.5dB min)\n"; | 186 std::cerr << " --dac-level [-D] dBs: Set the DAC output level (0dB max; -63.5dB min)\n"; |
187 std::cerr << " --adc-level [-A] dBs: Set the ADC input level (0dB max; -12dB min)\n"; | 187 std::cerr << " --adc-level [-A] dBs: Set the ADC input level (0dB max; -12dB min)\n"; |
188 std::cerr << " --hp-level [-H] dBs: Set the headphone output level (0dB max; -63.5dB min)\n"; | 188 std::cerr << " --hp-level [-H] dBs: Set the headphone output level (0dB max; -63.5dB min)\n"; |
189 std::cerr << " --mute-speaker [-M] val: Set whether to mute the speaker initially (default: no)\n"; | 189 std::cerr << " --mute-speaker [-M] val: Set whether to mute the speaker initially (default: no)\n"; |
190 std::cerr << " --use-matrix [-m] val: Set whether to use ADC/DAC matrix (default: yes)\n"; | 190 std::cerr << " --use-analog [-m] val: Set whether to use ADC/DAC analog (default: yes)\n"; |
191 std::cerr << " --use-gpio-matrix [-g] val: Set whether to use GPIO matrix (default: yes)\n"; | 191 std::cerr << " --use-gpio-analog [-g] val: Set whether to use GPIO analog (default: yes)\n"; |
192 std::cerr << " --matrix-channels [-C] val: Set the number of ADC/DAC channels (default: 8)\n"; | 192 std::cerr << " --analog-channels [-C] val: Set the number of ADC/DAC channels (default: 8)\n"; |
193 std::cerr << " --matrix-gpio-channels [-G] val: Set the number of GPIO channels (default: 16)\n"; | 193 std::cerr << " --analog-gpio-channels [-G] val: Set the number of GPIO channels (default: 16)\n"; |
194 std::cerr << " --pru-file [-P] val: Set an optional external file to use for the PRU binary code\n"; | 194 std::cerr << " --pru-file [-P] val: Set an optional external file to use for the PRU binary code\n"; |
195 std::cerr << " --verbose [-v]: Enable verbose logging information\n"; | 195 std::cerr << " --verbose [-v]: Enable verbose logging information\n"; |
196 } | 196 } |
197 | 197 |