use show signal to perform initial gui update
[debian/gnuradio] / gnuradio-core / src / lib / filter / gr_pfb_clock_sync_ccf.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_PFB_CLOCK_SYNC_CCF_H
25 #define INCLUDED_GR_PFB_CLOCK_SYNC_CCF_H
26
27 #include <gr_block.h>
28
29 class gr_pfb_clock_sync_ccf;
30 typedef boost::shared_ptr<gr_pfb_clock_sync_ccf> gr_pfb_clock_sync_ccf_sptr;
31 gr_pfb_clock_sync_ccf_sptr gr_make_pfb_clock_sync_ccf (float sps, float gain,
32                                                            const std::vector<float> &taps,
33                                                            unsigned int filter_size=32,
34                                                            float init_phase=0);
35
36 class gr_fir_ccf;
37
38 /*!
39  * \class gr_pfb_clock_sync_ccf
40  *
41  * \brief Timing synchronizer using polyphase filterbanks
42  *
43  * \ingroup filter_blk
44  * 
45  */
46
47 class gr_pfb_clock_sync_ccf : public gr_block
48 {
49  private:
50   /*!
51    * Build the polyphase filterbank timing synchronizer.
52    */
53   friend gr_pfb_clock_sync_ccf_sptr gr_make_pfb_clock_sync_ccf (float sps, float gain,
54                                                                 const std::vector<float> &taps,
55                                                                 unsigned int filter_size,
56                                                                 float init_phase);
57
58   bool                     d_updated;
59   unsigned int             d_sps;
60   float                    d_alpha;
61   unsigned int             d_nfilters;
62   std::vector<gr_fir_ccf*> d_filters;
63   std::vector<gr_fir_ccf*> d_diff_filters;
64   std::vector< std::vector<float> > d_taps;
65   std::vector< std::vector<float> > d_dtaps;
66   float                    d_acc;
67   unsigned int             d_last_filter;
68   unsigned int             d_start_count;
69   unsigned int             d_taps_per_filter;
70
71   /*!
72    * Build the polyphase filterbank timing synchronizer.
73    */
74   gr_pfb_clock_sync_ccf (float sps, float gain,
75                          const std::vector<float> &taps,
76                          unsigned int filter_size,
77                          float init_phase);
78   
79   void create_diff_taps(const std::vector<float> &newtaps,
80                         std::vector<float> &difftaps);
81
82 public:
83   ~gr_pfb_clock_sync_ccf ();
84   
85   /*!
86    * Resets the filterbank's filter taps with the new prototype filter
87    */
88   void set_taps (const std::vector<float> &taps,
89                  std::vector< std::vector<float> > &ourtaps,
90                  std::vector<gr_fir_ccf*> &ourfilter);
91   std::vector<float> channel_taps(int channel);
92   std::vector<float> diff_channel_taps(int channel);
93
94   /*!
95    * Print all of the filterbank taps to screen.
96    */
97   void print_taps();
98   void print_diff_taps();
99   
100   int general_work (int noutput_items,
101                     gr_vector_int &ninput_items,
102                     gr_vector_const_void_star &input_items,
103                     gr_vector_void_star &output_items);
104 };
105
106 #endif