common code: Add input gain option

This commit is contained in:
Andreas Eversberg
2016-05-06 07:00:27 +02:00
parent ba91ee82a7
commit bae12156a2
16 changed files with 80 additions and 39 deletions

View File

@@ -137,7 +137,7 @@ static void anetz_timeout(struct timer *timer);
static void anetz_go_idle(anetz_t *anetz); static void anetz_go_idle(anetz_t *anetz);
/* Create transceiver instance and link to a list. */ /* Create transceiver instance and link to a list. */
int anetz_create(int kanal, const char *sounddev, int samplerate, int cross_channels, int pre_emphasis, int de_emphasis, const char *write_wave, const char *read_wave, int loopback, double loss_volume) int anetz_create(int kanal, 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, int loopback, double loss_volume)
{ {
anetz_t *anetz; anetz_t *anetz;
int rc; int rc;
@@ -156,7 +156,7 @@ int anetz_create(int kanal, const char *sounddev, int samplerate, int cross_chan
PDEBUG(DANETZ, DEBUG_DEBUG, "Creating 'A-Netz' instance for 'Kanal' = %d (sample rate %d).\n", kanal, samplerate); PDEBUG(DANETZ, DEBUG_DEBUG, "Creating 'A-Netz' instance for 'Kanal' = %d (sample rate %d).\n", kanal, samplerate);
/* init general part of transceiver */ /* init general part of transceiver */
rc = sender_create(&anetz->sender, kanal, sounddev, samplerate, cross_channels, pre_emphasis, de_emphasis, write_wave, read_wave, loopback, loss_volume, -1); rc = sender_create(&anetz->sender, kanal, sounddev, samplerate, cross_channels, rx_gain, pre_emphasis, de_emphasis, write_wave, read_wave, loopback, loss_volume, -1);
if (rc < 0) { if (rc < 0) {
PDEBUG(DANETZ, DEBUG_ERROR, "Failed to init 'Sender' processing!\n"); PDEBUG(DANETZ, DEBUG_ERROR, "Failed to init 'Sender' processing!\n");
goto error; goto error;

View File

@@ -41,7 +41,7 @@ typedef struct anetz {
double anetz_kanal2freq(int kanal, int unterband); double anetz_kanal2freq(int kanal, int unterband);
int anetz_init(void); int anetz_init(void);
int anetz_create(int kanal, const char *sounddev, int samplerate, int cross_channels, int pre_emphasis, int de_emphasis, const char *write_wave, const char *read_wave, int loopback, double loss_volume); int anetz_create(int kanal, 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, int loopback, double loss_volume);
void anetz_destroy(sender_t *sender); void anetz_destroy(sender_t *sender);
void anetz_loss_indication(anetz_t *anetz); void anetz_loss_indication(anetz_t *anetz);
void anetz_receive_tone(anetz_t *anetz, int bit); void anetz_receive_tone(anetz_t *anetz, int bit);

View File

@@ -150,7 +150,7 @@ int main(int argc, char *argv[])
/* create transceiver instance */ /* create transceiver instance */
for (i = 0; i < num_kanal; i++) { for (i = 0; i < num_kanal; i++) {
rc = anetz_create(kanal[i], sounddev[i], samplerate, cross_channels, do_pre_emphasis, do_de_emphasis, write_wave, read_wave, loopback, lossdetect / 100.0); rc = anetz_create(kanal[i], sounddev[i], samplerate, cross_channels, rx_gain, do_pre_emphasis, do_de_emphasis, write_wave, read_wave, loopback, lossdetect / 100.0);
if (rc < 0) { if (rc < 0) {
fprintf(stderr, "Failed to create \"Sender\" instance. Quitting!\n"); fprintf(stderr, "Failed to create \"Sender\" instance. Quitting!\n");
goto fail; goto fail;

View File

@@ -242,7 +242,7 @@ static void bnetz_timeout(struct timer *timer);
static void bnetz_go_idle(bnetz_t *bnetz); static void bnetz_go_idle(bnetz_t *bnetz);
/* Create transceiver instance and link to a list. */ /* Create transceiver instance and link to a list. */
int bnetz_create(int kanal, const char *sounddev, int samplerate, int cross_channels, int gfs, int pre_emphasis, int de_emphasis, const char *write_wave, const char *read_wave, int loopback, double loss_factor, const char *pilot) int bnetz_create(int kanal, const char *sounddev, int samplerate, int cross_channels, double rx_gain, int gfs, int pre_emphasis, int de_emphasis, const char *write_wave, const char *read_wave, int loopback, double loss_factor, const char *pilot)
{ {
bnetz_t *bnetz; bnetz_t *bnetz;
int use_pilot_tone = -1; int use_pilot_tone = -1;
@@ -300,7 +300,7 @@ error_pilot:
PDEBUG(DBNETZ, DEBUG_DEBUG, "Creating 'B-Netz' instance for 'Kanal' = %d 'Gruppenfreisignal' = %d (sample rate %d).\n", kanal, gfs, samplerate); PDEBUG(DBNETZ, DEBUG_DEBUG, "Creating 'B-Netz' instance for 'Kanal' = %d 'Gruppenfreisignal' = %d (sample rate %d).\n", kanal, gfs, samplerate);
/* init general part of transceiver */ /* init general part of transceiver */
rc = sender_create(&bnetz->sender, kanal, sounddev, samplerate, cross_channels, pre_emphasis, de_emphasis, write_wave, read_wave, loopback, loss_factor, use_pilot_tone); rc = sender_create(&bnetz->sender, kanal, sounddev, samplerate, cross_channels, rx_gain, pre_emphasis, de_emphasis, write_wave, read_wave, loopback, loss_factor, use_pilot_tone);
if (rc < 0) { if (rc < 0) {
PDEBUG(DBNETZ, DEBUG_ERROR, "Failed to init transceiver process!\n"); PDEBUG(DBNETZ, DEBUG_ERROR, "Failed to init transceiver process!\n");
goto error; goto error;

View File

@@ -90,7 +90,7 @@ typedef struct bnetz {
double bnetz_kanal2freq(int kanal, int unterband); double bnetz_kanal2freq(int kanal, int unterband);
int bnetz_init(void); int bnetz_init(void);
int bnetz_create(int kanal, const char *sounddev, int samplerate, int cross_channels, int gfs, int pre_emphasis, int de_emphasis, const char *write_wave, const char *read_wave, int loopback, double loss_factor, const char *pilot); int bnetz_create(int kanal, const char *sounddev, int samplerate, int cross_channels, double rx_gain, int gfs, int pre_emphasis, int de_emphasis, const char *write_wave, const char *read_wave, int loopback, double loss_factor, const char *pilot);
void bnetz_destroy(sender_t *sender); void bnetz_destroy(sender_t *sender);
void bnetz_loss_indication(bnetz_t *bnetz); void bnetz_loss_indication(bnetz_t *bnetz);
void bnetz_receive_tone(bnetz_t *bnetz, int bit); void bnetz_receive_tone(bnetz_t *bnetz, int bit);

View File

@@ -169,7 +169,7 @@ int main(int argc, char *argv[])
/* create transceiver instance */ /* create transceiver instance */
for (i = 0; i < num_kanal; i++) { for (i = 0; i < num_kanal; i++) {
rc = bnetz_create(kanal[i], sounddev[i], samplerate, cross_channels, gfs, do_pre_emphasis, do_de_emphasis, write_wave, read_wave, loopback, (double)lossdetect / 100.0, pilot[i]); rc = bnetz_create(kanal[i], sounddev[i], samplerate, cross_channels, rx_gain, gfs, do_pre_emphasis, do_de_emphasis, write_wave, read_wave, loopback, (double)lossdetect / 100.0, pilot[i]);
if (rc < 0) { if (rc < 0) {
fprintf(stderr, "Failed to create \"Sender\" instance. Quitting!\n"); fprintf(stderr, "Failed to create \"Sender\" instance. Quitting!\n");
goto fail; goto fail;

View File

@@ -111,7 +111,7 @@ static void trans_new_state(transaction_t *trans, int state);
static void cnetz_flush_other_transactions(cnetz_t *cnetz, transaction_t *trans); static void cnetz_flush_other_transactions(cnetz_t *cnetz, transaction_t *trans);
/* Create transceiver instance and link to a list. */ /* Create transceiver instance and link to a list. */
int cnetz_create(int kanal, enum cnetz_chan_type chan_type, const char *sounddev, int samplerate, int cross_channels, int auth, int ms_power, int measure_speed, double clock_speed[2], double deviation, double noise, int pre_emphasis, int de_emphasis, const char *write_wave, const char *read_wave, int loopback) int cnetz_create(int kanal, enum cnetz_chan_type chan_type, const char *sounddev, int samplerate, int cross_channels, double rx_gain, int auth, int ms_power, int measure_speed, double clock_speed[2], double deviation, double noise, int pre_emphasis, int de_emphasis, const char *write_wave, const char *read_wave, int loopback)
{ {
sender_t *sender; sender_t *sender;
cnetz_t *cnetz; cnetz_t *cnetz;
@@ -164,7 +164,7 @@ int cnetz_create(int kanal, enum cnetz_chan_type chan_type, const char *sounddev
/* init general part of transceiver */ /* init general part of transceiver */
/* do not enable emphasis, since it is done by cnetz code, not by common sender code */ /* do not enable emphasis, since it is done by cnetz code, not by common sender code */
rc = sender_create(&cnetz->sender, kanal, sounddev, samplerate, cross_channels, 0, 0, write_wave, read_wave, loopback, 0, -1); rc = sender_create(&cnetz->sender, kanal, sounddev, samplerate, cross_channels, rx_gain, 0, 0, write_wave, read_wave, loopback, 0, -1);
if (rc < 0) { if (rc < 0) {
PDEBUG(DCNETZ, DEBUG_ERROR, "Failed to init transceiver process!\n"); PDEBUG(DCNETZ, DEBUG_ERROR, "Failed to init transceiver process!\n");
goto error; goto error;

View File

@@ -154,7 +154,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_short_name(enum cnetz_chan_type chan_type);
const char *chan_type_long_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_init(void);
int cnetz_create(int kanal, enum cnetz_chan_type chan_type, const char *sounddev, int samplerate, int cross_channels, int auth, int ms_power, int measure_speed, double clock_speed[2], double deviation, double noise, int pre_emphasis, int de_emphasis, const char *write_wave, const char *read_wave, int loopback); int cnetz_create(int kanal, enum cnetz_chan_type chan_type, const char *sounddev, int samplerate, int cross_channels, double rx_gain, int auth, int ms_power, int measure_speed, double clock_speed[2], double deviation, double noise, int pre_emphasis, int de_emphasis, const char *write_wave, const char *read_wave, int loopback);
void cnetz_destroy(sender_t *sender); void cnetz_destroy(sender_t *sender);
void cnetz_sync_frame(cnetz_t *cnetz, double sync, int ts); void cnetz_sync_frame(cnetz_t *cnetz, double sync, int ts);
const struct telegramm *cnetz_transmit_telegramm_rufblock(cnetz_t *cnetz); const struct telegramm *cnetz_transmit_telegramm_rufblock(cnetz_t *cnetz);

View File

@@ -252,7 +252,7 @@ int main(int argc, char *argv[])
/* create transceiver instance */ /* create transceiver instance */
for (i = 0; i < num_kanal; i++) { for (i = 0; i < num_kanal; i++) {
rc = cnetz_create(kanal[i], chan_type[i], sounddev[i], samplerate, cross_channels, auth, ms_power, (i == 0) ? measure_speed : 0, clock_speed, deviation, noise, do_pre_emphasis, do_de_emphasis, write_wave, read_wave, loopback); rc = cnetz_create(kanal[i], chan_type[i], sounddev[i], samplerate, cross_channels, rx_gain, auth, ms_power, (i == 0) ? measure_speed : 0, clock_speed, deviation, noise, do_pre_emphasis, do_de_emphasis, write_wave, read_wave, loopback);
if (rc < 0) { if (rc < 0) {
fprintf(stderr, "Failed to create \"Sender\" instance. Quitting!\n"); fprintf(stderr, "Failed to create \"Sender\" instance. Quitting!\n");
goto fail; goto fail;

View File

@@ -7,12 +7,13 @@ extern const char *call_sounddev;
extern int samplerate; extern int samplerate;
extern int latency; extern int latency;
extern int cross_channels; extern int cross_channels;
extern int do_pre_emphasis;
extern int do_de_emphasis;
extern double rx_gain;
extern int use_mncc_sock; extern int use_mncc_sock;
extern int send_patterns; extern int send_patterns;
extern int loopback; extern int loopback;
extern int rt_prio; extern int rt_prio;
extern int do_pre_emphasis;
extern int do_de_emphasis;
extern const char *read_wave; extern const char *read_wave;
extern const char *write_wave; extern const char *write_wave;

View File

@@ -23,6 +23,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <signal.h> #include <signal.h>
#include <math.h>
#include "main.h" #include "main.h"
#include "debug.h" #include "debug.h"
#include "../common/sender.h" #include "../common/sender.h"
@@ -36,12 +37,13 @@ const char *call_sounddev = "";
int samplerate = 48000; int samplerate = 48000;
int latency = 50; int latency = 50;
int cross_channels = 0; int cross_channels = 0;
int do_pre_emphasis = 0;
int do_de_emphasis = 0;
double rx_gain = 1.0;
int use_mncc_sock = 0; int use_mncc_sock = 0;
int send_patterns = 1; int send_patterns = 1;
int loopback = 0; int loopback = 0;
int rt_prio = 0; int rt_prio = 0;
int do_pre_emphasis = 0;
int do_de_emphasis = 0;
const char *read_wave = NULL; const char *read_wave = NULL;
const char *write_wave = NULL; const char *write_wave = NULL;
@@ -65,6 +67,16 @@ void print_help_common(const char *arg0, const char *ext_usage)
printf(" -x --cross\n"); printf(" -x --cross\n");
printf(" Cross channels on sound card. 1st channel (right) is swapped with\n"); printf(" Cross channels on sound card. 1st channel (right) is swapped with\n");
printf(" second channel (left)\n"); printf(" second channel (left)\n");
printf(" -E --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(" -e --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 <dB>\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");
printf(" with the mixer settings.\n");
printf(" -m --mncc-sock\n"); printf(" -m --mncc-sock\n");
printf(" Disable built-in call contol and offer socket (to LCR)\n"); printf(" Disable built-in call contol and offer socket (to LCR)\n");
printf(" -c --call-device hw:<card>,<device>\n"); printf(" -c --call-device hw:<card>,<device>\n");
@@ -75,12 +87,6 @@ void print_help_common(const char *arg0, const char *ext_usage)
printf(" Loopback test: 1 = internal | 2 = external | 3 = echo\n"); printf(" Loopback test: 1 = internal | 2 = external | 3 = echo\n");
printf(" -r --realtime <prio>\n"); printf(" -r --realtime <prio>\n");
printf(" Set prio: 0 to diable, 99 for maximum (default = %d)\n", rt_prio); printf(" Set prio: 0 to diable, 99 for maximum (default = %d)\n", rt_prio);
printf(" -E --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(" -e --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(" -W --write-wave <file>\n"); printf(" -W --write-wave <file>\n");
printf(" Write received audio to given wav audio file.\n"); printf(" Write received audio to given wav audio file.\n");
printf(" -R --read-wave <file>\n"); printf(" -R --read-wave <file>\n");
@@ -96,18 +102,19 @@ static struct option long_options_common[] = {
{"samplerate", 1, 0, 's'}, {"samplerate", 1, 0, 's'},
{"latency", 1, 0, 'l'}, {"latency", 1, 0, 'l'},
{"cross", 0, 0, 'x'}, {"cross", 0, 0, 'x'},
{"pre-emphasis", 0, 0, 'E'},
{"de-emphasis", 0, 0, 'e'},
{"rx-gain", 0, 0, 'G'},
{"mncc-sock", 0, 0, 'm'}, {"mncc-sock", 0, 0, 'm'},
{"send-patterns", 0, 0, 'p'}, {"send-patterns", 0, 0, 'p'},
{"loopback", 1, 0, 'L'}, {"loopback", 1, 0, 'L'},
{"realtime", 1, 0, 'r'}, {"realtime", 1, 0, 'r'},
{"pre-emphasis", 0, 0, 'E'},
{"de-emphasis", 0, 0, 'e'},
{"write-wave", 1, 0, 'W'}, {"write-wave", 1, 0, 'W'},
{"read-wave", 1, 0, 'R'}, {"read-wave", 1, 0, 'R'},
{0, 0, 0, 0} {0, 0, 0, 0}
}; };
const char *optstring_common = "hD:k:d:s:c:l:xmp:L:r:EeW:R:"; const char *optstring_common = "hD:k:d:s:c:l:xEeG:mp:L:r:W:R:";
struct option *long_options; struct option *long_options;
char *optstring; char *optstring;
@@ -129,6 +136,8 @@ void set_options_common(const char *optstring_special, struct option *long_optio
void opt_switch_common(int c, char *arg0, int *skip_args) void opt_switch_common(int c, char *arg0, int *skip_args)
{ {
double gain_db;
switch (c) { switch (c) {
case 'h': case 'h':
print_help(arg0); print_help(arg0);
@@ -165,6 +174,23 @@ void opt_switch_common(int c, char *arg0, int *skip_args)
cross_channels = 1; cross_channels = 1;
*skip_args += 1; *skip_args += 1;
break; break;
case 'E':
do_pre_emphasis = 1;
*skip_args += 1;
break;
case 'e':
do_de_emphasis = 1;
*skip_args += 1;
break;
case 'G':
gain_db = atof(optarg);
if (gain_db < 0.0) {
fprintf(stderr, "Given gain is below 0. Tto reduce RX signal, use sound card's mixer (or resistor net)!\n");
exit(0);
}
rx_gain = pow(10, gain_db / 20.0);
*skip_args += 2;
break;
case 'm': case 'm':
use_mncc_sock = 1; use_mncc_sock = 1;
*skip_args += 1; *skip_args += 1;
@@ -181,14 +207,6 @@ void opt_switch_common(int c, char *arg0, int *skip_args)
rt_prio = atoi(optarg); rt_prio = atoi(optarg);
*skip_args += 2; *skip_args += 2;
break; break;
case 'E':
do_pre_emphasis = 1;
*skip_args += 1;
break;
case 'e':
do_de_emphasis = 1;
*skip_args += 1;
break;
case 'W': case 'W':
write_wave = strdup(optarg); write_wave = strdup(optarg);
*skip_args += 2; *skip_args += 2;

View File

@@ -33,7 +33,7 @@ static sender_t **sender_tailp = &sender_head;
int cant_recover = 0; int cant_recover = 0;
/* Init transceiver instance and link to list of transceivers. */ /* Init transceiver instance and link to list of transceivers. */
int sender_create(sender_t *sender, int kanal, const char *sounddev, int samplerate, int cross_channels, int pre_emphasis, int de_emphasis, const char *write_wave, const char *read_wave, int loopback, double loss_volume, int use_pilot_signal) int sender_create(sender_t *sender, int kanal, 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, int loopback, double loss_volume, int use_pilot_signal)
{ {
sender_t *master; sender_t *master;
int rc = 0; int rc = 0;
@@ -91,6 +91,7 @@ int sender_create(sender_t *sender, int kanal, const char *sounddev, int sampler
sender->samplerate = samplerate; sender->samplerate = samplerate;
sender->cross_channels = cross_channels; sender->cross_channels = cross_channels;
sender->rx_gain = rx_gain;
sender->pre_emphasis = pre_emphasis; sender->pre_emphasis = pre_emphasis;
sender->de_emphasis = de_emphasis; sender->de_emphasis = de_emphasis;
sender->kanal = kanal; sender->kanal = kanal;
@@ -189,6 +190,21 @@ static void gen_pilotton(sender_t *sender, int16_t *samples, int length)
sender->pilotton_phase = phase; sender->pilotton_phase = phase;
} }
static void gain_samples(int16_t *samples, int length, double gain)
{
int i;
int32_t sample;
for (i = 0; i < length; i++) {
sample = (int32_t)((double)(*samples) * gain);
if (sample > 32767)
sample = 32767;
else if (sample < -32768)
sample = -32768;
*samples++ = sample;
}
}
/* Handle audio streaming of one transceiver. */ /* Handle audio streaming of one transceiver. */
static void process_sender_audio(sender_t *sender, int *quit, int latspl) static void process_sender_audio(sender_t *sender, int *quit, int latspl)
{ {
@@ -318,6 +334,9 @@ cant_recover:
return; return;
} }
if (count) { if (count) {
/* rx gain */
if (sender->rx_gain != 1.0)
gain_samples(samples, count, sender->rx_gain);
/* do de emphasis from radio (then write_wave/wave_read), receive audio, process echo test */ /* do de emphasis from radio (then write_wave/wave_read), receive audio, process echo test */
if (sender->de_emphasis) if (sender->de_emphasis)
de_emphasis(&sender->estate, samples, count); de_emphasis(&sender->estate, samples, count);
@@ -332,6 +351,8 @@ cant_recover:
jitter_save(&sender->audio, samples, count); jitter_save(&sender->audio, samples, count);
/* do above for audio slave, if set */ /* do above for audio slave, if set */
if (slave) { if (slave) {
if (sender->rx_gain != 1.0)
gain_samples(slave_samples, count, slave->rx_gain);
if (slave->de_emphasis) if (slave->de_emphasis)
de_emphasis(&slave->estate, slave_samples, count); de_emphasis(&slave->estate, slave_samples, count);
if (slave->wave_play.fp) if (slave->wave_play.fp)

View File

@@ -25,6 +25,7 @@ typedef struct sender {
int samplerate; int samplerate;
int cross_channels; /* swap right and left on IO */ int cross_channels; /* swap right and left on IO */
samplerate_t srstate; /* sample rate conversion state */ samplerate_t srstate; /* sample rate conversion state */
double rx_gain; /* factor of level to apply on rx samples */
int pre_emphasis; /* use pre_emhasis, done by sender */ int pre_emphasis; /* use pre_emhasis, done by sender */
int de_emphasis; /* use de_emhasis, done by sender */ int de_emphasis; /* use de_emhasis, done by sender */
emphasis_t estate; /* pre and de emphasis */ emphasis_t estate; /* pre and de emphasis */
@@ -58,7 +59,7 @@ typedef struct sender {
extern sender_t *sender_head; extern sender_t *sender_head;
extern int cant_recover; extern int cant_recover;
int sender_create(sender_t *sender, int kanal, const char *sounddev, int samplerate, int cross_channels, int pre_emphasis, int de_emphasis, const char *write_wave, const char *read_wave, int loopback, double loss_volume, int use_pilot_signal); int sender_create(sender_t *sender, int kanal, 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, int loopback, double loss_volume, int use_pilot_signal);
void sender_destroy(sender_t *sender); void sender_destroy(sender_t *sender);
void sender_send(sender_t *sender, int16_t *samples, int count); void sender_send(sender_t *sender, int16_t *samples, int count);
void sender_receive(sender_t *sender, int16_t *samples, int count); void sender_receive(sender_t *sender, int16_t *samples, int count);

View File

@@ -253,7 +253,7 @@ int main(int argc, char *argv[])
/* create transceiver instance */ /* create transceiver instance */
for (i = 0; i < num_kanal; i++) { for (i = 0; i < num_kanal; i++) {
rc = nmt_create(kanal[i], (loopback) ? CHAN_TYPE_TEST : chan_type[i], sounddev[i], samplerate, cross_channels, 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, compander, supervisory, loopback);
if (rc < 0) { if (rc < 0) {
fprintf(stderr, "Failed to create transceiver instance. Quitting!\n"); fprintf(stderr, "Failed to create transceiver instance. Quitting!\n");
goto fail; goto fail;

View File

@@ -283,7 +283,7 @@ static void nmt_timeout(struct timer *timer);
static void nmt_go_idle(nmt_t *nmt); static void nmt_go_idle(nmt_t *nmt);
/* Create transceiver instance and link to a list. */ /* 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, 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 compander, int supervisory, int loopback)
{ {
nmt_t *nmt; nmt_t *nmt;
int rc; int rc;
@@ -324,7 +324,7 @@ int nmt_create(int channel, enum nmt_chan_type chan_type, const char *sounddev,
PDEBUG(DNMT, DEBUG_DEBUG, "Creating 'NMT' instance for channel = %d (sample rate %d).\n", channel, samplerate); PDEBUG(DNMT, DEBUG_DEBUG, "Creating 'NMT' instance for channel = %d (sample rate %d).\n", channel, samplerate);
/* init general part of transceiver */ /* init general part of transceiver */
rc = sender_create(&nmt->sender, channel, sounddev, samplerate, cross_channels, pre_emphasis, de_emphasis, write_wave, read_wave, loopback, 0, -1); rc = sender_create(&nmt->sender, channel, sounddev, samplerate, cross_channels, rx_gain, pre_emphasis, de_emphasis, write_wave, read_wave, loopback, 0, -1);
if (rc < 0) { if (rc < 0) {
PDEBUG(DNMT, DEBUG_ERROR, "Failed to init transceiver process!\n"); PDEBUG(DNMT, DEBUG_ERROR, "Failed to init transceiver process!\n");
goto error; goto error;

View File

@@ -138,7 +138,7 @@ const char *chan_type_long_name(enum nmt_chan_type chan_type);
double nmt_channel2freq(int channel, int uplink); double nmt_channel2freq(int channel, int uplink);
void nmt_country_list(void); void nmt_country_list(void);
uint8_t nmt_country_by_short_name(const char *short_name); 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, 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 compander, int supervisory, int loopback);
void nmt_destroy(sender_t *sender); void nmt_destroy(sender_t *sender);
void nmt_receive_frame(nmt_t *nmt, const char *bits, double quality, double level, double frames_elapsed); 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); const char *nmt_get_frame(nmt_t *nmt);