aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDimitri Stolnikov <horiz0n@gmx.net>2012-05-19 22:47:28 +0200
committerDimitri Stolnikov <horiz0n@gmx.net>2012-05-19 22:47:28 +0200
commite256bf332e3190d0dba3294698c0855b60ae8bf9 (patch)
treef4ba21306a30e947a12c925ac98907c4034cec9e
parent8c0be962150e3997cf5bd81d45a883fda37b2003 (diff)
reapply previous gain value when switched to manual gain mode
-rw-r--r--lib/osmosdr_source_c_impl.cc5
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;