Prepare for SDR: Add bandwidth and deviation info to sender instance

This commit is contained in:
Andreas Eversberg
2017-01-06 12:22:51 +01:00
parent 9ff8c3bb25
commit c5cf88ce57
10 changed files with 35 additions and 9 deletions

View File

@@ -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");

View File

@@ -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;

View File

@@ -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);

View File

@@ -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);

View File

@@ -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;