No "sdr" audio device option required anymore (when using SDR)
This commit is contained in:
@@ -3,6 +3,7 @@ extern int num_kanal;
|
||||
extern int kanal[];
|
||||
extern int num_audiodev;
|
||||
extern const char *audiodev[];
|
||||
extern int use_sdr;
|
||||
extern const char *call_audiodev;
|
||||
extern int samplerate;
|
||||
extern int interval;
|
||||
|
||||
@@ -61,10 +61,13 @@ int rt_prio = 0;
|
||||
const char *write_rx_wave = NULL;
|
||||
const char *write_tx_wave = NULL;
|
||||
const char *read_rx_wave = NULL;
|
||||
int use_sdr = 0;
|
||||
static const char *sdr_args = "";
|
||||
static double sdr_bandwidth = 0.0;
|
||||
#ifdef HAVE_SDR
|
||||
static int sdr_uhd = 0;
|
||||
static int sdr_soapy = 0;
|
||||
#endif
|
||||
double sdr_rx_gain = 0, sdr_tx_gain = 0;
|
||||
const char *write_iq_rx_wave = NULL;
|
||||
const char *write_iq_tx_wave = NULL;
|
||||
@@ -85,9 +88,9 @@ void print_help_common(const char *arg0, const char *ext_usage)
|
||||
printf(" -k --kanal <channel>\n");
|
||||
printf(" -k --channel <channel>\n");
|
||||
printf(" Channel (German = Kanal) number of \"Sender\" (German = Transceiver)\n");
|
||||
printf(" -a --audio-device hw:<card>,<device> | sdr\n");
|
||||
printf(" -a --audio-device hw:<card>,<device>\n");
|
||||
printf(" Sound card and device number (default = '%s')\n", audiodev[0]);
|
||||
printf(" SDR device, if supported\n");
|
||||
printf(" Don't set it for SDR!\n");
|
||||
printf(" -s --samplerate <rate>\n");
|
||||
printf(" Sample rate of sound device (default = '%d')\n", samplerate);
|
||||
printf(" -i --interval 1..25\n");
|
||||
@@ -358,11 +361,23 @@ void opt_switch_common(int c, char *arg0, int *skip_args)
|
||||
*skip_args += 2;
|
||||
break;
|
||||
case OPT_SDR_UHD:
|
||||
#ifdef HAVE_SDR
|
||||
use_sdr = 1;
|
||||
sdr_uhd = 1;
|
||||
#else
|
||||
fprintf(stderr, "UHD SDR support not compiled in!\n");
|
||||
exit(0);
|
||||
#endif
|
||||
*skip_args += 1;
|
||||
break;
|
||||
case OPT_SDR_SOAPY:
|
||||
#ifdef HAVE_SDR
|
||||
use_sdr = 1;
|
||||
sdr_soapy = 1;
|
||||
#else
|
||||
fprintf(stderr, "SoapySDR support not compiled in!\n");
|
||||
exit(0);
|
||||
#endif
|
||||
*skip_args += 1;
|
||||
break;
|
||||
case OPT_SDR_ARGS:
|
||||
@@ -461,24 +476,12 @@ void main_common(int *quit, int latency, int interval, void (*myhandler)(void),
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef HAVE_UHD
|
||||
#ifdef HAVE_SOAPY
|
||||
if ((sdr_uhd == 1 && sdr_soapy == 1) || (sdr_uhd == 0 && sdr_soapy == 0)) {
|
||||
fprintf(stderr, "UHD and SoapySDR drivers are compiled in. You must choose which one you want: --sdr-uhd or --sdr-soapy\n");
|
||||
#ifdef HAVE_SDR
|
||||
if ((sdr_uhd == 1 && sdr_soapy == 1)) {
|
||||
fprintf(stderr, "You must choose which one you want: --sdr-uhd or --sdr-soapy\n");
|
||||
return;
|
||||
}
|
||||
#else
|
||||
sdr_uhd = 1;
|
||||
sdr_soapy = 0;
|
||||
#endif
|
||||
#else
|
||||
#ifdef HAVE_SOAPY
|
||||
sdr_uhd = 0;
|
||||
sdr_soapy = 1;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SDR
|
||||
if (sdr_bandwidth == 0.0)
|
||||
sdr_bandwidth = samplerate;
|
||||
rc = sdr_init(sdr_uhd, sdr_soapy, sdr_args, sdr_rx_gain, sdr_tx_gain, sdr_bandwidth, write_iq_rx_wave, write_iq_tx_wave, read_iq_rx_wave, read_iq_tx_wave);
|
||||
|
||||
@@ -33,7 +33,7 @@ static sender_t **sender_tailp = &sender_head;
|
||||
int cant_recover = 0;
|
||||
|
||||
/* Init transceiver instance and link to list of transceivers. */
|
||||
int sender_create(sender_t *sender, int kanal, double sendefrequenz, double empfangsfrequenz, 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, int loopback, double loss_volume, enum paging_signal paging_signal)
|
||||
int sender_create(sender_t *sender, int kanal, double sendefrequenz, double empfangsfrequenz, const char *audiodev, int use_sdr, 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, int loopback, double loss_volume, enum paging_signal paging_signal)
|
||||
{
|
||||
sender_t *master, *slave;
|
||||
int rc = 0;
|
||||
@@ -54,7 +54,7 @@ int sender_create(sender_t *sender, int kanal, double sendefrequenz, double empf
|
||||
sender->read_rx_wave = read_rx_wave;
|
||||
|
||||
/* no gain with SDR */
|
||||
if (!strcmp(audiodev, "sdr"))
|
||||
if (use_sdr)
|
||||
sender->rx_gain = 1.0;
|
||||
|
||||
PDEBUG_CHAN(DSENDER, DEBUG_DEBUG, "Creating 'Sender' instance\n");
|
||||
@@ -74,12 +74,12 @@ int sender_create(sender_t *sender, int kanal, double sendefrequenz, double empf
|
||||
break;
|
||||
}
|
||||
if (master) {
|
||||
if (master->paging_signal != PAGING_SIGNAL_NONE && !!strcmp(master->audiodev, "sdr")) {
|
||||
if (master->paging_signal != PAGING_SIGNAL_NONE && !use_sdr) {
|
||||
PDEBUG(DSENDER, DEBUG_ERROR, "Cannot share audio device with channel %d, because its second audio channel is used for paging signal! Use different audio device.\n", master->kanal);
|
||||
rc = -EBUSY;
|
||||
goto error;
|
||||
}
|
||||
if (paging_signal != PAGING_SIGNAL_NONE && !!strcmp(audiodev, "sdr")) {
|
||||
if (paging_signal != PAGING_SIGNAL_NONE && !use_sdr) {
|
||||
PDEBUG(DSENDER, DEBUG_ERROR, "Cannot share audio device with channel %d, because we need a second audio channel for paging signal! Use different audio device.\n", master->kanal);
|
||||
rc = -EBUSY;
|
||||
goto error;
|
||||
@@ -95,7 +95,7 @@ int sender_create(sender_t *sender, int kanal, double sendefrequenz, double empf
|
||||
} else {
|
||||
/* link audio device */
|
||||
#ifdef HAVE_SDR
|
||||
if (!strcmp(audiodev, "sdr")) {
|
||||
if (use_sdr) {
|
||||
sender->audio_open = sdr_open;
|
||||
sender->audio_start = sdr_start;
|
||||
sender->audio_close = sdr_close;
|
||||
|
||||
@@ -88,7 +88,7 @@ typedef struct sender {
|
||||
extern sender_t *sender_head;
|
||||
extern int cant_recover;
|
||||
|
||||
int sender_create(sender_t *sender, int kanal, double sendefrequenz, double empfangsfrequenz, 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, int loopback, double loss_volume, enum paging_signal paging_signal);
|
||||
int sender_create(sender_t *sender, int kanal, double sendefrequenz, double empfangsfrequenz, const char *audiodev, int use_sdr, 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, int loopback, double loss_volume, enum paging_signal paging_signal);
|
||||
void sender_destroy(sender_t *sender);
|
||||
void sender_set_fm(sender_t *sender, double max_deviation, double max_modulation, double dBm0_deviation, double max_display);
|
||||
int sender_open_audio(void);
|
||||
|
||||
Reference in New Issue
Block a user