source/sink_impl: query hardware for gains on init

Instead of guessing, query the device to populate _gain_mode and _gain.
master
Ryan Tucker 5 years ago committed by Eric Wild
parent f6a8992856
commit a343cc208b
  1. 7
      lib/sink_impl.cc
  2. 7
      lib/source_impl.cc

@ -245,6 +245,13 @@ sink_impl::sink_impl( const std::string &args )
if (!_devs.size())
throw std::runtime_error("No devices specified via device arguments.");
/* Populate the _gain and _gain_mode arrays with the hardware state */
for ( sink_iface *dev : _devs )
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++) {
_gain_mode[dev_chan] = dev->get_gain_mode(dev_chan);
_gain[dev_chan] = dev->get_gain(dev_chan);
}
}
size_t sink_impl::get_num_channels()

@ -403,6 +403,13 @@ source_impl::source_impl( const std::string &args )
if (!_devs.size())
throw std::runtime_error("No devices specified via device arguments.");
/* Populate the _gain and _gain_mode arrays with the hardware state */
for ( source_iface *dev : _devs )
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++) {
_gain_mode[dev_chan] = dev->get_gain_mode(dev_chan);
_gain[dev_chan] = dev->get_gain(dev_chan);
}
}
size_t source_impl::get_num_channels()

Loading…
Cancel
Save