Mercurial > hg > beaglert
diff core/RTAudioCommandLine.cpp @ 24:ad5cd8dd99b3 bbb_network
UDP communication in place, pre-alpha
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Fri, 08 May 2015 11:12:13 +0100 |
parents | 182ae9367104 |
children | cc434ecf4486 |
line wrap: on
line diff
--- a/core/RTAudioCommandLine.cpp Tue May 05 17:28:00 2015 +0100 +++ b/core/RTAudioCommandLine.cpp Fri May 08 11:12:13 2015 +0100 @@ -10,6 +10,7 @@ #include <cstring> #include <getopt.h> #include "../include/RTAudio.h" + #ifndef OPT_PRU_FILE #define OPT_PRU_FILE -1 #endif @@ -22,15 +23,19 @@ {"use-analog", 1, NULL, 'm'}, {"use-digital-gpio", 1, NULL, 'g'}, {"analog-channels", 1, NULL, 'C'}, - {"digital-gpio-channels", 1, NULL, 'G'}, + {"digital-channels", 1, NULL, 'G'}, {"mute-speaker", 1, NULL, 'M'}, {"dac-level", 1, NULL, 'D'}, {"adc-level", 1, NULL, 'A'}, {"hp-level", 1, NULL, 'H'}, + {"receive-port", 1, NULL, 'r'}, + {"transmit-port", 1, NULL, 't'}, + {"server-name",1,NULL,'s'}, {"pru-file",1,NULL,OPT_PRU_FILE}, {NULL, 0, NULL, 0} }; -const char gDefaultShortOptions[] = "p:vm:M:C:D:A:H:g:G:"; + +const char gDefaultShortOptions[] = "p:vm:M:C:D:A:H:g:G:r:t:s:"; // This function sets the default settings for the RTAudioSettings structure void BeagleRT_defaultSettings(RTAudioSettings *settings) @@ -48,6 +53,9 @@ settings->verbose = 0; settings->pruFilename[0]='\0'; settings->codecI2CAddress = CODEC_I2C_ADDRESS; + settings->receivePort=9998; + settings->transmitPort=9999; + strcpy(settings->serverName, "127.0.0.1"); settings->ampMutePin = kAmplifierMutePin; } @@ -167,7 +175,20 @@ case 'H': settings->headphoneLevel = atof(optarg); break; - case OPT_PRU_FILE: + case 'r': + settings->receivePort = atoi(optarg); + break; + case 't': + settings->transmitPort = atoi(optarg); + break; + case 's': + if(strlen(optarg)<MAX_SERVERNAME_LENGTH) + strcpy(settings->serverName, optarg); + else + std::cerr << "Warning: server name is too long (>" << MAX_SERVERNAME_LENGTH << " characters)." + " Using default severName Instead ( " << settings->serverName << " ).\n"; + break; + case 'OPT_PRU_FILE': if(strlen(optarg)<MAX_PRU_FILENAME_LENGTH) strcpy(settings->pruFilename, optarg); else @@ -190,10 +211,13 @@ 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-analog [-m] val: Set whether to use ADC/DAC analog (default: yes)\n"; - std::cerr << " --use-gpio-analog [-g] val: Set whether to use GPIO analog (default: yes)\n"; + std::cerr << " --use-digital [-g] val: Set whether to use digital GPIO channels (default: yes)\n"; std::cerr << " --analog-channels [-C] val: Set the number of ADC/DAC channels (default: 8)\n"; - std::cerr << " --analog-gpio-channels [-G] val: Set the number of GPIO channels (default: 16)\n"; - std::cerr << " --pru-file val: Set an optional external file to use for the PRU binary code\n"; + std::cerr << " --digital-channels [-G] val: Set the number of digital GPIO channels (default: 16)\n"; + std::cerr << " --receive-port [-r] val: Set the receive port (default: 9998)\n"; + std::cerr << " --transmit-port [-t] val: Set the transmit port (default: 9999)\n"; + std::cerr << " --server-name [-s] val: Set the destination server name (default: '127.0.0.1')\n"; + std::cerr << " --pru-file val: Set an optional external file to use for the PRU binary code\n"; std::cerr << " --verbose [-v]: Enable verbose logging information\n"; }