common: Add pre and de emphasis, if the radio does not support it

Connect to the oscillator of the transmitter - good girl!
You need to enable pre emphasis in this case.

Connect to the discriminator of the receiver - good boy!
You need to enable de emphasis in this case.
This commit is contained in:
Andreas Eversberg
2016-04-23 18:50:11 +02:00
parent 5062628e52
commit 4356c93afa
20 changed files with 256 additions and 19 deletions

View File

@@ -33,7 +33,7 @@
#define PI M_PI
/* signalling */
#define TX_AUDIO_0dBm0 16384 /* works quite well */
#define TX_AUDIO_0dBm0 32767 /* works quite well */
#define TX_PEAK_FSK 16384.0 /* peak amplitude of signalling FSK */
#define TX_PEAK_SUPER 1638.0 /* peak amplitude of supervisory signal */
#define BIT_RATE 1200 /* baud rate */
@@ -467,8 +467,7 @@ void sender_receive(sender_t *sender, int16_t *samples, int length)
spl = nmt->sender.rxbuf;
pos = nmt->sender.rxbuf_pos;
for (i = 0; i < count; i++) {
#warning hacking: remove after preemphasis implementation
spl[pos++] = down[i] / 2;
spl[pos++] = down[i];
if (pos == 160) {
call_tx_audio(nmt->sender.callref, spl, 160);
pos = 0;

View File

@@ -239,7 +239,7 @@ int main(int argc, char *argv[])
}
/* create transceiver instance */
rc = nmt_create(sounddev, samplerate, write_wave, read_wave, kanal, (loopback) ? CHAN_TYPE_TEST : chan_type, ms_power, nmt_digits2value(traffic_area, 2), area_no, compander, supervisory, loopback);
rc = nmt_create(sounddev, samplerate, do_pre_emphasis, do_de_emphasis, write_wave, read_wave, kanal, (loopback) ? CHAN_TYPE_TEST : chan_type, ms_power, nmt_digits2value(traffic_area, 2), area_no, compander, supervisory, loopback);
if (rc < 0) {
fprintf(stderr, "Failed to create transceiver instance. Quitting!\n");
goto fail;

View File

@@ -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(const char *sounddev, int samplerate, const char *write_wave, const char *read_wave, int channel, enum nmt_chan_type chan_type, uint8_t ms_power, uint8_t traffic_area, uint8_t area_no, int compander, int supervisory, int loopback)
int nmt_create(const char *sounddev, int samplerate, int pre_emphasis, int de_emphasis, const char *write_wave, const char *read_wave, int channel, enum nmt_chan_type chan_type, uint8_t ms_power, uint8_t traffic_area, uint8_t area_no, int compander, int supervisory, int loopback)
{
nmt_t *nmt;
int rc;
@@ -324,7 +324,7 @@ int nmt_create(const char *sounddev, int samplerate, const char *write_wave, con
PDEBUG(DNMT, DEBUG_DEBUG, "Creating 'NMT' instance for channel = %d (sample rate %d).\n", channel, samplerate);
/* init general part of transceiver */
rc = sender_create(&nmt->sender, sounddev, samplerate, write_wave, read_wave, channel, loopback, 0, -1);
rc = sender_create(&nmt->sender, sounddev, samplerate, pre_emphasis, de_emphasis, write_wave, read_wave, channel, loopback, 0, -1);
if (rc < 0) {
PDEBUG(DNMT, DEBUG_ERROR, "Failed to init transceiver process!\n");
goto error;

View File

@@ -134,7 +134,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(const char *sounddev, int samplerate, const char *write_wave, const char *read_wave, int channel, enum nmt_chan_type chan_type, uint8_t ms_power, uint8_t traffic_area, uint8_t area_no, int compander, int supervisory, int loopback);
int nmt_create(const char *sounddev, int samplerate, int pre_emphasis, int de_emphasis, const char *write_wave, const char *read_wave, int channel, enum nmt_chan_type chan_type, 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_receive_frame(nmt_t *nmt, const char *bits, double quality, double level, double frames_elapsed);
const char *nmt_get_frame(nmt_t *nmt);