From 16e1e842b9c17ce839dd8b352124558e59e5c3bd Mon Sep 17 00:00:00 2001 From: Andreas Eversberg Date: Mon, 2 Jan 2017 10:16:49 +0100 Subject: [PATCH] A-Netz: Don't allow emphasis, since it is not used with A-Netz --- src/anetz/main.c | 3 +++ src/common/main.h | 1 + src/common/main_common.c | 10 ++++++++++ 3 files changed, 14 insertions(+) diff --git a/src/anetz/main.c b/src/anetz/main.c index 1034046..7563e13 100644 --- a/src/anetz/main.c +++ b/src/anetz/main.c @@ -117,6 +117,9 @@ int main(int argc, char *argv[]) const char *station_id = ""; int i; + /* a-netz does not use emphasis, so disable it */ + uses_emphasis = 0; + /* init common tones */ init_freiton(); init_besetzton(); diff --git a/src/common/main.h b/src/common/main.h index c9fecca..e04c886 100644 --- a/src/common/main.h +++ b/src/common/main.h @@ -8,6 +8,7 @@ extern int samplerate; extern int interval; extern int latency; extern int cross_channels; +extern int uses_emphasis; extern int do_pre_emphasis; extern int do_de_emphasis; extern double rx_gain; diff --git a/src/common/main_common.c b/src/common/main_common.c index 5fd1bc9..6bd0f2e 100644 --- a/src/common/main_common.c +++ b/src/common/main_common.c @@ -43,6 +43,7 @@ int samplerate = 48000; int interval = 1; int latency = 50; int cross_channels = 0; +int uses_emphasis = 1; int do_pre_emphasis = 0; int do_de_emphasis = 0; double rx_gain = 1.0; @@ -83,12 +84,14 @@ void print_help_common(const char *arg0, const char *ext_usage) printf(" -x --cross\n"); printf(" Cross channels on sound card. 1st channel (right) is swapped with\n"); printf(" second channel (left)\n"); + if (uses_emphasis) { printf(" -p --pre-emphasis\n"); printf(" Enable pre-emphasis, if you directly connect to the oscillator of the\n"); printf(" transmitter. (No pre-emphasis done by the transmitter.)\n"); printf(" -d --de-emphasis\n"); printf(" Enable de-emphasis, if you directly connect to the discriminator of\n"); printf(" the receiver. (No de-emphasis done by the receiver.)\n"); + } printf(" -g --rx-gain \n"); printf(" Raise receiver RX level by given gain in dB. This is useful if input\n"); printf(" level of the sound device is too low, even after setting maximum level\n"); @@ -234,10 +237,17 @@ void opt_switch_common(int c, char *arg0, int *skip_args) *skip_args += 1; break; case 'p': + if (!uses_emphasis) { + no_emph: + fprintf(stderr, "A-Netz does not use emphasis, please do not enable pre- or de-emphasis! Disable emphasis on transceiver, if possible.\n"); + exit(0); + } do_pre_emphasis = 1; *skip_args += 1; break; case 'd': + if (!uses_emphasis) + goto no_emph; do_de_emphasis = 1; *skip_args += 1; break;