aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2019-01-02 15:58:34 +0100
committerAndreas Eversberg <jolly@eversberg.eu>2019-01-02 15:58:34 +0100
commit1321f664565716679a2e73a5cd191c03029f7690 (patch)
tree87ec72f504e01f464716c2e6867bb00cd74e839b /src
parentf1292a985bf8f19d9538e6337c229db1b463a547 (diff)
C-Netz: Add option to control voice deviation
Diffstat (limited to 'src')
-rw-r--r--src/cnetz/cnetz.c4
-rw-r--r--src/cnetz/cnetz.h2
-rw-r--r--src/cnetz/dsp.c7
-rw-r--r--src/cnetz/dsp.h2
-rw-r--r--src/cnetz/main.c11
5 files changed, 17 insertions, 9 deletions
diff --git a/src/cnetz/cnetz.c b/src/cnetz/cnetz.c
index 2820b13..8109566 100644
--- a/src/cnetz/cnetz.c
+++ b/src/cnetz/cnetz.c
@@ -246,7 +246,7 @@ int cnetz_init(void)
}
/* Create transceiver instance and link to a list. */
-int cnetz_create(int kanal, enum cnetz_chan_type chan_type, const char *audiodev, int use_sdr, enum demod_type demod, int samplerate, double rx_gain, int auth, int warteschlange, int metering, int ms_power, int measure_speed, double clock_speed[2], int polarity, int pre_emphasis, int de_emphasis, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, const char *read_tx_wave, int loopback)
+int cnetz_create(int kanal, enum cnetz_chan_type chan_type, const char *audiodev, int use_sdr, enum demod_type demod, int samplerate, double rx_gain, int auth, int warteschlange, int metering, double dbm0_deviation, int ms_power, int measure_speed, double clock_speed[2], int polarity, int pre_emphasis, int de_emphasis, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, const char *read_tx_wave, int loopback)
{
sender_t *sender;
cnetz_t *cnetz;
@@ -320,7 +320,7 @@ int cnetz_create(int kanal, enum cnetz_chan_type chan_type, const char *audiodev
#endif
/* init audio processing */
- rc = dsp_init_sender(cnetz, measure_speed, clock_speed, demod);
+ rc = dsp_init_sender(cnetz, measure_speed, clock_speed, demod, dbm0_deviation);
if (rc < 0) {
PDEBUG(DCNETZ, DEBUG_ERROR, "Failed to init signal processing!\n");
goto error;
diff --git a/src/cnetz/cnetz.h b/src/cnetz/cnetz.h
index 9f41470..feaec7b 100644
--- a/src/cnetz/cnetz.h
+++ b/src/cnetz/cnetz.h
@@ -133,7 +133,7 @@ int cnetz_channel_by_short_name(const char *short_name);
const char *chan_type_short_name(enum cnetz_chan_type chan_type);
const char *chan_type_long_name(enum cnetz_chan_type chan_type);
int cnetz_init(void);
-int cnetz_create(int kanal, enum cnetz_chan_type chan_type, const char *audiodev, int use_sdr, enum demod_type demod, int samplerate, double rx_gain, int auth, int warteschlange, int metering, int ms_power, int measure_speed, double clock_speed[2], int polarity, int pre_emphasis, int de_emphasis, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, const char *read_tx_wave, int loopback);
+int cnetz_create(int kanal, enum cnetz_chan_type chan_type, const char *audiodev, int use_sdr, enum demod_type demod, int samplerate, double rx_gain, int auth, int warteschlange, int metering, double dbm0_deviation, int ms_power, int measure_speed, double clock_speed[2], int polarity, int pre_emphasis, int de_emphasis, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, const char *read_tx_wave, int loopback);
void cnetz_destroy(sender_t *sender);
void cnetz_go_idle(cnetz_t *cnetz);
void cnetz_sync_frame(cnetz_t *cnetz, double sync, int ts);
diff --git a/src/cnetz/dsp.c b/src/cnetz/dsp.c
index f05c883..1ecd67b 100644
--- a/src/cnetz/dsp.c
+++ b/src/cnetz/dsp.c
@@ -42,8 +42,7 @@
#define MAX_DEVIATION 4000.0
#define MAX_MODULATION 3000.0
-#define DBM0_DEVIATION 4000.0 /* deviation of dBm0 at 1 kHz */
-#define FSK_DEVIATION (2500.0 / DBM0_DEVIATION) /* no emphasis */
+#define FSK_DEVIATION (2500.0 / dbm0_deviation) /* no emphasis */
#define MAX_DISPLAY 1.4 /* something above dBm0, no emphasis */
#define BITRATE 5280.0 /* bits per second */
#define BLOCK_BITS 198 /* duration of one time slot including pause at beginning and end */
@@ -81,7 +80,7 @@ static void dsp_init_ramp(cnetz_t *cnetz)
}
/* Init transceiver instance. */
-int dsp_init_sender(cnetz_t *cnetz, int measure_speed, double clock_speed[2], enum demod_type demod)
+int dsp_init_sender(cnetz_t *cnetz, int measure_speed, double clock_speed[2], enum demod_type demod, double dbm0_deviation)
{
int rc = 0;
double size;
@@ -90,7 +89,7 @@ int dsp_init_sender(cnetz_t *cnetz, int measure_speed, double clock_speed[2], en
PDEBUG_CHAN(DDSP, DEBUG_DEBUG, "Init FSK for 'Sender'.\n");
/* set modulation parameters */
- sender_set_fm(&cnetz->sender, MAX_DEVIATION, MAX_MODULATION, DBM0_DEVIATION, MAX_DISPLAY);
+ sender_set_fm(&cnetz->sender, MAX_DEVIATION, MAX_MODULATION, dbm0_deviation, MAX_DISPLAY);
if (measure_speed) {
cnetz->measure_speed = measure_speed;
diff --git a/src/cnetz/dsp.h b/src/cnetz/dsp.h
index 4e66f26..34e8f38 100644
--- a/src/cnetz/dsp.h
+++ b/src/cnetz/dsp.h
@@ -1,6 +1,6 @@
void dsp_init(void);
-int dsp_init_sender(cnetz_t *cnetz, int measure_speed, double clock_speed[2], enum demod_type demod);
+int dsp_init_sender(cnetz_t *cnetz, int measure_speed, double clock_speed[2], enum demod_type demod, double dbm0_deviation);
void dsp_cleanup_sender(cnetz_t *cnetz);
void calc_clock_speed(cnetz_t *cnetz, double samples, int tx, int result);
void unshrink_speech(cnetz_t *cnetz, sample_t *speech_buffer, int count);
diff --git a/src/cnetz/main.c b/src/cnetz/main.c
index 021eccb..c373fa6 100644
--- a/src/cnetz/main.c
+++ b/src/cnetz/main.c
@@ -68,6 +68,7 @@ int8_t futln_sperre_start = -1; /* no blocking */
int8_t futln_sperre_end = -1; /* no range */
enum demod_type demod = FSK_DEMOD_AUTO;
int metering = 20;
+double dbm0_deviation = 4000.0; /* best results with all my equipment */
void print_help(const char *arg0)
{
@@ -103,6 +104,10 @@ void print_help(const char *arg0)
printf(" -G --gebuehren <seconds> | 0\n");
printf(" Increment metering counter every given number of seconds.\n");
printf(" To turn off, use 0. (default = %d)\n", metering);
+ printf(" -V --voice-deviation <2400..4000 Hz>\n");
+ printf(" It is unclear what the actual voice deviation is. Please decrease, if\n");
+ printf(" mobile's microphone is too loud and speaker is too quiet.\n");
+ printf(" (default = %.0f)\n", dbm0_deviation);
printf(" -S --sysinfo fuz-nat=<nat>\n");
printf(" Set country ID of base station. All IDs were used inside Germany only.\n");
printf(" (default = %d)\n", fuz_nat);
@@ -230,6 +235,7 @@ static void add_options(void)
option_add('Q', "queue", 1);
option_add(OPT_WARTESCHLANGE, "warteschlange", 1);
option_add('G', "gebuehren", 1);
+ option_add('V', "voice-deviation", 1);
option_add('S', "sysinfo", 1);
option_add('D', "demod", 1);
}
@@ -290,6 +296,9 @@ static int handle_options(int short_option, int argi, char **argv)
case 'G':
metering = atoi(argv[argi]);
break;
+ case 'V':
+ dbm0_deviation = atoi_limit(argv[argi], 2400, 4000);
+ break;
case 'S':
p = strchr(argv[argi], '=');
if (!p) {
@@ -542,7 +551,7 @@ int main(int argc, char *argv[])
/* create transceiver instance */
for (i = 0; i < num_kanal; i++) {
- rc = cnetz_create(kanal[i], chan_type[i], audiodev[i], use_sdr, demod, samplerate, rx_gain, auth, warteschlange, metering, ms_power, (i == 0) ? measure_speed : 0, clock_speed, polarity, do_pre_emphasis, do_de_emphasis, write_rx_wave, write_tx_wave, read_rx_wave, read_tx_wave, loopback);
+ rc = cnetz_create(kanal[i], chan_type[i], audiodev[i], use_sdr, demod, samplerate, rx_gain, auth, warteschlange, metering, dbm0_deviation, ms_power, (i == 0) ? measure_speed : 0, clock_speed, polarity, do_pre_emphasis, do_de_emphasis, write_rx_wave, write_tx_wave, read_rx_wave, read_tx_wave, loopback);
if (rc < 0) {
fprintf(stderr, "Failed to create \"Sender\" instance. Quitting!\n");
goto fail;