From e303948ffb99ffafec24c26b3a1c03d547178719 Mon Sep 17 00:00:00 2001 From: Dimitri Stolnikov Date: Thu, 3 Oct 2013 14:25:28 +0200 Subject: [PATCH] source/sink: initialize sample rate cache variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thanks to Jiří Pinkava for bringing this up. --- lib/sink_impl.cc | 3 ++- lib/sink_impl.h | 1 + lib/source_impl.cc | 3 ++- lib/source_impl.h | 1 + 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/sink_impl.cc b/lib/sink_impl.cc index 9362ae4..a3fb84d 100644 --- a/lib/sink_impl.cc +++ b/lib/sink_impl.cc @@ -65,7 +65,8 @@ osmosdr::sink::make( const std::string &args ) sink_impl::sink_impl( const std::string &args ) : gr::hier_block2 ("sink_impl", args_to_io_signature(args), - gr::io_signature::make(0, 0, 0)) + gr::io_signature::make(0, 0, 0)), + _sample_rate(NAN) { size_t channel = 0; bool device_specified = false; diff --git a/lib/sink_impl.h b/lib/sink_impl.h index 9cf2843..3b95a19 100644 --- a/lib/sink_impl.h +++ b/lib/sink_impl.h @@ -71,6 +71,7 @@ public: private: std::vector< sink_iface * > _devs; + /* cache to prevent multiple device calls with the same value coming from grc */ double _sample_rate; std::map< size_t, double > _center_freq; std::map< size_t, double > _freq_corr; diff --git a/lib/source_impl.cc b/lib/source_impl.cc index 075bd29..c26004b 100644 --- a/lib/source_impl.cc +++ b/lib/source_impl.cc @@ -91,7 +91,8 @@ osmosdr::source::make( const std::string &args ) source_impl::source_impl( const std::string &args ) : gr::hier_block2 ("source_impl", gr::io_signature::make(0, 0, 0), - args_to_io_signature(args)) + args_to_io_signature(args)), + _sample_rate(NAN) { size_t channel = 0; bool device_specified = false; diff --git a/lib/source_impl.h b/lib/source_impl.h index e33f3d7..42ab021 100644 --- a/lib/source_impl.h +++ b/lib/source_impl.h @@ -78,6 +78,7 @@ public: private: std::vector< source_iface * > _devs; + /* cache to prevent multiple device calls with the same value coming from grc */ double _sample_rate; std::map< size_t, double > _center_freq; std::map< size_t, double > _freq_corr;