comparison core/RTAudioCommandLine.cpp @ 23:182ae9367104 matrix_gpio

- persistency: the last frame of each digital and analogOut buffers is used to initialize all the frames in the next buffer. This means that once a value is set, the pin will hold the value until you change it - AnalogXyz macros have been renamed to analogXyz - the short option -P has been removed. The long option --pru-file has to be used instead
author Giulio Moro <giuliomoro@yahoo.it>
date Tue, 05 May 2015 17:28:00 +0100
parents c98863e63174
children ad5cd8dd99b3 06fd2ffee605
comparison
equal deleted inserted replaced
22:fbfeb5895efd 23:182ae9367104
8 #include <iostream> 8 #include <iostream>
9 #include <cstdlib> 9 #include <cstdlib>
10 #include <cstring> 10 #include <cstring>
11 #include <getopt.h> 11 #include <getopt.h>
12 #include "../include/RTAudio.h" 12 #include "../include/RTAudio.h"
13 #ifndef OPT_PRU_FILE
14 #define OPT_PRU_FILE -1
15 #endif
13 16
14 // Default command-line options for RTAudio 17 // Default command-line options for RTAudio
15 struct option gDefaultLongOptions[] = 18 struct option gDefaultLongOptions[] =
16 { 19 {
17 {"period", 1, NULL, 'p'}, 20 {"period", 1, NULL, 'p'},
18 {"verbose", 0, NULL, 'v'}, 21 {"verbose", 0, NULL, 'v'},
19 {"use-analog", 1, NULL, 'm'}, 22 {"use-analog", 1, NULL, 'm'},
20 {"use-analog-gpio", 1, NULL, 'g'}, 23 {"use-digital-gpio", 1, NULL, 'g'},
21 {"analog-channels", 1, NULL, 'C'}, 24 {"analog-channels", 1, NULL, 'C'},
22 {"analog-gpio-channels", 1, NULL, 'G'}, 25 {"digital-gpio-channels", 1, NULL, 'G'},
23 {"mute-speaker", 1, NULL, 'M'}, 26 {"mute-speaker", 1, NULL, 'M'},
24 {"dac-level", 1, NULL, 'D'}, 27 {"dac-level", 1, NULL, 'D'},
25 {"adc-level", 1, NULL, 'A'}, 28 {"adc-level", 1, NULL, 'A'},
26 {"hp-level", 1, NULL, 'H'}, 29 {"hp-level", 1, NULL, 'H'},
27 {"pru-file",1,NULL,'P'}, 30 {"pru-file",1,NULL,OPT_PRU_FILE},
28 {NULL, 0, NULL, 0} 31 {NULL, 0, NULL, 0}
29 }; 32 };
30 33 const char gDefaultShortOptions[] = "p:vm:M:C:D:A:H:g:G:";
31 const char gDefaultShortOptions[] = "p:vm:M:C:D:A:H:P:g:G:";
32 34
33 // This function sets the default settings for the RTAudioSettings structure 35 // This function sets the default settings for the RTAudioSettings structure
34 void BeagleRT_defaultSettings(RTAudioSettings *settings) 36 void BeagleRT_defaultSettings(RTAudioSettings *settings)
35 { 37 {
36 // Set default values for settings 38 // Set default values for settings
163 settings->adcLevel = atof(optarg); 165 settings->adcLevel = atof(optarg);
164 break; 166 break;
165 case 'H': 167 case 'H':
166 settings->headphoneLevel = atof(optarg); 168 settings->headphoneLevel = atof(optarg);
167 break; 169 break;
168 case 'P': 170 case OPT_PRU_FILE:
169 if(strlen(optarg)<MAX_PRU_FILENAME_LENGTH) 171 if(strlen(optarg)<MAX_PRU_FILENAME_LENGTH)
170 strcpy(settings->pruFilename, optarg); 172 strcpy(settings->pruFilename, optarg);
171 else 173 else
172 std::cerr << "Warning: filename for the PRU code is too long (>" << MAX_PRU_FILENAME_LENGTH << " characters). Using embedded PRU code instead\n"; 174 std::cerr << "Warning: filename for the PRU code is too long (>" << MAX_PRU_FILENAME_LENGTH << " characters). Using embedded PRU code instead\n";
173 break; 175 break;
189 std::cerr << " --mute-speaker [-M] val: Set whether to mute the speaker initially (default: no)\n"; 191 std::cerr << " --mute-speaker [-M] val: Set whether to mute the speaker initially (default: no)\n";
190 std::cerr << " --use-analog [-m] val: Set whether to use ADC/DAC analog (default: yes)\n"; 192 std::cerr << " --use-analog [-m] val: Set whether to use ADC/DAC analog (default: yes)\n";
191 std::cerr << " --use-gpio-analog [-g] val: Set whether to use GPIO analog (default: yes)\n"; 193 std::cerr << " --use-gpio-analog [-g] val: Set whether to use GPIO analog (default: yes)\n";
192 std::cerr << " --analog-channels [-C] val: Set the number of ADC/DAC channels (default: 8)\n"; 194 std::cerr << " --analog-channels [-C] val: Set the number of ADC/DAC channels (default: 8)\n";
193 std::cerr << " --analog-gpio-channels [-G] val: Set the number of GPIO channels (default: 16)\n"; 195 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"; 196 std::cerr << " --pru-file val: Set an optional external file to use for the PRU binary code\n";
195 std::cerr << " --verbose [-v]: Enable verbose logging information\n"; 197 std::cerr << " --verbose [-v]: Enable verbose logging information\n";
196 } 198 }
197 199