comparison core/RTAudioCommandLine.cpp @ 50:be427da6fb9c newapi

Removed old testing code that stopped audio after 10 seconds; command line parameter updates; D-Box updates (not fully working yet)
author andrewm
date Sat, 30 May 2015 12:34:32 -0500
parents 643cbee74eda
children a6d223473ea2
comparison
equal deleted inserted replaced
49:bb40e7e06b8c 50:be427da6fb9c
22 // Default command-line options for RTAudio 22 // Default command-line options for RTAudio
23 struct option gDefaultLongOptions[] = 23 struct option gDefaultLongOptions[] =
24 { 24 {
25 {"period", 1, NULL, 'p'}, 25 {"period", 1, NULL, 'p'},
26 {"verbose", 0, NULL, 'v'}, 26 {"verbose", 0, NULL, 'v'},
27 {"use-analog", 1, NULL, 'm'}, 27 {"use-analog", 1, NULL, 'N'},
28 {"use-digital-gpio", 1, NULL, 'g'}, 28 {"use-digital", 1, NULL, 'G'},
29 {"analog-channels", 1, NULL, 'C'}, 29 {"analog-channels", 1, NULL, 'C'},
30 {"digital-channels", 1, NULL, 'G'}, 30 {"digital-channels", 1, NULL, 'B'},
31 {"mute-speaker", 1, NULL, 'M'}, 31 {"mute-speaker", 1, NULL, 'M'},
32 {"dac-level", 1, NULL, 'D'}, 32 {"dac-level", 1, NULL, 'D'},
33 {"adc-level", 1, NULL, 'A'}, 33 {"adc-level", 1, NULL, 'A'},
34 {"hp-level", 1, NULL, 'H'}, 34 {"hp-level", 1, NULL, 'H'},
35 {"receive-port", 1, NULL, 'r'}, 35 {"receive-port", 1, NULL, 'R'},
36 {"transmit-port", 1, NULL, 't'}, 36 {"transmit-port", 1, NULL, 'T'},
37 {"server-name", 1, NULL, 's'}, 37 {"server-name", 1, NULL, 'S'},
38 {"pru-file", 1, NULL, OPT_PRU_FILE}, 38 {"pru-file", 1, NULL, OPT_PRU_FILE},
39 {NULL, 0, NULL, 0} 39 {NULL, 0, NULL, 0}
40 }; 40 };
41 41
42 const char gDefaultShortOptions[] = "p:vm:M:C:D:A:H:g:G:r:t:s:"; 42 const char gDefaultShortOptions[] = "p:vN:M:C:D:A:H:G:B:R:T:S:";
43 43
44 // This function sets the default settings for the BeagleRTInitSettings structure 44 // This function sets the default settings for the BeagleRTInitSettings structure
45 void BeagleRT_defaultSettings(BeagleRTInitSettings *settings) 45 void BeagleRT_defaultSettings(BeagleRTInitSettings *settings)
46 { 46 {
47 // Set default values for settings 47 // Set default values for settings
148 settings->periodSize = 1; 148 settings->periodSize = 1;
149 break; 149 break;
150 case 'v': 150 case 'v':
151 settings->verbose = 1; 151 settings->verbose = 1;
152 break; 152 break;
153 case 'm': 153 case 'N':
154 settings->useAnalog = atoi(optarg); 154 settings->useAnalog = atoi(optarg);
155 break; 155 break;
156 case 'g': 156 case 'G':
157 settings->useDigital = atoi(optarg); 157 settings->useDigital = atoi(optarg);
158 settings->numDigitalChannels = 0; 158 settings->numDigitalChannels = 0;
159 break; 159 break;
160 case 'C': 160 case 'C':
161 settings->numAnalogChannels = atoi(optarg); 161 settings->numAnalogChannels = atoi(optarg);
164 else if(settings->numAnalogChannels >= 4) 164 else if(settings->numAnalogChannels >= 4)
165 settings->numAnalogChannels = 4; 165 settings->numAnalogChannels = 4;
166 else 166 else
167 settings->numAnalogChannels = 2; 167 settings->numAnalogChannels = 2;
168 break; 168 break;
169 case 'G': 169 case 'B':
170 settings->numDigitalChannels = atoi(optarg); 170 settings->numDigitalChannels = atoi(optarg);
171 if(settings->numDigitalChannels >= 16) 171 if(settings->numDigitalChannels >= 16)
172 settings->numDigitalChannels = 16; 172 settings->numDigitalChannels = 16;
173 else if (settings->numDigitalChannels < 1){ 173 else if (settings->numDigitalChannels < 1){
174 settings->numDigitalChannels = 0; 174 settings->numDigitalChannels = 0;
186 settings->adcLevel = atof(optarg); 186 settings->adcLevel = atof(optarg);
187 break; 187 break;
188 case 'H': 188 case 'H':
189 settings->headphoneLevel = atof(optarg); 189 settings->headphoneLevel = atof(optarg);
190 break; 190 break;
191 case 'r': 191 case 'R':
192 settings->receivePort = atoi(optarg); 192 settings->receivePort = atoi(optarg);
193 break; 193 break;
194 case 't': 194 case 'T':
195 settings->transmitPort = atoi(optarg); 195 settings->transmitPort = atoi(optarg);
196 break; 196 break;
197 case 's': 197 case 'S':
198 if(strlen(optarg)<MAX_SERVERNAME_LENGTH) 198 if(strlen(optarg)<MAX_SERVERNAME_LENGTH)
199 strcpy(settings->serverName, optarg); 199 strcpy(settings->serverName, optarg);
200 else 200 else
201 std::cerr << "Warning: server name is too long (>" << MAX_SERVERNAME_LENGTH << " characters)." 201 std::cerr << "Warning: server name is too long (>" << MAX_SERVERNAME_LENGTH << " characters)."
202 " Using default severName Instead ( " << settings->serverName << " ).\n"; 202 " Using default severName Instead ( " << settings->serverName << " ).\n";