soapy: provide default gain range step

The soapysdr range type does not provide a step size,
however apps like the osmocom siggen use this size for a slider,
and a value of zero will cause a divide by zero error.

Although many ranges are not actually linear,
the idea to provide some default step to avoid crashes.
A future addition to the API may include providing a step.
soapy_support
Josh Blum 7 years ago
parent e3b6560b04
commit 860e9a1a72
  1. 4
      lib/soapy/soapy_sink_c.cc
  2. 4
      lib/soapy/soapy_source_c.cc

@ -184,14 +184,14 @@ std::vector<std::string> soapy_sink_c::get_gain_names( size_t chan)
osmosdr::gain_range_t soapy_sink_c::get_gain_range( size_t chan)
{
SoapySDR::Range r = _device->getGainRange(SOAPY_SDR_TX, chan);
return osmosdr::gain_range_t(r.minimum(), r.maximum());
return osmosdr::gain_range_t(r.minimum(), r.maximum(), 1.0);
}
osmosdr::gain_range_t soapy_sink_c::get_gain_range( const std::string & name,
size_t chan)
{
SoapySDR::Range r = _device->getGainRange(SOAPY_SDR_TX, chan, name);
return osmosdr::gain_range_t(r.minimum(), r.maximum());
return osmosdr::gain_range_t(r.minimum(), r.maximum(), 1.0);
}
bool soapy_sink_c::set_gain_mode( bool automatic, size_t chan)

@ -181,14 +181,14 @@ std::vector<std::string> soapy_source_c::get_gain_names( size_t chan )
osmosdr::gain_range_t soapy_source_c::get_gain_range( size_t chan )
{
SoapySDR::Range r = _device->getGainRange(SOAPY_SDR_RX, chan);
return osmosdr::gain_range_t(r.minimum(), r.maximum());
return osmosdr::gain_range_t(r.minimum(), r.maximum(), 1.0);
}
osmosdr::gain_range_t soapy_source_c::get_gain_range( const std::string & name,
size_t chan )
{
SoapySDR::Range r = _device->getGainRange(SOAPY_SDR_RX, chan, name);
return osmosdr::gain_range_t(r.minimum(), r.maximum());
return osmosdr::gain_range_t(r.minimum(), r.maximum(), 1.0);
}
bool soapy_source_c::set_gain_mode( bool automatic, size_t chan )

Loading…
Cancel
Save