GNU Radio 3.7.0 C++ API
pfb_arb_resampler_ccf.h
Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2009,2010,2012 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 
00024 #ifndef INCLUDED_PFB_ARB_RESAMPLER_CCF_H
00025 #define INCLUDED_PFB_ARB_RESAMPLER_CCF_H
00026 
00027 #include <gnuradio/filter/api.h>
00028 #include <gnuradio/block.h>
00029 
00030 namespace gr {
00031   namespace filter {
00032 
00033     /*!
00034      * \brief Polyphase filterbank arbitrary resampler with
00035      *        gr_complex input, gr_complex output and float taps
00036      * \ingroup resamplers_blk
00037      *
00038      * \details
00039 
00040      * This block takes in a signal stream and calls
00041      * gr::filter::kernel::pfb_arb_resampler_ccf to perform 
00042      * arbitrary resampling on the stream.
00043      *
00044      * Output sampling rate is \p rate * input rate.
00045      */
00046     class FILTER_API pfb_arb_resampler_ccf : virtual public block
00047     {
00048     public:
00049       // gr::filter::pfb_arb_resampler_ccf::sptr
00050       typedef boost::shared_ptr<pfb_arb_resampler_ccf> sptr;
00051 
00052       /*!
00053        * Build the polyphase filterbank arbitray resampler.
00054        * \param rate  (float) Specifies the resampling rate to use
00055        * \param taps  (vector/list of floats) The prototype filter to populate the filterbank. The taps
00056        *              should be generated at the filter_size sampling rate.
00057        * \param filter_size (unsigned int) The number of filters in the filter bank. This is directly
00058        *                    related to quantization noise introduced during the resampling.
00059        *                    Defaults to 32 filters.
00060        */
00061       static sptr make(float rate,
00062                        const std::vector<float> &taps,
00063                        unsigned int filter_size=32);
00064 
00065       /*!
00066        * Resets the filterbank's filter taps with the new prototype filter
00067        * \param taps    (vector/list of floats) The prototype filter to populate the filterbank.
00068        */
00069       virtual void set_taps(const std::vector<float> &taps) = 0;
00070 
00071       /*!
00072        * Return a vector<vector<>> of the filterbank taps
00073        */
00074       virtual std::vector<std::vector<float> > taps() const = 0;
00075 
00076       /*!
00077        * Print all of the filterbank taps to screen.
00078        */
00079       virtual void print_taps() = 0;
00080 
00081       /*!
00082        * Sets the resampling rate of the block.
00083        */
00084       virtual void set_rate (float rate) = 0;
00085 
00086       /*!
00087        * Sets the current phase offset in radians (0 to 2pi).
00088        */
00089       virtual void set_phase(float ph) = 0;
00090 
00091       /*!
00092        * Gets the current phase of the resampler in radians (2 to 2pi).
00093        */
00094       virtual float phase() const = 0;
00095 
00096       /*!
00097        * Gets the number of taps per filter.
00098        */
00099       virtual unsigned int taps_per_filter() const = 0;
00100 
00101       /*!
00102        * Gets the interpolation rate of the filter.
00103        */
00104       virtual unsigned int interpolation_rate() const = 0;
00105 
00106       /*!
00107        * Gets the decimation rate of the filter.
00108        */    
00109       virtual unsigned int decimation_rate() const =0;
00110       
00111       /*!
00112        * Gets the fractional rate of the filter.
00113        */    
00114       virtual float fractional_rate() const = 0;
00115 
00116       /*!
00117        * Get the group delay of the filter.
00118        */
00119       virtual int group_delay() const = 0;
00120 
00121       /*!
00122        * Calculates the phase offset expected by a sine wave of
00123        * frequency \p freq and sampling rate \p fs (assuming input
00124        * sine wave has 0 degree phase).
00125        */
00126       virtual float phase_offset(float freq, float fs) = 0;
00127     };
00128 
00129   } /* namespace filter */
00130 } /* namespace gr */
00131 
00132 #endif /* INCLUDED_PFB_ARB_RESAMPLER_CCF_H */