Adding accessor functions to set alpha and beta gains for the FLL.
[debian/gnuradio] / gnuradio-core / src / lib / general / gr_fll_band_edge_cc.h
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2009 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
24 #ifndef INCLUDED_GR_FLL_BAND_EDGE_CC_H
25 #define INCLUDED_GR_FLL_BAND_EDGE_CC_H
26
27 #include <gr_sync_block.h>
28
29 class gr_fll_band_edge_cc;
30 typedef boost::shared_ptr<gr_fll_band_edge_cc> gr_fll_band_edge_cc_sptr;
31 gr_fll_band_edge_cc_sptr gr_make_fll_band_edge_cc (float alpha, float beta,
32                                                    const std::vector<gr_complex> &taps);
33
34 class gr_fir_ccc;
35 class gri_fft_complex;
36
37 /*!
38  * \class gr_fll_band_edge_cc
39  * \brief Frequency Lock Loop using band-edge filters
40  *
41  * \ingroup general
42  */
43
44 class gr_fll_band_edge_cc : public gr_sync_block
45 {
46  private:
47   /*!
48    * Build the FLL
49    * \param taps    (vector/list of gr_complex) The taps of the band-edge filter
50    */
51   friend gr_fll_band_edge_cc_sptr gr_make_fll_band_edge_cc (float alpha, float beta,
52                                                             const std::vector<gr_complex> &taps);
53
54   float                   d_alpha;
55   float                   d_beta;
56   float                   d_max_freq;
57   float                   d_min_freq;
58
59   gr_fir_ccc*             d_filter_upper;
60   gr_fir_ccc*             d_filter_lower;
61   std::vector<gr_complex> d_taps_upper;
62   std::vector<gr_complex> d_taps_lower;
63   bool                    d_updated;
64   float                   d_freq;
65   float                   d_phase;
66
67   /*!
68    * Build the FLL
69    * \param taps    (vector/list of gr_complex) The taps of the band-edge filter
70    */
71   gr_fll_band_edge_cc(float alpha, float beta,
72                       const std::vector<gr_complex> &taps);
73
74 public:
75   ~gr_fll_band_edge_cc ();
76   
77   /*!
78    * Resets the filter taps with the new prototype filter
79    * \param taps    (vector/list of gr_complex) The band-edge filter
80    */
81   void set_taps (const std::vector<gr_complex> &taps);
82
83   /*!
84    * Set the alpha gainvalue
85    * \param alpha    (float) new gain value
86    */
87   void set_alpha(float alpha) { d_alpha = alpha; }
88
89   /*!
90    * Set the beta gain value
91    * \param beta    (float) new gain value
92    */
93   void set_beta(float beta) { d_beta = beta; }
94
95   /*!
96    * Print the taps to screen.
97    */
98   void print_taps();
99    
100   int work (int noutput_items,
101             gr_vector_const_void_star &input_items,
102             gr_vector_void_star &output_items);
103 };
104
105 #endif