aboutsummaryrefslogtreecommitdiffstats
path: root/src/amps
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2017-01-04 14:14:02 +0100
committerAndreas Eversberg <jolly@eversberg.eu>2017-02-18 21:00:45 +0100
commit9ff8c3bb25422e100801f90c17b9c21118920cfd (patch)
tree5715f3cc08893ed86dfc2514c93797d12e24d461 /src/amps
parentd54d3ac2654844c7b8e4ee67752941c9037d5f42 (diff)
Rework on audio interface
Sound instance is now called audio instance and uses funcation pointers. This gives a clean interface to be exchanged with other technologies, linke SDR.
Diffstat (limited to 'src/amps')
-rw-r--r--src/amps/amps.c8
-rw-r--r--src/amps/amps.h2
-rw-r--r--src/amps/dsp.c2
-rw-r--r--src/amps/frame.c2
-rw-r--r--src/amps/main.c14
5 files changed, 14 insertions, 14 deletions
diff --git a/src/amps/amps.c b/src/amps/amps.c
index cfe5155..8f9b1ad 100644
--- a/src/amps/amps.c
+++ b/src/amps/amps.c
@@ -83,7 +83,7 @@ double amps_channel2freq(int channel, int uplink)
if (uplink)
freq -= 45.000;
- return freq;
+ return freq * 1e6;
}
enum amps_chan_type amps_channel2type(int channel)
@@ -376,7 +376,7 @@ static amps_t *search_pc(void)
static void amps_go_idle(amps_t *amps);
/* Create transceiver instance and link to a list. */
-int amps_create(int channel, enum amps_chan_type chan_type, const char *sounddev, int samplerate, double rx_gain, int pre_emphasis, int de_emphasis, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, amps_si *si, uint16_t sid, uint8_t sat, int polarity, int tolerant, int loopback)
+int amps_create(int channel, enum amps_chan_type chan_type, const char *audiodev, int samplerate, double rx_gain, int pre_emphasis, int de_emphasis, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, amps_si *si, uint16_t sid, uint8_t sat, int polarity, int tolerant, int loopback)
{
sender_t *sender;
amps_t *amps;
@@ -442,7 +442,7 @@ int amps_create(int channel, enum amps_chan_type chan_type, const char *sounddev
PDEBUG(DAMPS, DEBUG_DEBUG, "Creating 'AMPS' instance for channel = %d (sample rate %d).\n", channel, samplerate);
/* init general part of transceiver */
- rc = sender_create(&amps->sender, channel, sounddev, samplerate, rx_gain, 0, 0, write_rx_wave, write_tx_wave, read_rx_wave, loopback, 0, PILOT_SIGNAL_NONE);
+ rc = sender_create(&amps->sender, channel, amps_channel2freq(channel, 0), amps_channel2freq(channel, 1), audiodev, samplerate, rx_gain, 0, 0, write_rx_wave, write_tx_wave, read_rx_wave, loopback, 0, PILOT_SIGNAL_NONE);
if (rc < 0) {
PDEBUG(DAMPS, DEBUG_ERROR, "Failed to init transceiver process!\n");
goto error;
@@ -919,7 +919,7 @@ void call_rx_audio(int callref, int16_t *samples, int count)
int16_t up[(int)((double)count * amps->sender.srstate.factor + 0.5) + 10];
compress_audio(&amps->cstate, samples, count);
count = samplerate_upsample(&amps->sender.srstate, samples, count, up);
- jitter_save(&amps->sender.audio, up, count);
+ jitter_save(&amps->sender.dejitter, up, count);
}
}
diff --git a/src/amps/amps.h b/src/amps/amps.h
index b9f4ad2..4ff910b 100644
--- a/src/amps/amps.h
+++ b/src/amps/amps.h
@@ -163,7 +163,7 @@ const char *amps_min12number(uint32_t min1);
void amps_number2min(const char *number, uint32_t *min1, uint16_t *min2);
const char *amps_min2number(uint32_t min1, uint16_t min2);
const char *amps_scm(uint8_t scm);
-int amps_create(int channel, enum amps_chan_type chan_type, const char *sounddev, int samplerate, double rx_gain, int pre_emphasis, int de_emphasis, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, amps_si *si, uint16_t sid, uint8_t sat, int polarity, int tolerant, int loopback);
+int amps_create(int channel, enum amps_chan_type chan_type, const char *audiodev, int samplerate, double rx_gain, int pre_emphasis, int de_emphasis, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, amps_si *si, uint16_t sid, uint8_t sat, int polarity, int tolerant, int loopback);
void amps_destroy(sender_t *sender);
void amps_rx_signaling_tone(amps_t *amps, int tone, double quality);
void amps_rx_sat(amps_t *amps, int tone, double quality);
diff --git a/src/amps/dsp.c b/src/amps/dsp.c
index ae8b27b..776ec3b 100644
--- a/src/amps/dsp.c
+++ b/src/amps/dsp.c
@@ -481,7 +481,7 @@ again:
test_tone_encode(amps, samples, length);
break;
case DSP_MODE_AUDIO_RX_AUDIO_TX:
- jitter_load(&amps->sender.audio, samples, length);
+ jitter_load(&amps->sender.dejitter, samples, length);
/* pre-emphasis */
if (amps->pre_emphasis)
pre_emphasis(&amps->estate, samples, length);
diff --git a/src/amps/frame.c b/src/amps/frame.c
index 6cf00bb..478739b 100644
--- a/src/amps/frame.c
+++ b/src/amps/frame.c
@@ -1701,7 +1701,7 @@ static const char *ie_chan(uint64_t value)
if (value == 0)
return "No channel";
- sprintf(string, "%" PRIu64 " = %.3f MHz", value, amps_channel2freq(value, 0));
+ sprintf(string, "%" PRIu64 " = %.3f MHz", value, amps_channel2freq(value, 0) / 1e6);
return string;
}
diff --git a/src/amps/main.c b/src/amps/main.c
index d50b423..e97c5d4 100644
--- a/src/amps/main.c
+++ b/src/amps/main.c
@@ -259,9 +259,9 @@ int main(int argc, char *argv[])
print_help(argv[-skip_args]);
return 0;
}
- if (num_kanal == 1 && num_sounddev == 0)
- num_sounddev = 1; /* use defualt */
- if (num_kanal != num_sounddev) {
+ if (num_kanal == 1 && num_audiodev == 0)
+ num_audiodev = 1; /* use defualt */
+ if (num_kanal != num_audiodev) {
fprintf(stderr, "You need to specify as many sound devices as you have channels.\n");
exit(0);
}
@@ -291,7 +291,7 @@ int main(int argc, char *argv[])
}
dsp_init();
init_frame();
- rc = call_init(station_id, call_sounddev, samplerate, latency, 10, loopback);
+ rc = call_init(station_id, call_audiodev, samplerate, latency, 10, loopback);
if (rc < 0) {
fprintf(stderr, "Failed to create call control instance. Quitting!\n");
goto fail;
@@ -348,15 +348,15 @@ int main(int argc, char *argv[])
amps_si si;
init_sysinfo(&si, ms_power, ms_power, dcc, sid >> 1, regh, regr, pureg, pdreg, locaid, regincr, bis);
- rc = amps_create(kanal[i], chan_type[i], sounddev[i], samplerate, rx_gain, do_pre_emphasis, do_de_emphasis, write_rx_wave, write_tx_wave, read_rx_wave, &si, sid, scc, polarity, tolerant, loopback);
+ rc = amps_create(kanal[i], chan_type[i], audiodev[i], samplerate, rx_gain, do_pre_emphasis, do_de_emphasis, write_rx_wave, write_tx_wave, read_rx_wave, &si, sid, scc, polarity, tolerant, loopback);
if (rc < 0) {
fprintf(stderr, "Failed to create \"Sender\" instance. Quitting!\n");
goto fail;
}
- printf("Base station on channel %d ready (%s), please tune transmitter to %.3f MHz and receiver to %.3f MHz.\n", kanal[i], chan_type_long_name(chan_type[i]), amps_channel2freq(kanal[i], 0), amps_channel2freq(kanal[i], 1));
+ printf("Base station on channel %d ready (%s), please tune transmitter to %.3f MHz and receiver to %.3f MHz.\n", kanal[i], chan_type_long_name(chan_type[i]), amps_channel2freq(kanal[i], 0) / 1e6, amps_channel2freq(kanal[i], 1) / 1e6);
}
- main_loop(&quit, latency, interval, NULL);
+ main_common(&quit, latency, interval, NULL);
fail:
/* cleanup functions */