aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDimitri Stolnikov <horiz0n@gmx.net>2013-06-09 13:11:32 +0200
committerDimitri Stolnikov <horiz0n@gmx.net>2013-06-09 13:11:32 +0200
commite1f4c24232bcad724b3d2146a90e1710c0f04a0b (patch)
treec0312029afc645aa67986744ef2018929162883f
parented627cea9c47da34c32ec40fe45212c4012c5292 (diff)
hackrf: select narrower filters in auto bw mode to prevent aliasing
-rw-r--r--lib/hackrf/hackrf_sink_c.cc4
-rw-r--r--lib/hackrf/hackrf_source_c.cc4
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/hackrf/hackrf_sink_c.cc b/lib/hackrf/hackrf_sink_c.cc
index 6d3ec82..159e91b 100644
--- a/lib/hackrf/hackrf_sink_c.cc
+++ b/lib/hackrf/hackrf_sink_c.cc
@@ -495,7 +495,7 @@ double hackrf_sink_c::set_sample_rate( double rate )
ret = hackrf_set_sample_rate( _dev, rate );
if ( HACKRF_SUCCESS == ret ) {
_sample_rate = rate;
- set_bandwidth( rate );
+ set_bandwidth( 0.0 ); /* bandwidth of 0 means automatic filter selection */
} else {
HACKRF_THROW_ON_ERROR( ret, HACKRF_FUNC_STR( "hackrf_set_sample_rate", rate ) )
}
@@ -696,7 +696,7 @@ double hackrf_sink_c::set_bandwidth( double bandwidth, size_t chan )
// osmosdr::freq_range_t bandwidths = get_bandwidth_range( chan );
if ( bandwidth == 0.0 ) /* bandwidth of 0 means automatic filter selection */
- bandwidth = _sample_rate;
+ bandwidth = _sample_rate * 0.75; /* select narrower filters to prevent aliasing */
if ( _dev ) {
/* compute best default value depending on sample rate (auto filter) */
diff --git a/lib/hackrf/hackrf_source_c.cc b/lib/hackrf/hackrf_source_c.cc
index 03058cc..ab68c14 100644
--- a/lib/hackrf/hackrf_source_c.cc
+++ b/lib/hackrf/hackrf_source_c.cc
@@ -387,7 +387,7 @@ double hackrf_source_c::set_sample_rate( double rate )
ret = hackrf_set_sample_rate( _dev, rate );
if ( HACKRF_SUCCESS == ret ) {
_sample_rate = rate;
- set_bandwidth( rate );
+ set_bandwidth( 0.0 ); /* bandwidth of 0 means automatic filter selection */
} else {
HACKRF_THROW_ON_ERROR( ret, HACKRF_FUNC_STR( "hackrf_set_sample_rate", rate ) )
}
@@ -615,7 +615,7 @@ double hackrf_source_c::set_bandwidth( double bandwidth, size_t chan )
// osmosdr::freq_range_t bandwidths = get_bandwidth_range( chan );
if ( bandwidth == 0.0 ) /* bandwidth of 0 means automatic filter selection */
- bandwidth = _sample_rate;
+ bandwidth = _sample_rate * 0.75; /* select narrower filters to prevent aliasing */
if ( _dev ) {
/* compute best default value depending on sample rate (auto filter) */