diff options
author | Dimitri Stolnikov <horiz0n@gmx.net> | 2012-05-19 22:47:28 +0200 |
---|---|---|
committer | Dimitri Stolnikov <horiz0n@gmx.net> | 2012-05-19 22:47:28 +0200 |
commit | e256bf332e3190d0dba3294698c0855b60ae8bf9 (patch) | |
tree | f4ba21306a30e947a12c925ac98907c4034cec9e | |
parent | 8c0be962150e3997cf5bd81d45a883fda37b2003 (diff) |
reapply previous gain value when switched to manual gain mode
-rw-r--r-- | lib/osmosdr_source_c_impl.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/osmosdr_source_c_impl.cc b/lib/osmosdr_source_c_impl.cc index ef41b59..0c43f74 100644 --- a/lib/osmosdr_source_c_impl.cc +++ b/lib/osmosdr_source_c_impl.cc @@ -324,7 +324,10 @@ bool osmosdr_source_c_impl::set_gain_mode( bool automatic, size_t chan ) if ( chan == channel++ ) if ( _gain_mode[ chan ] != automatic ) { _gain_mode[ chan ] = automatic; - return dev->set_gain_mode( automatic, dev_chan ); + bool mode = dev->set_gain_mode( automatic, dev_chan ); + if (!automatic) // reapply gain value when switched to manual mode + dev->set_gain( _gain[ chan ], dev_chan ); + return mode; } return false; |