GNU Radio 3.6.4.2 C++ API
|
00001 /* -*- c++ -*- */ 00002 /* 00003 * Copyright 2007,2013 Free Software Foundation, Inc. 00004 * 00005 * This file is part of GNU Radio 00006 * 00007 * GNU Radio is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 3, or (at your option) 00010 * any later version. 00011 * 00012 * GNU Radio is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with GNU Radio; see the file COPYING. If not, write to 00019 * the Free Software Foundation, Inc., 51 Franklin Street, 00020 * Boston, MA 02110-1301, USA. 00021 */ 00022 00023 #ifndef INCLUDED_GR_PEAK_DETECTOR2_FB_H 00024 #define INCLUDED_GR_PEAK_DETECTOR2_FB_H 00025 00026 #include <blocks/api.h> 00027 #include <gr_sync_block.h> 00028 00029 namespace gr { 00030 namespace blocks { 00031 00032 /*! 00033 * \brief Detect the peak of a signal 00034 * \ingroup level_blk 00035 * 00036 * If a peak is detected, this block outputs a 1, or it outputs 00037 * 0's. A separate debug output may be connected, to view the 00038 * internal EWMA described below. 00039 * 00040 * \param threshold_factor_rise The threshold factor determins 00041 * when a peak is present. An EWMA average of the signal is 00042 * calculated and when the value of the signal goes over 00043 * threshold_factor_rise*average, we call the peak. 00044 * \param look_ahead The look-ahead value is used when the 00045 * threshold is found to locate the peak within this range. 00046 * \param alpha The gain value of a single-pole moving average filter. 00047 */ 00048 class BLOCKS_API peak_detector2_fb : virtual public gr_sync_block 00049 { 00050 public: 00051 // gr::blocks::peak_detector2_fb::sptr 00052 typedef boost::shared_ptr<peak_detector2_fb> sptr; 00053 00054 static sptr make(float threshold_factor_rise=7, 00055 int look_ahead=1000, float alpha=0.001); 00056 00057 /*! \brief Set the threshold factor value for the rise time 00058 * \param thr new threshold factor 00059 */ 00060 virtual void set_threshold_factor_rise(float thr) = 0; 00061 00062 /*! \brief Set the look-ahead factor 00063 * \param look new look-ahead factor 00064 */ 00065 virtual void set_look_ahead(int look) = 0; 00066 00067 /*! \brief Set the running average alpha 00068 * \param alpha new alpha for running average 00069 */ 00070 virtual void set_alpha(int alpha) = 0; 00071 00072 /*! \brief Get the threshold factor value for the rise time 00073 * \return threshold factor 00074 */ 00075 virtual float threshold_factor_rise() = 0; 00076 00077 /*! \brief Get the look-ahead factor value 00078 * \return look-ahead factor 00079 */ 00080 virtual int look_ahead() = 0; 00081 00082 /*! \brief Get the alpha value of the running average 00083 * \return alpha 00084 */ 00085 virtual float alpha() = 0; 00086 }; 00087 00088 } /* namespace blocks */ 00089 } /* namespace gr */ 00090 00091 #endif /* INCLUDED_GR_PEAK_DETECTOR2_FB_H */