aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2017-01-29 10:30:06 +0100
committerAndreas Eversberg <jolly@eversberg.eu>2017-02-18 21:01:17 +0100
commit8cb0187133c496175cb90eefa8cfb347678b4d88 (patch)
tree49aca3bc9247c294c5fa8a8285cac0c24f661368
parentf5e9a97c313b88ec7b4485adf941f1106ef67b6a (diff)
C-Netz: Remove the obviously useless noise function for unused timeslots
-rw-r--r--src/cnetz/cnetz.c4
-rw-r--r--src/cnetz/cnetz.h3
-rw-r--r--src/cnetz/dsp.c31
-rw-r--r--src/cnetz/dsp.h2
-rw-r--r--src/cnetz/main.c10
5 files changed, 14 insertions, 36 deletions
diff --git a/src/cnetz/cnetz.c b/src/cnetz/cnetz.c
index 57cd289..8413549 100644
--- a/src/cnetz/cnetz.c
+++ b/src/cnetz/cnetz.c
@@ -216,7 +216,7 @@ int cnetz_init(void)
static void cnetz_go_idle(cnetz_t *cnetz);
/* Create transceiver instance and link to a list. */
-int cnetz_create(int kanal, enum cnetz_chan_type chan_type, const char *audiodev, int samplerate, double rx_gain, int auth, int ms_power, int measure_speed, double clock_speed[2], int polarity, double noise, int pre_emphasis, int de_emphasis, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, int loopback)
+int cnetz_create(int kanal, enum cnetz_chan_type chan_type, const char *audiodev, int samplerate, double rx_gain, int auth, 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, int loopback)
{
sender_t *sender;
cnetz_t *cnetz;
@@ -290,7 +290,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, noise);
+ rc = dsp_init_sender(cnetz, measure_speed, clock_speed);
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 7dda4d3..e10a89a 100644
--- a/src/cnetz/cnetz.h
+++ b/src/cnetz/cnetz.h
@@ -88,7 +88,6 @@ typedef struct cnetz {
double fsk_deviation; /* deviation of FSK signal on sound card */
sample_t fsk_ramp_up[256]; /* samples of upward ramp shape */
sample_t fsk_ramp_down[256]; /* samples of downward ramp shape */
- double fsk_noise; /* send static between OgK frames */
double fsk_bitduration; /* duration of a bit in samples */
sample_t *fsk_tx_buffer; /* tx buffer for one data block */
int fsk_tx_buffer_size; /* size of tx buffer (in samples) */
@@ -123,7 +122,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 samplerate, double rx_gain, int auth, int ms_power, int measure_speed, double clock_speed[2], int polarity, double noise, int pre_emphasis, int de_emphasis, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, int loopback);
+int cnetz_create(int kanal, enum cnetz_chan_type chan_type, const char *audiodev, int samplerate, double rx_gain, int auth, 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, int loopback);
void cnetz_destroy(sender_t *sender);
void cnetz_sync_frame(cnetz_t *cnetz, double sync, int ts);
int cnetz_meldeaufruf(uint8_t futln_nat, uint8_t futln_fuvst, uint16_t futln_rest);
diff --git a/src/cnetz/dsp.c b/src/cnetz/dsp.c
index 1fc404a..b5f9d53 100644
--- a/src/cnetz/dsp.c
+++ b/src/cnetz/dsp.c
@@ -85,7 +85,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], double noise)
+int dsp_init_sender(cnetz_t *cnetz, int measure_speed, double clock_speed[2])
{
int rc = 0;
double size;
@@ -123,7 +123,6 @@ int dsp_init_sender(cnetz_t *cnetz, int measure_speed, double clock_speed[2], do
/* create devation and ramp */
cnetz->fsk_deviation = FSK_DEVIATION;
dsp_init_ramp(cnetz);
- cnetz->fsk_noise = noise;
/* create speech buffer */
cnetz->dsp_speech_buffer = calloc(sizeof(sample_t), cnetz->sender.samplerate); /* buffer is greater than sr/1.1, just to be secure */
@@ -279,32 +278,20 @@ static int fsk_testtone_encode(cnetz_t *cnetz)
static int fsk_nothing_encode(cnetz_t *cnetz)
{
sample_t *spl;
- double phase, bitstep, r;
+ double phase, bitstep;
int i, count;
spl = cnetz->fsk_tx_buffer;
phase = cnetz->fsk_tx_phase;
bitstep = cnetz->fsk_tx_bitstep * 256.0;
- if (cnetz->fsk_noise) {
- r = cnetz->fsk_noise;
- /* add 198 bits of noise */
- for (i = 0; i < 198; i++) {
- do {
- *spl++ = (double)((int16_t)random()) * r / 32768.0;
- phase += bitstep;
- } while (phase < 256.0);
- phase -= 256.0;
- }
- } else {
- /* add 198 bits of silence */
- for (i = 0; i < 198; i++) {
- do {
- *spl++ = 0;
- phase += bitstep;
- } while (phase < 256.0);
- phase -= 256.0;
- }
+ /* add 198 bits of silence */
+ for (i = 0; i < 198; i++) {
+ do {
+ *spl++ = 0;
+ phase += bitstep;
+ } while (phase < 256.0);
+ phase -= 256.0;
}
/* depending on the number of samples, return the number */
diff --git a/src/cnetz/dsp.h b/src/cnetz/dsp.h
index 16ea2a7..64aa5a3 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], double noise);
+int dsp_init_sender(cnetz_t *cnetz, int measure_speed, double clock_speed[2]);
void dsp_cleanup_sender(cnetz_t *cnetz);
void calc_clock_speed(cnetz_t *cnetz, uint64_t 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 9445473..31fc878 100644
--- a/src/cnetz/main.c
+++ b/src/cnetz/main.c
@@ -45,7 +45,6 @@ int measure_speed = 0;
double clock_speed[2] = { 0.0, 0.0 };
int set_clock_speed = 0;
const char *flip_polarity = "auto";
-double noise = 0.0;
int ms_power = 0; /* 0..3 */
int auth = 0;
int voice_deviation = 1;
@@ -70,8 +69,6 @@ void print_help(const char *arg0)
printf(" base station generates two virtual base stations with both polarities.\n");
printf(" Once a mobile registers, the correct polarity is selected and used.\n");
printf(" (default = %s)\n", flip_polarity);
- printf(" -N --noise 0.0 .. 1.0 (default = %.1f)\n", noise);
- printf(" Between frames on OgK, send noise at given level. Use 0.0 for Silence.\n");
printf(" -P --ms-power <power level>\n");
printf(" Give power level of the mobile station 0..3. (default = '%d')\n", ms_power);
printf(" 0 = 50-125 mW; 1 = 0.5-1 W; 2 = 4-8 W; 3 = 10-20 W\n");
@@ -99,7 +96,6 @@ static int handle_options(int argc, char **argv)
{"measure-speed", 0, 0, 'M'},
{"clock-speed", 1, 0, 'S'},
{"flip-polarity", 1, 0, 'F'},
- {"noise", 1, 0, 'N'},
{"ms-power", 1, 0, 'P'},
{"authentication", 0, 0, 'A'},
{"voice-deviation", 0, 0, 'V'},
@@ -158,10 +154,6 @@ static int handle_options(int argc, char **argv)
}
skip_args += 2;
break;
- case 'N':
- noise = strtold(optarg, NULL);
- skip_args += 2;
- break;
case 'P':
ms_power = atoi(optarg);
if (ms_power > 3)
@@ -302,7 +294,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], samplerate, rx_gain, auth, ms_power, (i == 0) ? measure_speed : 0, clock_speed, polarity, noise, do_pre_emphasis, do_de_emphasis, write_rx_wave, write_tx_wave, read_rx_wave, loopback);
+ rc = cnetz_create(kanal[i], chan_type[i], audiodev[i], samplerate, rx_gain, auth, 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, loopback);
if (rc < 0) {
fprintf(stderr, "Failed to create \"Sender\" instance. Quitting!\n");
goto fail;