Mercurial > hg > beaglert
diff core/RTAudioCommandLine.cpp @ 34:46d87f680da5 matrix_gpio
Merged bbb_network and the so-called "matrix_gpio" branches
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Mon, 11 May 2015 19:50:48 +0100 |
parents | 06fd2ffee605 8e3306340971 |
children | 579c86316008 |
line wrap: on
line diff
--- a/core/RTAudioCommandLine.cpp Mon May 11 18:58:47 2015 +0100 +++ b/core/RTAudioCommandLine.cpp Mon May 11 19:50:48 2015 +0100 @@ -10,8 +10,9 @@ #include <cstring> #include <getopt.h> #include "../include/RTAudio.h" + #ifndef OPT_PRU_FILE -#define OPT_PRU_FILE 176 +#define OPT_PRU_FILE 176 // this is an extended ascii code #endif // Default command-line options for RTAudio @@ -27,10 +28,14 @@ {"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,6 +175,19 @@ case 'H': settings->headphoneLevel = atof(optarg); break; + 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); @@ -190,9 +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 << " --digital-channels [-G] val: Set the number of GPIO channels (default: 16)\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"; }