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.
This commit is contained in:
Josh Blum 2016-06-07 13:52:52 -07:00
parent e3b6560b04
commit 860e9a1a72
2 changed files with 4 additions and 4 deletions

View File

@ -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)

View File

@ -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 )