GNU Radio 3.6.4 C++ API
ctcss_squelch_ff_impl.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2006,2012 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 #ifndef INCLUDED_ANALOG_CTCSS_SQUELCH_FF_IMPL_H
24 #define INCLUDED_ANALOG_CTCSS_SQUELCH_FF_IMPL_H
25 
27 #include "squelch_base_ff_impl.h"
28 #include <fft/goertzel.h>
29 
30 namespace gr {
31  namespace analog {
32 
34  {
35  private:
36  float d_freq;
37  float d_level;
38  int d_len;
39  bool d_mute;
40 
41  fft::goertzel d_goertzel_l;
42  fft::goertzel d_goertzel_c;
43  fft::goertzel d_goertzel_r;
44 
45  int find_tone(float freq);
46 
47  protected:
48  virtual void update_state(const float &in);
49  virtual bool mute() const { return d_mute; }
50 
51  public:
52  ctcss_squelch_ff_impl(int rate, float freq, float level,
53  int len, int ramp, bool gate);
55 
56  std::vector<float> squelch_range() const;
57  float level() const { return d_level; }
58  void set_level(float level) { d_level = level; }
59  int len() const { return d_len; }
60 
61  int ramp() const { return squelch_base_ff_impl::ramp(); }
63  bool gate() const { return squelch_base_ff_impl::gate(); }
65  bool unmuted() const { return squelch_base_ff_impl::unmuted(); }
66 
67  int general_work(int noutput_items,
68  gr_vector_int &ninput_items,
69  gr_vector_const_void_star &input_items,
70  gr_vector_void_star &output_items)
71  {
72  return squelch_base_ff_impl::general_work(noutput_items,
73  ninput_items,
74  input_items,
75  output_items);
76  }
77  };
78 
79  } /* namespace analog */
80 } /* namespace gr */
81 
82 #endif /* INCLUDED_ANALOG_CTCSS_SQUELCH_FF_IMPL_H */