soapy: support newer getSampleRateRange() API call

Switch to the newer API call which can provide a list of ranges.
There are feature detection ifdefs provided by the library
so that code will always correctly compile.
soapy_support
Josh Blum 6 years ago
parent a9e536f45b
commit b361fa5a77
  1. 7
      lib/soapy/soapy_sink_c.cc
  2. 7
      lib/soapy/soapy_source_c.cc

@ -123,10 +123,17 @@ size_t soapy_sink_c::get_num_channels( void )
osmosdr::meta_range_t soapy_sink_c::get_sample_rates( void )
{
osmosdr::meta_range_t result;
#ifdef SOAPY_SDR_API_HAS_GET_SAMPLE_RATE_RANGE
BOOST_FOREACH(const SoapySDR::Range &r, _device->getSampleRateRange(SOAPY_SDR_TX, 0))
{
result.push_back(osmosdr::range_t(r.minimum(), r.maximum()));
}
#else
BOOST_FOREACH(const double rate, _device->listSampleRates(SOAPY_SDR_TX, 0))
{
result.push_back(osmosdr::range_t(rate));
}
#endif
return result;
}

@ -124,10 +124,17 @@ size_t soapy_source_c::get_num_channels( void )
osmosdr::meta_range_t soapy_source_c::get_sample_rates( void )
{
osmosdr::meta_range_t result;
#ifdef SOAPY_SDR_API_HAS_GET_SAMPLE_RATE_RANGE
BOOST_FOREACH(const SoapySDR::Range &r, _device->getSampleRateRange(SOAPY_SDR_RX, 0))
{
result.push_back(osmosdr::range_t(r.minimum(), r.maximum()));
}
#else
BOOST_FOREACH(const double rate, _device->listSampleRates(SOAPY_SDR_RX, 0))
{
result.push_back(osmosdr::range_t(rate));
}
#endif
return result;
}

Loading…
Cancel
Save