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