aboutsummaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2017-01-06 12:22:51 +0100
committerAndreas Eversberg <jolly@eversberg.eu>2017-02-18 21:00:47 +0100
commitc5cf88ce575b4fb35628e30b3a5f2e246f060c8d (patch)
tree7ec799cd074fa6740a50fa2b4c226570408cd4aa /src/common
parent9ff8c3bb25422e100801f90c17b9c21118920cfd (diff)
Prepare for SDR: Add bandwidth and deviation info to sender instance
Diffstat (limited to 'src/common')
-rw-r--r--src/common/call.c2
-rw-r--r--src/common/sender.c4
-rw-r--r--src/common/sender.h4
-rw-r--r--src/common/sound.h2
-rw-r--r--src/common/sound_alsa.c2
5 files changed, 9 insertions, 5 deletions
diff --git a/src/common/call.c b/src/common/call.c
index 7f8fae6..ab57390 100644
--- a/src/common/call.c
+++ b/src/common/call.c
@@ -473,7 +473,7 @@ int call_init(const char *station_id, const char *audiodev, int samplerate, int
return 0;
/* open sound device for call control */
- call.sound = sound_open(audiodev, NULL, NULL, 1, samplerate);
+ call.sound = sound_open(audiodev, NULL, NULL, 1, samplerate, 3700.0, 0.0);
if (!call.sound) {
PDEBUG(DSENDER, DEBUG_ERROR, "No sound device!\n");
diff --git a/src/common/sender.c b/src/common/sender.c
index 45760e1..3438554 100644
--- a/src/common/sender.c
+++ b/src/common/sender.c
@@ -40,6 +40,8 @@ int sender_create(sender_t *sender, int kanal, double sendefrequenz, double empf
sender->kanal = kanal;
sender->sendefrequenz = sendefrequenz;
sender->empfangsfrequenz = empfangsfrequenz;
+ sender->bandwidth = 4000; /* default is overwritten by dsp.c */
+ sender->sample_deviation = 0.2; /* default is overwritten by dsp.c */
strncpy(sender->audiodev, audiodev, sizeof(sender->audiodev) - 1);
sender->samplerate = samplerate;
sender->rx_gain = rx_gain;
@@ -172,7 +174,7 @@ int sender_open_audio(void)
}
/* open device */
- master->audio = master->audio_open(master->audiodev, tx_f, rx_f, channels, master->samplerate);
+ master->audio = master->audio_open(master->audiodev, tx_f, rx_f, channels, master->samplerate, master->bandwidth, master->sample_deviation);
if (!master->audio) {
PDEBUG(DSENDER, DEBUG_ERROR, "No audio device!\n");
return -EIO;
diff --git a/src/common/sender.h b/src/common/sender.h
index c89b405..94bdee8 100644
--- a/src/common/sender.h
+++ b/src/common/sender.h
@@ -27,11 +27,13 @@ typedef struct sender {
int kanal; /* channel number */
double sendefrequenz; /* transmitter frequency */
double empfangsfrequenz; /* receiver frequency */
+ double bandwidth; /* max NF frequency to be transmitted unaffected by filtering */
+ double sample_deviation; /* frequency deviation of one sample step (after pre-emphasis) */
/* audio */
void *audio;
char audiodev[64]; /* audio device name (alsa or sdr) */
- void *(*audio_open)(const char *, double *, double *, int, int);
+ void *(*audio_open)(const char *, double *, double *, int, int, double, double);
void (*audio_close)(void *);
int (*audio_write)(void *, int16_t **, int, int);
int (*audio_read)(void *, int16_t **, int, int);
diff --git a/src/common/sound.h b/src/common/sound.h
index 45eb2c0..313a559 100644
--- a/src/common/sound.h
+++ b/src/common/sound.h
@@ -1,5 +1,5 @@
-void *sound_open(const char *audiodev, double *tx_frequency, double *rx_frequency, int channels, int samplerate);
+void *sound_open(const char *audiodev, double *tx_frequency, double *rx_frequency, int channels, int samplerate, double bandwidth, double sample_deviation);
void sound_close(void *inst);
int sound_write(void *inst, int16_t **samples, int num, int channels);
int sound_read(void *inst, int16_t **samples, int num, int channels);
diff --git a/src/common/sound_alsa.c b/src/common/sound_alsa.c
index 15fe1a9..c8d0668 100644
--- a/src/common/sound_alsa.c
+++ b/src/common/sound_alsa.c
@@ -128,7 +128,7 @@ static int sound_prepare(sound_t *sound)
return 0;
}
-void *sound_open(const char *audiodev, double __attribute__((unused)) *tx_frequency, double __attribute__((unused)) *rx_frequency, int channels, int samplerate)
+void *sound_open(const char *audiodev, double __attribute__((unused)) *tx_frequency, double __attribute__((unused)) *rx_frequency, int channels, int samplerate, double __attribute__((unused)) bandwidth, double __attribute__((unused)) sample_deviation)
{
sound_t *sound;
int rc;