diff options
author | Tom Rondeau <trondeau@vt.edu> | 2012-11-06 12:25:58 -0500 |
---|---|---|
committer | Tom Rondeau <trondeau@vt.edu> | 2012-11-06 12:27:40 -0500 |
commit | 463b962fe280c5515947498b4d0f4fd3b5993662 (patch) | |
tree | 1671d8bad8132113813cc8a9f1c14d0e1c16ef3c /gnuradio-core | |
parent | 55eb2dbfc38ce4287c7408bf9a87c6b56a618d1f (diff) |
analog: Removing all squelch blocks from gnuradio-core.
Also updating some Python blocks and examples to properly pull from filter and analog.
Diffstat (limited to 'gnuradio-core')
21 files changed, 0 insertions, 1256 deletions
diff --git a/gnuradio-core/src/examples/tags/uhd_burst_detector.py b/gnuradio-core/src/examples/tags/uhd_burst_detector.py deleted file mode 100755 index 512fc715d7..0000000000 --- a/gnuradio-core/src/examples/tags/uhd_burst_detector.py +++ /dev/null @@ -1,116 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2011 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import eng_notation -from gnuradio import gr -from gnuradio import uhd -from gnuradio import window -from gnuradio.eng_option import eng_option -from gnuradio.gr import firdes -from optparse import OptionParser - -class uhd_burst_detector(gr.top_block): - def __init__(self, uhd_address, options): - - gr.top_block.__init__(self) - - self.uhd_addr = uhd_address - self.freq = options.freq - self.samp_rate = options.samp_rate - self.gain = options.gain - self.threshold = options.threshold - self.trigger = options.trigger - - self.uhd_src = uhd.single_usrp_source( - device_addr=self.uhd_addr, - stream_args=uhd.stream_args('fc32')) - - self.uhd_src.set_samp_rate(self.samp_rate) - self.uhd_src.set_center_freq(self.freq, 0) - self.uhd_src.set_gain(self.gain, 0) - - taps = firdes.low_pass_2(1, 1, 0.4, 0.1, 60) - self.chanfilt = gr.fir_filter_ccc(10, taps) - self.tagger = gr.burst_tagger(gr.sizeof_gr_complex) - - # Dummy signaler to collect a burst on known periods - data = 1000*[0,] + 1000*[1,] - self.signal = gr.vector_source_s(data, True) - - # Energy detector to get signal burst - ## use squelch to detect energy - self.det = gr.simple_squelch_cc(self.threshold, 0.01) - ## convert to mag squared (float) - self.c2m = gr.complex_to_mag_squared() - ## average to debounce - self.avg = gr.single_pole_iir_filter_ff(0.01) - ## rescale signal for conversion to short - self.scale = gr.multiply_const_ff(2**16) - ## signal input uses shorts - self.f2s = gr.float_to_short() - - # Use file sink burst tagger to capture bursts - self.fsnk = gr.tagged_file_sink(gr.sizeof_gr_complex, self.samp_rate) - - - ################################################## - # Connections - ################################################## - self.connect((self.uhd_src, 0), (self.tagger, 0)) - self.connect((self.tagger, 0), (self.fsnk, 0)) - - if self.trigger: - # Connect a dummy signaler to the burst tagger - self.connect((self.signal, 0), (self.tagger, 1)) - - else: - # Connect an energy detector signaler to the burst tagger - self.connect(self.uhd_src, self.det) - self.connect(self.det, self.c2m, self.avg, self.scale, self.f2s) - self.connect(self.f2s, (self.tagger, 1)) - - def set_samp_rate(self, samp_rate): - self.samp_rate = samp_rate - self.uhd_src_0.set_samp_rate(self.samp_rate) - -if __name__ == '__main__': - parser = OptionParser(option_class=eng_option, usage="%prog: [options]") - parser.add_option("-a", "--address", type="string", default="addr=192.168.10.2", - help="select address of the device [default=%default]") - #parser.add_option("-A", "--antenna", default=None, - # help="select Rx Antenna (only on RFX-series boards)") - parser.add_option("-f", "--freq", type="eng_float", default=450e6, - help="set frequency to FREQ", metavar="FREQ") - parser.add_option("-g", "--gain", type="eng_float", default=0, - help="set gain in dB [default=%default]") - parser.add_option("-R", "--samp-rate", type="eng_float", default=200000, - help="set USRP sample rate [default=%default]") - parser.add_option("-t", "--threshold", type="float", default=-60, - help="Set the detection power threshold (dBm) [default=%default") - parser.add_option("-T", "--trigger", action="store_true", default=False, - help="Use internal trigger instead of detector [default=%default]") - (options, args) = parser.parse_args() - - uhd_addr = options.address - - tb = uhd_burst_detector(uhd_addr, options) - tb.run() diff --git a/gnuradio-core/src/lib/general/CMakeLists.txt b/gnuradio-core/src/lib/general/CMakeLists.txt index ced366903c..ff73dd91f6 100644 --- a/gnuradio-core/src/lib/general/CMakeLists.txt +++ b/gnuradio-core/src/lib/general/CMakeLists.txt @@ -178,7 +178,6 @@ set(gr_core_general_triple_threats gr_copy gr_cpfsk_bc gr_cpm - gr_ctcss_squelch_ff gr_decode_ccsds_27_fb gr_deinterleave gr_delay @@ -216,8 +215,6 @@ set(gr_core_general_triple_threats gr_peak_detector2_fb gr_phase_modulator_fc gr_prefs - gr_pwr_squelch_cc - gr_pwr_squelch_ff gr_quadrature_demod_cf gr_rail_ff gr_regenerate_bb @@ -228,10 +225,7 @@ set(gr_core_general_triple_threats gr_short_to_float gr_short_to_char gr_simple_correlator - gr_simple_squelch_cc gr_skiphead - gr_squelch_base_cc - gr_squelch_base_ff gr_stream_mux gr_stream_to_streams gr_stream_to_vector diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i index 6cac23aac4..96b7e48d63 100644 --- a/gnuradio-core/src/lib/general/general.i +++ b/gnuradio-core/src/lib/general/general.i @@ -61,7 +61,6 @@ #include <gr_interleave.h> #include <gr_deinterleave.h> #include <gr_delay.h> -#include <gr_simple_squelch_cc.h> #include <gr_rms_cf.h> #include <gr_rms_ff.h> #include <gr_nlog10_ff.h> @@ -92,9 +91,6 @@ #include <gr_multiply_const_ff.h> #include <gr_multiply_conjugate_cc.h> #include <gr_feval.h> -#include <gr_pwr_squelch_cc.h> -#include <gr_pwr_squelch_ff.h> -#include <gr_ctcss_squelch_ff.h> #include <gr_bin_statistics_f.h> #include <gr_peak_detector2_fb.h> #include <gr_repeat.h> @@ -154,7 +150,6 @@ %include "gr_interleave.i" %include "gr_deinterleave.i" %include "gr_delay.i" -%include "gr_simple_squelch_cc.i" %include "gr_rms_cf.i" %include "gr_rms_ff.i" %include "gr_nlog10_ff.i" @@ -185,9 +180,6 @@ %include "gr_multiply_const_ff.i" %include "gr_multiply_conjugate_cc.i" %include "gr_feval.i" -%include "gr_pwr_squelch_cc.i" -%include "gr_pwr_squelch_ff.i" -%include "gr_ctcss_squelch_ff.i" %include "gr_bin_statistics_f.i" %include "gr_peak_detector2_fb.i" %include "gr_repeat.i" diff --git a/gnuradio-core/src/lib/general/gr_ctcss_squelch_ff.cc b/gnuradio-core/src/lib/general/gr_ctcss_squelch_ff.cc deleted file mode 100644 index d31763a6bf..0000000000 --- a/gnuradio-core/src/lib/general/gr_ctcss_squelch_ff.cc +++ /dev/null @@ -1,112 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2006,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_ctcss_squelch_ff.h> - -static float ctcss_tones[] = { - 67.0, 71.9, 74.4, 77.0, 79.7, 82.5, 85.4, 88.5, 91.5, 94.8, - 97.4, 100.0, 103.5, 107.2, 110.9, 114.8, 118.8, 123.0, 127.3, 131.8, - 136.5, 141.3, 146.2, 151.4, 156.7, 162.2, 167.9, 173.8, 179.9, 186.2, - 192.8, 203.5, 210.7, 218.1, 225.7, 233.6, 241.8, 250.3 -}; - -static int max_tone_index = 37; - -gr_ctcss_squelch_ff_sptr -gr_make_ctcss_squelch_ff(int rate, float freq, float level, int len, int ramp, bool gate) -{ - return gnuradio::get_initial_sptr(new gr_ctcss_squelch_ff(rate, freq, level, len, ramp, gate)); -} - -int gr_ctcss_squelch_ff::find_tone(float freq) -{ - for (int i = 0; i <= max_tone_index; i++) - if (ctcss_tones[i] == freq) // FIXME: make almost equal - return i; - - return -1; -} - -gr_ctcss_squelch_ff::gr_ctcss_squelch_ff(int rate, float freq, float level, int len, int ramp, bool gate) : - gr_squelch_base_ff("ctcss_squelch_ff", ramp, gate) -{ - d_freq = freq; - d_level = level; - - // Default is 100 ms detection time - if (len == 0) - d_len = (int)(rate/10.0); - else - d_len = len; - - int i = find_tone(freq); - - // Non-standard tones or edge tones get 2% guard band, otherwise - // guards are set at adjacent ctcss tone frequencies - float f_l, f_r; - if (i == -1 || i == 0) - f_l = freq*0.98; - else - f_l = ctcss_tones[i-1]; - - if (i == -1 || i == max_tone_index) - f_r = freq*1.02; - else - f_r = ctcss_tones[i+1]; - - d_goertzel_l = gri_goertzel(rate, d_len, f_l); - d_goertzel_c = gri_goertzel(rate, d_len, freq); - d_goertzel_r = gri_goertzel(rate, d_len, f_r); - - d_mute = true; -} - -std::vector<float> gr_ctcss_squelch_ff::squelch_range() const -{ - std::vector<float> r(3); - r[0] = 0.0; - r[1] = 1.0; - r[2] = (r[1]-r[0])/100; // step size - - return r; -} - -void gr_ctcss_squelch_ff::update_state(const float &in) -{ - d_goertzel_l.input(in); - d_goertzel_c.input(in); - d_goertzel_r.input(in); - - float d_out_l, d_out_c, d_out_r; - if (d_goertzel_c.ready()) { - d_out_l = abs(d_goertzel_l.output()); - d_out_c = abs(d_goertzel_c.output()); - d_out_r = abs(d_goertzel_r.output()); - - //printf("d_out_l=%f d_out_c=%f d_out_r=%f\n", d_out_l, d_out_c, d_out_r); - d_mute = (d_out_c < d_level || d_out_c < d_out_l || d_out_c < d_out_r); - } -} diff --git a/gnuradio-core/src/lib/general/gr_ctcss_squelch_ff.h b/gnuradio-core/src/lib/general/gr_ctcss_squelch_ff.h deleted file mode 100644 index ef3d13ba7b..0000000000 --- a/gnuradio-core/src/lib/general/gr_ctcss_squelch_ff.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_CTCSS_SQUELCH_FF_H -#define INCLUDED_GR_CTCSS_SQUELCH_FF_H - -#include <gr_core_api.h> -#include <gr_squelch_base_ff.h> -#include <gri_goertzel.h> - -class gr_ctcss_squelch_ff; -typedef boost::shared_ptr<gr_ctcss_squelch_ff> gr_ctcss_squelch_ff_sptr; - -GR_CORE_API gr_ctcss_squelch_ff_sptr -gr_make_ctcss_squelch_ff(int rate, float freq, float level=0.01, int len=0, int ramp=0, bool gate=false); - -/*! - * \brief gate or zero output if ctcss tone not present - * \ingroup level_blk - */ -class GR_CORE_API gr_ctcss_squelch_ff : public gr_squelch_base_ff -{ -private: - float d_freq; - float d_level; - int d_len; - bool d_mute; - - gri_goertzel d_goertzel_l; - gri_goertzel d_goertzel_c; - gri_goertzel d_goertzel_r; - - 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); - gr_ctcss_squelch_ff(int rate, float freq, float level, int len, int ramp, bool gate); - - int find_tone(float freq); - -protected: - virtual void update_state(const float &in); - virtual bool mute() const { return d_mute; } - -public: - std::vector<float> squelch_range() const; - float level() const { return d_level; } - void set_level(float level) { d_level = level; } - int len() const { return d_len; } -}; - -#endif /* INCLUDED_GR_CTCSS_SQUELCH_FF_H */ diff --git a/gnuradio-core/src/lib/general/gr_ctcss_squelch_ff.i b/gnuradio-core/src/lib/general/gr_ctcss_squelch_ff.i deleted file mode 100644 index b160c5dfd7..0000000000 --- a/gnuradio-core/src/lib/general/gr_ctcss_squelch_ff.i +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,ctcss_squelch_ff); - -%include gr_squelch_base_ff.i - -gr_ctcss_squelch_ff_sptr -gr_make_ctcss_squelch_ff(int rate, float freq, float level=0.01, int len=0, int ramp=0, bool gate=false); - -class gr_ctcss_squelch_ff : public gr_squelch_base_ff -{ - gr_ctcss_squelch_ff(int rate, float freq, float level, int len, int ramp, bool gate); - -public: - std::vector<float> squelch_range() const; - float level() const { return d_level; } - void set_level(float level) { d_level = level; } - int len() const { return d_len; } -}; diff --git a/gnuradio-core/src/lib/general/gr_pwr_squelch_cc.cc b/gnuradio-core/src/lib/general/gr_pwr_squelch_cc.cc deleted file mode 100644 index 90eab13eba..0000000000 --- a/gnuradio-core/src/lib/general/gr_pwr_squelch_cc.cc +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2006,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_pwr_squelch_cc.h> - -gr_pwr_squelch_cc_sptr -gr_make_pwr_squelch_cc(double threshold, double alpha, int ramp, bool gate) -{ - return gnuradio::get_initial_sptr(new gr_pwr_squelch_cc(threshold, alpha, ramp, gate)); -} - -gr_pwr_squelch_cc::gr_pwr_squelch_cc(double threshold, double alpha, int ramp, bool gate) : - gr_squelch_base_cc("pwr_squelch_cc", ramp, gate), - d_iir(alpha) -{ - set_threshold(threshold); -} - -std::vector<float> gr_pwr_squelch_cc::squelch_range() const -{ - std::vector<float> r(3); - r[0] = -50.0; // min FIXME - r[1] = +50.0; // max FIXME - r[2] = (r[1] - r[0]) / 100; // step size - - return r; -} - -void gr_pwr_squelch_cc::update_state(const gr_complex &in) -{ - d_pwr = d_iir.filter(in.real()*in.real()+in.imag()*in.imag()); -} diff --git a/gnuradio-core/src/lib/general/gr_pwr_squelch_cc.h b/gnuradio-core/src/lib/general/gr_pwr_squelch_cc.h deleted file mode 100644 index b2b4624f58..0000000000 --- a/gnuradio-core/src/lib/general/gr_pwr_squelch_cc.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_PWR_SQUELCH_CC_H -#define INCLUDED_GR_PWR_SQUELCH_CC_H - -#include <gr_core_api.h> -#include <cmath> -#include <gr_squelch_base_cc.h> -#include <gr_single_pole_iir.h> - -class gr_pwr_squelch_cc; -typedef boost::shared_ptr<gr_pwr_squelch_cc> gr_pwr_squelch_cc_sptr; - -GR_CORE_API gr_pwr_squelch_cc_sptr -gr_make_pwr_squelch_cc(double db, double alpha = 0.0001, int ramp=0, bool gate=false); - -/*! - * \brief gate or zero output when input power below threshold - * \ingroup level_blk - */ -class GR_CORE_API gr_pwr_squelch_cc : public gr_squelch_base_cc -{ -private: - double d_threshold; - double d_pwr; - gr_single_pole_iir<double,double,double> d_iir; - - friend GR_CORE_API gr_pwr_squelch_cc_sptr gr_make_pwr_squelch_cc(double db, double alpha, int ramp, bool gate); - gr_pwr_squelch_cc(double db, double alpha, int ramp, bool gate); - -protected: - virtual void update_state(const gr_complex &in); - virtual bool mute() const { return d_pwr < d_threshold; } - -public: - std::vector<float> squelch_range() const; - - double threshold() const { return 10*log10(d_threshold); } - void set_threshold(double db) { d_threshold = std::pow(10.0, db/10); } - void set_alpha(double alpha) { d_iir.set_taps(alpha); } -}; - -#endif /* INCLUDED_GR_PWR_SQUELCH_CC_H */ diff --git a/gnuradio-core/src/lib/general/gr_pwr_squelch_cc.i b/gnuradio-core/src/lib/general/gr_pwr_squelch_cc.i deleted file mode 100644 index c8cafd7aac..0000000000 --- a/gnuradio-core/src/lib/general/gr_pwr_squelch_cc.i +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2009 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,pwr_squelch_cc); - -// retrieve info on the base class, without generating wrappers since -// the base class has a pure virual method. -%import "gr_squelch_base_cc.i" - -gr_pwr_squelch_cc_sptr -gr_make_pwr_squelch_cc(double db, double alpha=0.0001, int ramp=0, bool gate=false); - -class gr_pwr_squelch_cc : public gr_squelch_base_cc -{ -private: - gr_pwr_squelch_cc(double db, double alpha, int ramp, bool gate); - -public: - double threshold() const { return 10*log10(d_threshold); } - void set_threshold(double db) { d_threshold = std::pow(10.0, db/10); } - void set_alpha(double alpha) { d_iir.set_taps(alpha); } - std::vector<float> squelch_range() const; -}; diff --git a/gnuradio-core/src/lib/general/gr_pwr_squelch_ff.cc b/gnuradio-core/src/lib/general/gr_pwr_squelch_ff.cc deleted file mode 100644 index cfa867243d..0000000000 --- a/gnuradio-core/src/lib/general/gr_pwr_squelch_ff.cc +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2006,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_pwr_squelch_ff.h> - -gr_pwr_squelch_ff_sptr -gr_make_pwr_squelch_ff(double threshold, double alpha, int ramp, bool gate) -{ - return gnuradio::get_initial_sptr(new gr_pwr_squelch_ff(threshold, alpha, ramp, gate)); -} - -gr_pwr_squelch_ff::gr_pwr_squelch_ff(double threshold, double alpha, int ramp, bool gate) : - gr_squelch_base_ff("pwr_squelch_ff", ramp, gate), - d_iir(alpha) -{ - set_threshold(threshold); -} - -std::vector<float> gr_pwr_squelch_ff::squelch_range() const -{ - std::vector<float> r(3); - r[0] = -50.0; // min FIXME - r[1] = +50.0; // max FIXME - r[2] = (r[1] - r[0]) / 100; // step size - - return r; -} - -void gr_pwr_squelch_ff::update_state(const float &in) -{ - d_pwr = d_iir.filter(in*in); -} diff --git a/gnuradio-core/src/lib/general/gr_pwr_squelch_ff.h b/gnuradio-core/src/lib/general/gr_pwr_squelch_ff.h deleted file mode 100644 index d5148c4096..0000000000 --- a/gnuradio-core/src/lib/general/gr_pwr_squelch_ff.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_PWR_SQUELCH_FF_H -#define INCLUDED_GR_PWR_SQUELCH_FF_H - -#include <gr_core_api.h> -#include <cmath> -#include <gr_squelch_base_ff.h> -#include <gr_single_pole_iir.h> - -class gr_pwr_squelch_ff; -typedef boost::shared_ptr<gr_pwr_squelch_ff> gr_pwr_squelch_ff_sptr; - -GR_CORE_API gr_pwr_squelch_ff_sptr -gr_make_pwr_squelch_ff(double db, double alpha = 0.0001, int ramp=0, bool gate=false); - -/*! - * \brief gate or zero output when input power below threshold - * \ingroup level_blk - */ -class GR_CORE_API gr_pwr_squelch_ff : public gr_squelch_base_ff -{ -private: - double d_threshold; - double d_pwr; - gr_single_pole_iir<double,double,double> d_iir; - - friend GR_CORE_API gr_pwr_squelch_ff_sptr gr_make_pwr_squelch_ff(double db, double alpha, int ramp, bool gate); - gr_pwr_squelch_ff(double db, double alpha, int ramp, bool gate); - -protected: - virtual void update_state(const float &in); - virtual bool mute() const { return d_pwr < d_threshold; } - -public: - std::vector<float> squelch_range() const; - - double threshold() const { return 10*log10(d_threshold); } - void set_threshold(double db) { d_threshold = std::pow(10.0, db/10); } - void set_alpha(double alpha) { d_iir.set_taps(alpha); } -}; - -#endif /* INCLUDED_GR_PWR_SQUELCH_FF_H */ diff --git a/gnuradio-core/src/lib/general/gr_pwr_squelch_ff.i b/gnuradio-core/src/lib/general/gr_pwr_squelch_ff.i deleted file mode 100644 index 2682f27586..0000000000 --- a/gnuradio-core/src/lib/general/gr_pwr_squelch_ff.i +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2009 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,pwr_squelch_ff); - -// retrieve info on the base class, without generating wrappers since -// the base class has a pure virual method. -%import "gr_squelch_base_ff.i" - -gr_pwr_squelch_ff_sptr -gr_make_pwr_squelch_ff(double db, double alpha=0.0001, int ramp=0, bool gate=false); - -class gr_pwr_squelch_ff : public gr_squelch_base_ff -{ -private: - gr_pwr_squelch_ff(double db, double alpha, int ramp, bool gate); - -public: - double threshold() const { return 10*log10(d_threshold); } - void set_threshold(double db) { d_threshold = std::pow(10.0, db/10); } - void set_alpha(double alpha) { d_iir.set_taps(alpha); } - std::vector<float> squelch_range() const; -}; diff --git a/gnuradio-core/src/lib/general/gr_simple_squelch_cc.cc b/gnuradio-core/src/lib/general/gr_simple_squelch_cc.cc deleted file mode 100644 index 5d90a3da48..0000000000 --- a/gnuradio-core/src/lib/general/gr_simple_squelch_cc.cc +++ /dev/null @@ -1,99 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include <gr_simple_squelch_cc.h> -#include <gr_io_signature.h> -#include <cmath> - -gr_simple_squelch_cc_sptr -gr_make_simple_squelch_cc(double threshold_db, double alpha) -{ - return gnuradio::get_initial_sptr(new gr_simple_squelch_cc(threshold_db, alpha)); -} - -gr_simple_squelch_cc::gr_simple_squelch_cc (double threshold_db, double alpha) - : gr_sync_block ("simple_squelch_cc", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(gr_complex))), - d_iir(alpha), d_unmuted(false) -{ - set_threshold (threshold_db); -} - -gr_simple_squelch_cc::~gr_simple_squelch_cc() -{ -} - - -int -gr_simple_squelch_cc::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const gr_complex *in = (const gr_complex *) input_items[0]; - gr_complex *out = (gr_complex *) output_items[0]; - - for (int i = 0; i < noutput_items; i++){ - double mag_sqrd = in[i].real()*in[i].real() + in[i].imag()*in[i].imag(); - double f = d_iir.filter(mag_sqrd); - if (f >= d_threshold) - out[i] = in[i]; - else - out[i] = 0; - } - - d_unmuted = d_iir.prev_output() >= d_threshold; - return noutput_items; -} - -void -gr_simple_squelch_cc::set_threshold(double decibels) -{ - // convert to absolute threshold (mag squared) - d_threshold = std::pow(10.0, decibels/10); -} - -double -gr_simple_squelch_cc::threshold() const -{ - return 10 * log10(d_threshold); -} - -void -gr_simple_squelch_cc::set_alpha(double alpha) -{ - d_iir.set_taps(alpha); -} - -std::vector<float> -gr_simple_squelch_cc::squelch_range() const -{ - std::vector<float> r(3); - r[0] = -50.0; // min FIXME - r[1] = +50.0; // max FIXME - r[2] = (r[1] - r[0]) / 100; // step size - - return r; -} diff --git a/gnuradio-core/src/lib/general/gr_simple_squelch_cc.h b/gnuradio-core/src/lib/general/gr_simple_squelch_cc.h deleted file mode 100644 index 4bf62c7ec6..0000000000 --- a/gnuradio-core/src/lib/general/gr_simple_squelch_cc.h +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#ifndef INCLUDED_GR_SIMPLE_SQUELCH_CC_H -#define INCLUDED_GR_SIMPLE_SQUELCH_CC_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gr_single_pole_iir.h> - -class gr_simple_squelch_cc; -typedef boost::shared_ptr<gr_simple_squelch_cc> gr_simple_squelch_cc_sptr; - -GR_CORE_API gr_simple_squelch_cc_sptr -gr_make_simple_squelch_cc (double threshold_db, double alpha = 0.0001); - -/*! - * \brief simple squelch block based on average signal power and threshold in dB. - * \ingroup level_blk - */ -class GR_CORE_API gr_simple_squelch_cc : public gr_sync_block -{ - double d_threshold; - gr_single_pole_iir<double,double,double> d_iir; - bool d_unmuted; - - friend GR_CORE_API gr_simple_squelch_cc_sptr - gr_make_simple_squelch_cc (double threshold_db, double alpha); - - gr_simple_squelch_cc (double threshold_db, double alpha); - -public: - ~gr_simple_squelch_cc (); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - bool unmuted () const { return d_unmuted; } - - void set_alpha (double alpha); - void set_threshold (double decibels); - - double threshold() const; - std::vector<float> squelch_range() const; - -}; - -#endif /* INCLUDED_GR_SIMPLE_SQUELCH_CC_H */ diff --git a/gnuradio-core/src/lib/general/gr_simple_squelch_cc.i b/gnuradio-core/src/lib/general/gr_simple_squelch_cc.i deleted file mode 100644 index 17b469e156..0000000000 --- a/gnuradio-core/src/lib/general/gr_simple_squelch_cc.i +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,simple_squelch_cc); - -gr_simple_squelch_cc_sptr -gr_make_simple_squelch_cc (double threshold_db, double alpha = 0.0001); - -class gr_simple_squelch_cc : public gr_sync_block -{ -public: - bool unmuted () const { return d_unmuted; } - void set_alpha (double alpha); - void set_threshold (double decibels); - - double threshold() const; - std::vector<float> squelch_range() const; -}; diff --git a/gnuradio-core/src/lib/general/gr_squelch_base_cc.cc b/gnuradio-core/src/lib/general/gr_squelch_base_cc.cc deleted file mode 100644 index b32a0a6954..0000000000 --- a/gnuradio-core/src/lib/general/gr_squelch_base_cc.cc +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2006 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_squelch_base_cc.h> -#include <gr_io_signature.h> - -gr_squelch_base_cc::gr_squelch_base_cc(const char *name, int ramp, bool gate) : - gr_block(name, - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(gr_complex))) -{ - set_ramp(ramp); - set_gate(gate); - d_state = ST_MUTED; - d_envelope = d_ramp ? 0.0 : 1.0; - d_ramped = 0; -} - -int gr_squelch_base_cc::general_work(int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const gr_complex *in = (const gr_complex *) input_items[0]; - gr_complex *out = (gr_complex *) output_items[0]; - - int j = 0; - - for (int i = 0; i < noutput_items; i++) { - update_state(in[i]); - - // Adjust envelope based on current state - switch(d_state) { - case ST_MUTED: - if (!mute()) - d_state = d_ramp ? ST_ATTACK : ST_UNMUTED; // If not ramping, go straight to unmuted - break; - - case ST_UNMUTED: - if (mute()) - d_state = d_ramp ? ST_DECAY : ST_MUTED; // If not ramping, go straight to muted - break; - - case ST_ATTACK: - d_envelope = 0.5-std::cos(M_PI*(++d_ramped)/d_ramp)/2.0; // FIXME: precalculate window for speed - if (d_ramped >= d_ramp) { // use >= in case d_ramp is set to lower value elsewhere - d_state = ST_UNMUTED; - d_envelope = 1.0; - } - break; - - case ST_DECAY: - d_envelope = 0.5-std::cos(M_PI*(--d_ramped)/d_ramp)/2.0; // FIXME: precalculate window for speed - if (d_ramped == 0.0) - d_state = ST_MUTED; - break; - }; - - // If unmuted, copy input times envelope to output - // Otherwise, if not gating, copy zero to output - if (d_state != ST_MUTED) - out[j++] = in[i]*gr_complex(d_envelope, 0.0); - else - if (!d_gate) - out[j++] = 0.0; - } - - consume_each(noutput_items); // Use all the inputs - return j; // But only report outputs copied -} diff --git a/gnuradio-core/src/lib/general/gr_squelch_base_cc.h b/gnuradio-core/src/lib/general/gr_squelch_base_cc.h deleted file mode 100644 index f1814473fb..0000000000 --- a/gnuradio-core/src/lib/general/gr_squelch_base_cc.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_SQUELCH_BASE_CC_H -#define INCLUDED_GR_SQUELCH_BASE_CC_H - -#include <gr_core_api.h> -#include <gr_block.h> - -class GR_CORE_API gr_squelch_base_cc : public gr_block -{ -private: - int d_ramp; - int d_ramped; - bool d_gate; - double d_envelope; - enum { ST_MUTED, ST_ATTACK, ST_UNMUTED, ST_DECAY } d_state; - -protected: - virtual void update_state(const gr_complex &sample) {}; - virtual bool mute() const { return false; }; - -public: - gr_squelch_base_cc(const char *name, int ramp, bool gate); - - int ramp() const { return d_ramp; } - void set_ramp(int ramp) { d_ramp = ramp; } - bool gate() const { return d_gate; } - void set_gate(bool gate) { d_gate = gate; } - bool unmuted() const { return (d_state == ST_UNMUTED || d_state == ST_ATTACK); } - - virtual std::vector<float> squelch_range() const = 0; - - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_SQUELCH_BASE_CC_H */ diff --git a/gnuradio-core/src/lib/general/gr_squelch_base_cc.i b/gnuradio-core/src/lib/general/gr_squelch_base_cc.i deleted file mode 100644 index 6501b7d2bf..0000000000 --- a/gnuradio-core/src/lib/general/gr_squelch_base_cc.i +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#include <gr_block.h> - -class gr_squelch_base_cc : public gr_block -{ -private: - enum { ST_MUTED, ST_ATTACK, ST_UNMUTED, ST_DECAY } d_state; - -public: - gr_squelch_base_cc(const char *name, int ramp, bool gate); - - int ramp() const { return d_ramp; } - void set_ramp(int ramp) { d_ramp = ramp; } - bool gate() const { return d_gate; } - void set_gate(bool gate) { d_gate = gate; } - bool unmuted() const { return (d_state == ST_UNMUTED || d_state == ST_ATTACK); } - - virtual std::vector<float> squelch_range() const = 0; -}; diff --git a/gnuradio-core/src/lib/general/gr_squelch_base_ff.cc b/gnuradio-core/src/lib/general/gr_squelch_base_ff.cc deleted file mode 100644 index 4bf8cff971..0000000000 --- a/gnuradio-core/src/lib/general/gr_squelch_base_ff.cc +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2006 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_squelch_base_ff.h> -#include <gr_io_signature.h> - -gr_squelch_base_ff::gr_squelch_base_ff(const char *name, int ramp, bool gate) : - gr_block(name, - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature(1, 1, sizeof(float))) -{ - set_ramp(ramp); - set_gate(gate); - d_state = ST_MUTED; - d_envelope = d_ramp ? 0.0 : 1.0; - d_ramped = 0; -} - -int gr_squelch_base_ff::general_work(int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const float *in = (const float *) input_items[0]; - float *out = (float *) output_items[0]; - - int j = 0; - - for (int i = 0; i < noutput_items; i++) { - update_state(in[i]); - - // Adjust envelope based on current state - switch(d_state) { - case ST_MUTED: - if (!mute()) - d_state = d_ramp ? ST_ATTACK : ST_UNMUTED; // If not ramping, go straight to unmuted - break; - - case ST_UNMUTED: - if (mute()) - d_state = d_ramp ? ST_DECAY : ST_MUTED; // If not ramping, go straight to muted - break; - - case ST_ATTACK: - d_envelope = 0.5-std::cos(M_PI*(++d_ramped)/d_ramp)/2.0; // FIXME: precalculate window for speed - if (d_ramped >= d_ramp) { // use >= in case d_ramp is set to lower value elsewhere - d_state = ST_UNMUTED; - d_envelope = 1.0; - } - break; - - case ST_DECAY: - d_envelope = 0.5-std::cos(M_PI*(--d_ramped)/d_ramp)/2.0; // FIXME: precalculate window for speed - if (d_ramped == 0.0) - d_state = ST_MUTED; - break; - }; - - // If unmuted, copy input times envelope to output - // Otherwise, if not gating, copy zero to output - if (d_state != ST_MUTED) - out[j++] = in[i]*d_envelope; - else - if (!d_gate) - out[j++] = 0.0; - } - - consume_each(noutput_items); // Use all the inputs - return j; // But only report outputs copied -} diff --git a/gnuradio-core/src/lib/general/gr_squelch_base_ff.h b/gnuradio-core/src/lib/general/gr_squelch_base_ff.h deleted file mode 100644 index eb52635b45..0000000000 --- a/gnuradio-core/src/lib/general/gr_squelch_base_ff.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_SQUELCH_BASE_FF_H -#define INCLUDED_GR_SQUELCH_BASE_FF_H - -#include <gr_core_api.h> -#include <gr_block.h> - -class GR_CORE_API gr_squelch_base_ff : public gr_block -{ -private: - int d_ramp; - int d_ramped; - bool d_gate; - double d_envelope; - enum { ST_MUTED, ST_ATTACK, ST_UNMUTED, ST_DECAY } d_state; - -protected: - virtual void update_state(const float &sample) {}; - virtual bool mute() const { return false; }; - -public: - gr_squelch_base_ff(const char *name, int ramp, bool gate); - - int ramp() const { return d_ramp; } - void set_ramp(int ramp) { d_ramp = ramp; } - bool gate() const { return d_gate; } - void set_gate(bool gate) { d_gate = gate; } - bool unmuted() const { return (d_state == ST_UNMUTED || d_state == ST_ATTACK); } - - virtual std::vector<float> squelch_range() const = 0; - - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_SQUELCH_BASE_FF_H */ diff --git a/gnuradio-core/src/lib/general/gr_squelch_base_ff.i b/gnuradio-core/src/lib/general/gr_squelch_base_ff.i deleted file mode 100644 index a4e5c7115c..0000000000 --- a/gnuradio-core/src/lib/general/gr_squelch_base_ff.i +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#include <gr_block.h> - -class gr_squelch_base_ff : public gr_block -{ -private: - enum { ST_MUTED, ST_ATTACK, ST_UNMUTED, ST_DECAY } d_state; - -public: - gr_squelch_base_ff(const char *name, int ramp, bool gate); - - int ramp() const { return d_ramp; } - void set_ramp(int ramp) { d_ramp = ramp; } - bool gate() const { return d_gate; } - void set_gate(bool gate) { d_gate = gate; } - bool unmuted() const { return (d_state == ST_UNMUTED || d_state == ST_ATTACK); } - - virtual std::vector<float> squelch_range() const = 0; -}; |