GNU Radio 3.4.2 C++ API
gr_ctcss_squelch_ff.h
Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2006 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 #ifndef INCLUDED_GR_CTCSS_SQUELCH_FF_H
00024 #define INCLUDED_GR_CTCSS_SQUELCH_FF_H
00025 
00026 #include <gr_squelch_base_ff.h>
00027 #include <gri_goertzel.h>
00028 
00029 class gr_ctcss_squelch_ff;
00030 typedef boost::shared_ptr<gr_ctcss_squelch_ff> gr_ctcss_squelch_ff_sptr;
00031 
00032 gr_ctcss_squelch_ff_sptr 
00033 gr_make_ctcss_squelch_ff(int rate, float freq, float level=0.01, int len=0, int ramp=0, bool gate=false);
00034 
00035 /*!
00036  * \brief gate or zero output if ctcss tone not present
00037  * \ingroup level_blk
00038  */
00039 class gr_ctcss_squelch_ff : public gr_squelch_base_ff
00040 {
00041 private:
00042   float d_freq;
00043   float d_level;
00044   int   d_len;
00045   bool  d_mute;
00046      
00047   gri_goertzel d_goertzel_l;
00048   gri_goertzel d_goertzel_c;
00049   gri_goertzel d_goertzel_r;
00050 
00051   friend gr_ctcss_squelch_ff_sptr gr_make_ctcss_squelch_ff(int rate, float freq, float level, int len, int ramp, bool gate);
00052   gr_ctcss_squelch_ff(int rate, float freq, float level, int len, int ramp, bool gate);
00053 
00054   int find_tone(float freq);
00055 
00056 protected:
00057   virtual void update_state(const float &in);
00058   virtual bool mute() const { return d_mute; }
00059   
00060 public:
00061   std::vector<float> squelch_range() const;
00062   float level() const { return d_level; }
00063   void set_level(float level) { d_level = level; }
00064   int len() const { return d_len; }
00065 };
00066 
00067 #endif /* INCLUDED_GR_CTCSS_SQUELCH_FF_H */