aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2016-06-07 13:45:25 -0700
committerJosh Blum <josh@joshknows.com>2016-06-07 13:45:25 -0700
commite3b6560b0423efbaecb743e7edf6cbb28a1ee3c7 (patch)
tree380e15aa37a5e98b91a77968df3cab274330dc16
parent164a09fc11cec2d8b15b38e8b512fa542d6cecc7 (diff)
soapy: support automatic bandwidth param
When the special 0.0 bandwidth setting is used, set the filter bandwidth to rate * 0.75. Passing automatic 0.0 bandwidth for some devices was problematic.
-rw-r--r--lib/soapy/soapy_sink_c.cc5
-rw-r--r--lib/soapy/soapy_source_c.cc5
2 files changed, 8 insertions, 2 deletions
diff --git a/lib/soapy/soapy_sink_c.cc b/lib/soapy/soapy_sink_c.cc
index dd4130e..c1f6fc1 100644
--- a/lib/soapy/soapy_sink_c.cc
+++ b/lib/soapy/soapy_sink_c.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2015 Josh Blum <josh@joshknows.com>
+ * Copyright 2015-2016 Josh Blum <josh@joshknows.com>
* Copyright 2013 Dimitri Stolnikov <horiz0n@gmx.net>
*
* GNU Radio is free software; you can redistribute it and/or modify
@@ -272,6 +272,9 @@ void soapy_sink_c::set_iq_balance( const std::complex<double> &balance, size_t c
double soapy_sink_c::set_bandwidth( double bandwidth, size_t chan)
{
+ if ( bandwidth == 0.0 ) /* bandwidth of 0 means automatic filter selection */
+ set_bandwidth(get_sample_rate() * 0.75, chan); /* select narrower filters to prevent aliasing */
+
_device->setBandwidth(SOAPY_SDR_TX, chan, bandwidth);
return this->get_bandwidth(chan);
}
diff --git a/lib/soapy/soapy_source_c.cc b/lib/soapy/soapy_source_c.cc
index ea84467..e64f34a 100644
--- a/lib/soapy/soapy_source_c.cc
+++ b/lib/soapy/soapy_source_c.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2015 Josh Blum <josh@joshknows.com>
+ * Copyright 2015-2016 Josh Blum <josh@joshknows.com>
* Copyright 2013 Dimitri Stolnikov <horiz0n@gmx.net>
*
* GNU Radio is free software; you can redistribute it and/or modify
@@ -292,6 +292,9 @@ void soapy_source_c::set_iq_balance( const std::complex<double> &balance, size_t
double soapy_source_c::set_bandwidth( double bandwidth, size_t chan )
{
+ if ( bandwidth == 0.0 ) /* bandwidth of 0 means automatic filter selection */
+ set_bandwidth(get_sample_rate() * 0.75, chan); /* select narrower filters to prevent aliasing */
+
_device->setBandwidth(SOAPY_SDR_RX, chan, bandwidth);
return this->get_bandwidth(chan);
}