GNU Radio Manual and C++ API Reference  3.7.13.4
The Free & Open Software Radio Ecosystem
peak_detector_sb.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2007,2013 Free Software Foundation, Inc.
4  *
5  * This file is part of GNU Radio
6  *
7  * GNU Radio is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3, or (at your option)
10  * any later version.
11  *
12  * GNU Radio is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with GNU Radio; see the file COPYING. If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 // WARNING: this file is machine generated. Edits will be overwritten
24 
25 #ifndef INCLUDED_BLOCKS_PEAK_DETECTOR_SB_H
26 #define INCLUDED_BLOCKS_PEAK_DETECTOR_SB_H
27 
28 #include <gnuradio/blocks/api.h>
29 #include <gnuradio/sync_block.h>
30 
31 namespace gr {
32  namespace blocks {
33 
34  /*!
35  * \brief Detect the peak of a signal
36  * \ingroup peak_detectors_blk
37  *
38  * \details
39  * If a peak is detected, this block outputs a 1,
40  * or it outputs 0's.
41  */
42  class BLOCKS_API peak_detector_sb : virtual public sync_block
43  {
44  public:
45  // gr::blocks::peak_detector_sb::sptr
46  typedef boost::shared_ptr<peak_detector_sb> sptr;
47 
48  /*!
49  * Make a peak detector block.
50  *
51  * \param threshold_factor_rise The threshold factor determines
52  * when a peak has started. An average of the signal is
53  * calculated and when the value of the signal goes over
54  * threshold_factor_rise*average, we start looking for a
55  * peak.
56  * \param threshold_factor_fall The threshold factor determines
57  * when a peak has ended. An average of the signal is
58  * calculated and when the value of the signal goes
59  * below threshold_factor_fall*average, we stop looking
60  * for a peak.
61  * \param look_ahead The look-ahead value is used when the
62  * threshold is found to look if there another peak
63  * within this step range. If there is a larger value,
64  * we set that as the peak and look ahead again. This is
65  * continued until the highest point is found with This
66  * look-ahead range.
67  * \param alpha The gain value of a moving average filter
68  */
69  static sptr make(float threshold_factor_rise = 0.25,
70  float threshold_factor_fall = 0.40,
71  int look_ahead = 10,
72  float alpha = 0.001);
73 
74  /*! \brief Set the threshold factor value for the rise time
75  * \param thr new threshold factor
76  */
77  virtual void set_threshold_factor_rise(float thr) = 0;
78 
79  /*! \brief Set the threshold factor value for the fall time
80  * \param thr new threshold factor
81  */
82  virtual void set_threshold_factor_fall(float thr) = 0;
83 
84  /*! \brief Set the look-ahead factor
85  * \param look new look-ahead factor
86  */
87  virtual void set_look_ahead(int look) = 0;
88 
89  /*! \brief Set the running average alpha
90  * \param alpha new alpha for running average
91  */
92  virtual void set_alpha(float alpha) = 0;
93 
94  /*! \brief Get the threshold factor value for the rise time
95  * \return threshold factor
96  */
97  virtual float threshold_factor_rise() = 0;
98 
99  /*! \brief Get the threshold factor value for the fall time
100  * \return threshold factor
101  */
102  virtual float threshold_factor_fall() = 0;
103 
104  /*! \brief Get the look-ahead factor value
105  * \return look-ahead factor
106  */
107  virtual int look_ahead() = 0;
108 
109  /*! \brief Get the alpha value of the running average
110  * \return alpha
111  */
112  virtual float alpha() = 0;
113  };
114 
115  } /* namespace blocks */
116 } /* namespace gr */
117 
118 #endif /* INCLUDED_BLOCKS_PEAK_DETECTOR_SB_H */
Detect the peak of a signal.
Definition: peak_detector_sb.h:42
Include this header to use the message passing features.
Definition: logger.h:695
#define BLOCKS_API
Definition: gr-blocks/include/gnuradio/blocks/api.h:30
synchronous 1:1 input to output with historyOverride work to provide the signal processing implementa...
Definition: sync_block.h:37
boost::shared_ptr< peak_detector_sb > sptr
Definition: peak_detector_sb.h:46