aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/amps/amps.h4
-rw-r--r--src/amps/dsp.c4
-rw-r--r--src/cnetz/cnetz.h4
-rw-r--r--src/cnetz/dsp.c6
-rw-r--r--src/common/Makefile.am2
-rw-r--r--src/common/compandor.c (renamed from src/common/compander.c)12
-rw-r--r--src/common/compandor.h (renamed from src/common/compander.h)10
-rw-r--r--src/nmt/dsp.c6
-rw-r--r--src/nmt/frame.c4
-rw-r--r--src/nmt/main.c12
-rw-r--r--src/nmt/nmt.c14
-rw-r--r--src/nmt/nmt.h8
-rw-r--r--src/test/Makefile.am6
-rw-r--r--src/test/test_compandor.c (renamed from src/test/test_compander.c)6
14 files changed, 49 insertions, 49 deletions
diff --git a/src/amps/amps.h b/src/amps/amps.h
index a6b0302..1ce3c62 100644
--- a/src/amps/amps.h
+++ b/src/amps/amps.h
@@ -1,5 +1,5 @@
#include "../common/sender.h"
-#include "../common/compander.h"
+#include "../common/compandor.h"
#include "sysinfo.h"
#include "transaction.h"
@@ -35,7 +35,7 @@ enum fsk_rx_sync {
typedef struct amps {
sender_t sender;
- compander_t cstate;
+ compandor_t cstate;
int pre_emphasis; /* use pre_emphasis by this instance */
int de_emphasis; /* use de_emphasis by this instance */
emphasis_t estate;
diff --git a/src/amps/dsp.c b/src/amps/dsp.c
index 1be5fbe..8847c72 100644
--- a/src/amps/dsp.c
+++ b/src/amps/dsp.c
@@ -75,7 +75,7 @@
#define FSK_DEVIATION 32767.0 /* +-8 KHz */
#define SAT_DEVIATION 8192.0 /* +-2 KHz */
-#define TX_AUDIO_0dBm0 45000 /* works quite well */
+#define COMPANDOR_0DB 45000 /* works quite well */
#define BITRATE 10000
#define SIG_TONE_CROSSINGS 2000 /* 2000 crossings are 100ms @ 10 KHz */
#define SIG_TONE_MINBITS 950 /* minimum bit durations to detect signalling tone (1000 is perfect for 100 ms) */
@@ -145,7 +145,7 @@ int dsp_init_sender(amps_t *amps, int high_pass)
double RC, dt;
/* attack (3ms) and recovery time (13.5ms) according to amps specs */
- init_compander(&amps->cstate, 8000, 3.0, 13.5, TX_AUDIO_0dBm0);
+ init_compandor(&amps->cstate, 8000, 3.0, 13.5, COMPANDOR_0DB);
PDEBUG(DDSP, DEBUG_DEBUG, "Init DSP for transceiver.\n");
diff --git a/src/cnetz/cnetz.h b/src/cnetz/cnetz.h
index 59b18ea..bbdd937 100644
--- a/src/cnetz/cnetz.h
+++ b/src/cnetz/cnetz.h
@@ -1,4 +1,4 @@
-#include "../common/compander.h"
+#include "../common/compandor.h"
#include "../common/sender.h"
#include "fsk_fm_demod.h"
#include "scrambler.h"
@@ -58,7 +58,7 @@ typedef struct cnetz {
enum cnetz_chan_type chan_type; /* channel type */
scrambler_t scrambler_tx; /* mirror what we transmit to MS */
scrambler_t scrambler_rx; /* mirror what we receive from MS */
- compander_t cstate;
+ compandor_t cstate;
int pre_emphasis; /* use pre_emphasis by this instance */
int de_emphasis; /* use de_emphasis by this instance */
emphasis_t estate;
diff --git a/src/cnetz/dsp.c b/src/cnetz/dsp.c
index cca40dc..8c8d836 100644
--- a/src/cnetz/dsp.c
+++ b/src/cnetz/dsp.c
@@ -39,7 +39,7 @@
#define PI M_PI
#define FSK_DEVIATION 10000
-#define COMPANDER_0DB 20000
+#define COMPANDOR_0DB 20000
#define BITRATE 5280.0 /* bits per second */
#define BLOCK_BITS 198 /* duration of one time slot including pause at beginning and end */
#define CUT_OFF_OFFSET 300.0 /* cut off frequency for offset filter (level correction between subsequent audio chunks) */
@@ -138,9 +138,9 @@ int dsp_init_sender(cnetz_t *cnetz, int measure_speed, double clock_speed[2], do
if (rc < 0)
goto error;
- /* init compander, according to C-Netz specs, attack and recovery time
+ /* init compandor, according to C-Netz specs, attack and recovery time
* shall not exceed according to ITU G.162 */
- init_compander(&cnetz->cstate, 8000, 5.0, 22.5, COMPANDER_0DB);
+ init_compandor(&cnetz->cstate, 8000, 5.0, 22.5, COMPANDOR_0DB);
/* use this filter to compensate level changes between two subsequent audio chunks */
RC = 1.0 / (CUT_OFF_OFFSET * 2.0 *3.14);
diff --git a/src/common/Makefile.am b/src/common/Makefile.am
index f15a9ad..ab53e20 100644
--- a/src/common/Makefile.am
+++ b/src/common/Makefile.am
@@ -19,7 +19,7 @@ libcommon_a_SOURCES = \
../common/mncc_sock.c \
../common/cause.c \
../common/emphasis.c \
- ../common/compander.c \
+ ../common/compandor.c \
../common/sender.c \
../common/display_wave.c \
../common/main_common.c
diff --git a/src/common/compander.c b/src/common/compandor.c
index 4413bb5..9aacbf6 100644
--- a/src/common/compander.c
+++ b/src/common/compandor.c
@@ -1,4 +1,4 @@
-/* Compander to use various networks like C-Netz / NMT / AMPS
+/* Compandor to use various networks like C-Netz / NMT / AMPS
*
* (C) 2016 by Andreas Eversberg <jolly@eversberg.eu>
* All Rights Reserved
@@ -21,7 +21,7 @@
#include <stdint.h>
#include <string.h>
#include <math.h>
-#include "compander.h"
+#include "compandor.h"
//#define db2level(db) pow(10, (double)db / 20.0)
@@ -37,12 +37,12 @@
static double sqrt_tab[10000];
/*
- * Init compander according to ITU-T G.162 specification
+ * Init compandor according to ITU-T G.162 specification
*
* Hopefully this is correct
*
*/
-void init_compander(compander_t *state, int samplerate, double attack_ms, double recovery_ms, int unaffected_level)
+void init_compandor(compandor_t *state, int samplerate, double attack_ms, double recovery_ms, int unaffected_level)
{
int i;
@@ -64,7 +64,7 @@ void init_compander(compander_t *state, int samplerate, double attack_ms, double
sqrt_tab[i] = sqrt(i * 0.001);
}
-void compress_audio(compander_t *state, int16_t *samples, int num)
+void compress_audio(compandor_t *state, int16_t *samples, int num)
{
int32_t sample;
double value, peak, envelope, step_up, step_down, unaffected;
@@ -114,7 +114,7 @@ void compress_audio(compander_t *state, int16_t *samples, int num)
state->c.peak = peak;
}
-void expand_audio(compander_t *state, int16_t *samples, int num)
+void expand_audio(compandor_t *state, int16_t *samples, int num)
{
int32_t sample;
double value, peak, envelope, step_up, step_down, unaffected;
diff --git a/src/common/compander.h b/src/common/compandor.h
index 53d1967..df7dbc2 100644
--- a/src/common/compander.h
+++ b/src/common/compandor.h
@@ -1,4 +1,4 @@
-typedef struct compander {
+typedef struct compandor {
struct {
double unaffected;
double step_up;
@@ -13,9 +13,9 @@ typedef struct compander {
double peak;
double envelope;
} e;
-} compander_t;
+} compandor_t;
-void init_compander(compander_t *state, int samplerate, double attack_ms, double recovery_ms, int unaffected_level);
-void compress_audio(compander_t *state, int16_t *samples, int num);
-void expand_audio(compander_t *state, int16_t *samples, int num);
+void init_compandor(compandor_t *state, int samplerate, double attack_ms, double recovery_ms, int unaffected_level);
+void compress_audio(compandor_t *state, int16_t *samples, int num);
+void expand_audio(compandor_t *state, int16_t *samples, int num);
diff --git a/src/nmt/dsp.c b/src/nmt/dsp.c
index bc637c7..810e2a5 100644
--- a/src/nmt/dsp.c
+++ b/src/nmt/dsp.c
@@ -33,7 +33,7 @@
#define PI M_PI
/* signalling */
-#define TX_AUDIO_0dBm0 32767 /* works quite well */
+#define COMPANDOR_0DB 32767 /* works quite well */
#define TX_PEAK_FSK 10000.0 /* peak amplitude of signalling FSK */
#define TX_PEAK_SUPER 1000.0 /* peak amplitude of supervisory signal */
#define BIT_RATE 1200 /* baud rate */
@@ -85,7 +85,7 @@ int dsp_init_sender(nmt_t *nmt)
int i;
/* attack (3ms) and recovery time (13.5ms) according to NMT specs */
- init_compander(&nmt->cstate, 8000, 3.0, 13.5, TX_AUDIO_0dBm0);
+ init_compandor(&nmt->cstate, 8000, 3.0, 13.5, COMPANDOR_0DB);
if ((nmt->sender.samplerate % (BIT_RATE * STEPS_PER_BIT))) {
PDEBUG(DDSP, DEBUG_ERROR, "Sample rate must be a multiple of %d bits per second.\n", BIT_RATE * STEPS_PER_BIT);
@@ -449,7 +449,7 @@ void sender_receive(sender_t *sender, int16_t *samples, int length)
int count;
count = samplerate_downsample(&nmt->sender.srstate, samples, length, down);
- if (nmt->compander)
+ if (nmt->compandor)
expand_audio(&nmt->cstate, down, count);
if (nmt->dsp_mode == DSP_MODE_DTMF)
dtmf_tone(&nmt->dtmf, down, count);
diff --git a/src/nmt/frame.c b/src/nmt/frame.c
index d70e785..4c7f931 100644
--- a/src/nmt/frame.c
+++ b/src/nmt/frame.c
@@ -273,13 +273,13 @@ static const char *param_line_signal(uint64_t value, int ndigits, enum nmt_direc
desc = "Acknowledge MFT converter in";
break;
case 5:
- desc = "Switch compander in";
+ desc = "Switch compandor in";
break;
case 6:
desc = "Address complete";
break;
case 7:
- desc = "Switch compander out";
+ desc = "Switch compandor out";
break;
case 9:
desc = "Ringing order";
diff --git a/src/nmt/main.c b/src/nmt/main.c
index e19a937..d696c6f 100644
--- a/src/nmt/main.c
+++ b/src/nmt/main.c
@@ -42,7 +42,7 @@ enum nmt_chan_type chan_type[MAX_SENDER] = { CHAN_TYPE_CC_TC };
int ms_power = 1; /* 1..3 */
char traffic_area[3] = "";
char area_no = 0;
-int compander = 1;
+int compandor = 1;
int supervisory = 0;
void print_help(const char *arg0)
@@ -64,8 +64,8 @@ void print_help(const char *arg0)
printf(" Use 'list' to get a list of available short country code names\n");
printf(" -a --area-number <area no> | 0\n");
printf(" Give area number 1..4 or 0 for no area number. (default = '%d')\n", area_no);
- printf(" -C --compander 1 | 0\n");
- printf(" Make use of the compander to reduce noise during call. (default = '%d')\n", compander);
+ printf(" -C --compandor 1 | 0\n");
+ printf(" Make use of the compandor to reduce noise during call. (default = '%d')\n", compandor);
printf(" -0 --supervisory 1..4 | 0\n");
printf(" Use supervisory signal 1..4 to detect loss of signal from mobile\n");
printf(" station, use 0 to disable. (default = '%d')\n", supervisory);
@@ -83,7 +83,7 @@ static int handle_options(int argc, char **argv)
{"ms-power", 1, 0, 'P'},
{"area-number", 1, 0, 'a'},
{"traffic-area", 1, 0, 'y'},
- {"compander", 1, 0, 'C'},
+ {"compandor", 1, 0, 'C'},
{"supervisory", 1, 0, '0'},
{0, 0, 0, 0}
};
@@ -165,7 +165,7 @@ error_ta:
skip_args += 2;
break;
case 'C':
- compander = atoi(optarg);
+ compandor = atoi(optarg);
skip_args += 2;
break;
case '0':
@@ -258,7 +258,7 @@ int main(int argc, char *argv[])
/* create transceiver instance */
for (i = 0; i < num_kanal; i++) {
- rc = nmt_create(kanal[i], (loopback) ? CHAN_TYPE_TEST : chan_type[i], sounddev[i], samplerate, cross_channels, rx_gain, do_pre_emphasis, do_de_emphasis, write_wave, read_wave, ms_power, nmt_digits2value(traffic_area, 2), area_no, compander, supervisory, loopback);
+ rc = nmt_create(kanal[i], (loopback) ? CHAN_TYPE_TEST : chan_type[i], sounddev[i], samplerate, cross_channels, rx_gain, do_pre_emphasis, do_de_emphasis, write_wave, read_wave, ms_power, nmt_digits2value(traffic_area, 2), area_no, compandor, supervisory, loopback);
if (rc < 0) {
fprintf(stderr, "Failed to create transceiver instance. Quitting!\n");
goto fail;
diff --git a/src/nmt/nmt.c b/src/nmt/nmt.c
index b932853..b192a60 100644
--- a/src/nmt/nmt.c
+++ b/src/nmt/nmt.c
@@ -283,7 +283,7 @@ static void nmt_timeout(struct timer *timer);
static void nmt_go_idle(nmt_t *nmt);
/* Create transceiver instance and link to a list. */
-int nmt_create(int channel, enum nmt_chan_type chan_type, const char *sounddev, int samplerate, int cross_channels, double rx_gain, int pre_emphasis, int de_emphasis, const char *write_wave, const char *read_wave, uint8_t ms_power, uint8_t traffic_area, uint8_t area_no, int compander, int supervisory, int loopback)
+int nmt_create(int channel, enum nmt_chan_type chan_type, const char *sounddev, int samplerate, int cross_channels, double rx_gain, int pre_emphasis, int de_emphasis, const char *write_wave, const char *read_wave, uint8_t ms_power, uint8_t traffic_area, uint8_t area_no, int compandor, int supervisory, int loopback)
{
nmt_t *nmt;
int rc;
@@ -342,7 +342,7 @@ int nmt_create(int channel, enum nmt_chan_type chan_type, const char *sounddev,
nmt->sysinfo.ms_power = ms_power;
nmt->sysinfo.traffic_area = traffic_area;
nmt->sysinfo.area_no = area_no;
- nmt->compander = compander;
+ nmt->compandor = compandor;
nmt->supervisory = supervisory;
/* go into idle state */
@@ -778,10 +778,10 @@ static void tx_mo_complete(nmt_t *nmt, frame_t *frame)
if (nmt->tx_frame_count == 1)
PDEBUG(DNMT, DEBUG_INFO, "Send 'addess complete'.\n");
} else {
- if (nmt->compander) {
+ if (nmt->compandor) {
set_line_signal(nmt, frame, 5);
if (nmt->tx_frame_count == 5)
- PDEBUG(DNMT, DEBUG_INFO, "Send 'compander in'.\n");
+ PDEBUG(DNMT, DEBUG_INFO, "Send 'compandor in'.\n");
} else
frame->index = NMT_MESSAGE_6;
if (nmt->tx_frame_count == 9) {
@@ -946,9 +946,9 @@ static void tx_mt_complete(nmt_t *nmt, frame_t *frame)
{
set_line_signal(nmt, frame, 5);
++nmt->tx_frame_count;
- if (nmt->compander) {
+ if (nmt->compandor) {
if (nmt->tx_frame_count == 1)
- PDEBUG(DNMT, DEBUG_INFO, "Send 'compander in'.\n");
+ PDEBUG(DNMT, DEBUG_INFO, "Send 'compandor in'.\n");
} else
frame->index = NMT_MESSAGE_6;
if (nmt->tx_frame_count == 5) {
@@ -1492,7 +1492,7 @@ void call_rx_audio(int callref, int16_t *samples, int count)
if (nmt->dsp_mode == DSP_MODE_AUDIO || nmt->dsp_mode == DSP_MODE_DTMF) {
int16_t up[(int)((double)count * nmt->sender.srstate.factor + 0.5) + 10];
- if (nmt->compander)
+ if (nmt->compandor)
compress_audio(&nmt->cstate, samples, count);
count = samplerate_upsample(&nmt->sender.srstate, samples, count, up);
jitter_save(&nmt->sender.audio, up, count);
diff --git a/src/nmt/nmt.h b/src/nmt/nmt.h
index 626ca7b..7efbc9d 100644
--- a/src/nmt/nmt.h
+++ b/src/nmt/nmt.h
@@ -1,5 +1,5 @@
#include "../common/sender.h"
-#include "../common/compander.h"
+#include "../common/compandor.h"
#include "../common/dtmf.h"
enum dsp_mode {
@@ -72,7 +72,7 @@ const char *nmt_dir_name(enum nmt_direction dir);
typedef struct nmt {
sender_t sender;
nmt_sysinfo_t sysinfo;
- compander_t cstate;
+ compandor_t cstate;
dtmf_t dtmf;
/* sender's states */
@@ -90,7 +90,7 @@ typedef struct nmt {
int mt_channel; /* channel to use */
/* features */
- int compander; /* if compander shall be used */
+ int compandor; /* if compandor shall be used */
int supervisory; /* if set, use supervisory signal 1..4 */
/* dsp states */
@@ -138,7 +138,7 @@ const char *chan_type_long_name(enum nmt_chan_type chan_type);
double nmt_channel2freq(int channel, int uplink);
void nmt_country_list(void);
uint8_t nmt_country_by_short_name(const char *short_name);
-int nmt_create(int channel, enum nmt_chan_type chan_type, const char *sounddev, int samplerate, int cross_channels, double rx_gain, int pre_emphasis, int de_emphasis, const char *write_wave, const char *read_wave, uint8_t ms_power, uint8_t traffic_area, uint8_t area_no, int compander, int supervisory, int loopback);
+int nmt_create(int channel, enum nmt_chan_type chan_type, const char *sounddev, int samplerate, int cross_channels, double rx_gain, int pre_emphasis, int de_emphasis, const char *write_wave, const char *read_wave, uint8_t ms_power, uint8_t traffic_area, uint8_t area_no, int compandor, int supervisory, int loopback);
void nmt_destroy(sender_t *sender);
void nmt_receive_frame(nmt_t *nmt, const char *bits, double quality, double level, double frames_elapsed);
const char *nmt_get_frame(nmt_t *nmt);
diff --git a/src/test/Makefile.am b/src/test/Makefile.am
index 0463b49..9986f68 100644
--- a/src/test/Makefile.am
+++ b/src/test/Makefile.am
@@ -1,12 +1,12 @@
AM_CPPFLAGS = -Wall -g $(all_includes)
noinst_PROGRAMS = \
- test_compander \
+ test_compandor \
test_emphasis
-test_compander_SOURCES = test_compander.c
+test_compandor_SOURCES = test_compandor.c
-test_compander_LDADD = \
+test_compandor_LDADD = \
$(COMMON_LA) \
$(top_builddir)/src/common/libcommon.a \
-lm
diff --git a/src/test/test_compander.c b/src/test/test_compandor.c
index d1661b4..74f4f28 100644
--- a/src/test/test_compander.c
+++ b/src/test/test_compandor.c
@@ -2,7 +2,7 @@
#include <stdint.h>
#include <math.h>
#include <string.h>
-#include "../common/compander.h"
+#include "../common/compandor.h"
#define level2db(level) (20 * log10(level))
#define db2level(db) pow(10, (double)db / 20.0)
@@ -66,11 +66,11 @@ static void check_level(int16_t *samples, double duration, const char *desc, dou
int main(void)
{
- compander_t cstate;
+ compandor_t cstate;
int16_t samples[SAMPLERATE * 2];
int f;
- init_compander(&cstate, SAMPLERATE, ATTACK_MS, RECOVERY_MS, UNAFFECTED);
+ init_compandor(&cstate, SAMPLERATE, ATTACK_MS, RECOVERY_MS, UNAFFECTED);
for (f = 0; f < 3; f++) {
/* -16 and -4 dB */