GNU Radio 3.7.1 C++ API
peak_detector_sb.h
Go to the documentation of this file.
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 // WARNING: this file is machine generated. Edits will be overwritten
00024 
00025 #ifndef INCLUDED_BLOCKS_PEAK_DETECTOR_SB_H
00026 #define INCLUDED_BLOCKS_PEAK_DETECTOR_SB_H
00027 
00028 #include <gnuradio/blocks/api.h>
00029 #include <gnuradio/sync_block.h>
00030 
00031 namespace gr {
00032   namespace blocks {
00033 
00034     /*!
00035      * \brief Detect the peak of a signal
00036      * \ingroup peak_detectors_blk
00037      *
00038      * \details
00039      * If a peak is detected, this block outputs a 1,
00040      * or it outputs 0's.
00041      */
00042     class BLOCKS_API peak_detector_sb : virtual public sync_block
00043     {
00044     public:
00045       // gr::blocks::peak_detector_sb::sptr
00046       typedef boost::shared_ptr<peak_detector_sb> sptr;
00047 
00048       /*!
00049        * Make a peak detector block.
00050        *
00051        * \param threshold_factor_rise The threshold factor determins
00052        *        when a peak has started. An average of the signal is
00053        *        calculated and when the value of the signal goes over
00054        *        threshold_factor_rise*average, we start looking for a
00055        *        peak.
00056        * \param threshold_factor_fall The threshold factor determins
00057        *        when a peak has ended. An average of the signal is
00058        *        calculated and when the value of the signal goes
00059        *        bellow threshold_factor_fall*average, we stop looking
00060        *        for a peak.
00061        * \param look_ahead The look-ahead value is used when the
00062        *        threshold is found to look if there another peak
00063        *        within this step range. If there is a larger value,
00064        *        we set that as the peak and look ahead again. This is
00065        *        continued until the highest point is found with This
00066        *        look-ahead range.
00067        * \param alpha The gain value of a moving average filter
00068        */
00069       static sptr make(float threshold_factor_rise = 0.25,
00070                        float threshold_factor_fall = 0.40,
00071                        int look_ahead = 10,
00072                        float alpha = 0.001);
00073 
00074       /*! \brief Set the threshold factor value for the rise time
00075        *  \param thr new threshold factor
00076        */
00077       virtual void set_threshold_factor_rise(float thr) = 0;
00078 
00079       /*! \brief Set the threshold factor value for the fall time
00080        *  \param thr new threshold factor
00081        */
00082       virtual void set_threshold_factor_fall(float thr) = 0;
00083 
00084       /*! \brief Set the look-ahead factor
00085        *  \param look new look-ahead factor
00086        */
00087       virtual void set_look_ahead(int look) = 0;
00088       
00089       /*! \brief Set the running average alpha
00090        *  \param alpha new alpha for running average
00091        */
00092       virtual void set_alpha(int alpha) = 0;
00093 
00094       /*! \brief Get the threshold factor value for the rise time
00095        *  \return threshold factor
00096        */
00097       virtual float threshold_factor_rise() = 0;
00098 
00099       /*! \brief Get the threshold factor value for the fall time
00100        *  \return threshold factor
00101        */
00102       virtual float threshold_factor_fall() = 0;
00103 
00104       /*! \brief Get the look-ahead factor value
00105        *  \return look-ahead factor
00106        */
00107       virtual int look_ahead() = 0;
00108 
00109       /*! \brief Get the alpha value of the running average
00110        *  \return alpha
00111        */
00112       virtual float alpha() = 0;
00113     };
00114 
00115   } /* namespace blocks */
00116 } /* namespace gr */
00117 
00118 #endif /* INCLUDED_BLOCKS_PEAK_DETECTOR_SB_H */