Mercurial > hg > beaglert
diff core/RTAudioCommandLine.cpp @ 171:e63563507edd
Added command-line options for the PGA
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Mon, 28 Dec 2015 03:53:36 +0100 |
parents | a6d223473ea2 |
children | a156a694864d |
line wrap: on
line diff
--- a/core/RTAudioCommandLine.cpp Mon Dec 28 03:19:59 2015 +0100 +++ b/core/RTAudioCommandLine.cpp Mon Dec 28 03:53:36 2015 +0100 @@ -11,9 +11,10 @@ #include <getopt.h> #include "../include/BeagleRT.h" -#ifndef OPT_PRU_FILE -#define OPT_PRU_FILE 176 // this is an extended ASCII code -#endif +#define OPT_PRU_FILE 1000 +#define OPT_PGA_GAIN_LEFT 1001 +#define OPT_PGA_GAIN_RIGHT 1002 + enum { kAmplifierMutePin = 61 // P8-26 controls amplifier mute @@ -31,6 +32,8 @@ {"mute-speaker", 1, NULL, 'M'}, {"dac-level", 1, NULL, 'D'}, {"adc-level", 1, NULL, 'A'}, + {"pga-gain-left", 1, NULL, OPT_PGA_GAIN_LEFT}, + {"pga-gain-right", 1, NULL, OPT_PGA_GAIN_RIGHT}, {"hp-level", 1, NULL, 'H'}, {"receive-port", 1, NULL, 'R'}, {"transmit-port", 1, NULL, 'T'}, @@ -54,6 +57,8 @@ settings->beginMuted = 0; settings->dacLevel = DEFAULT_DAC_LEVEL; settings->adcLevel = DEFAULT_ADC_LEVEL; + for(int n = 0; n < 2; n++) + settings->pgaGain[n] = DEFAULT_PGA_GAIN; settings->headphoneLevel = DEFAULT_HP_LEVEL; settings->verbose = 0; @@ -207,6 +212,12 @@ else std::cerr << "Warning: filename for the PRU code is too long (>" << MAX_PRU_FILENAME_LENGTH << " characters). Using embedded PRU code instead\n"; break; + case OPT_PGA_GAIN_LEFT: + settings->pgaGain[0] = atof(optarg); + break; + case OPT_PGA_GAIN_RIGHT: + settings->pgaGain[1] = atof(optarg); + break; case '?': default: return c; @@ -221,6 +232,8 @@ std::cerr << " --period [-p] period: Set the hardware period (buffer) size in analog samples\n"; std::cerr << " --dac-level [-D] dBs: Set the DAC output level (0dB max; -63.5dB min)\n"; std::cerr << " --adc-level [-A] dBs: Set the ADC input level (0dB max; -12dB min)\n"; + std::cerr << " --pga-gain-left dBs: Set the Programmable Gain Amplifier for the left audio channel (0dBmin; 59.5dB max; default: 16dB)\n"; + std::cerr << " --pga-gain-right dBs: Set the Programmable Gain Amplifier for the right audio channel (0dBmin; 59.5dB max; default: 16dB)\n"; 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 [-N] val: Set whether to use ADC/DAC analog (default: yes)\n";