From e256bf332e3190d0dba3294698c0855b60ae8bf9 Mon Sep 17 00:00:00 2001 From: Dimitri Stolnikov Date: Sat, 19 May 2012 22:47:28 +0200 Subject: [PATCH] reapply previous gain value when switched to manual gain mode --- lib/osmosdr_source_c_impl.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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;