summaryrefslogtreecommitdiff
path: root/gr-analog/lib/simple_squelch_cc_impl.h
blob: 6764797b4b27077d15e1c966a9251f41231da6dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/* -*- c++ -*- */
/*
 * Copyright 2005,2012 Free Software Foundation, Inc.
 *
 * This file is part of GNU Radio
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 *
 */

#ifndef INCLUDED_ANALOG_SIMPLE_SQUELCH_CC_IMPL_H
#define INCLUDED_ANALOG_SIMPLE_SQUELCH_CC_IMPL_H

#include <gnuradio/analog/simple_squelch_cc.h>
#include <gnuradio/filter/single_pole_iir.h>

namespace gr {
namespace analog {

class simple_squelch_cc_impl : public simple_squelch_cc
{
private:
    double d_threshold;
    bool d_unmuted;
    filter::single_pole_iir<double, double, double> d_iir;

public:
    simple_squelch_cc_impl(double threshold_db, double alpha);
    ~simple_squelch_cc_impl() override;

    bool unmuted() const override { return d_unmuted; }

    void set_alpha(double alpha) override;
    void set_threshold(double decibels) override;

    double threshold() const override;
    std::vector<float> squelch_range() const override;

    int work(int noutput_items,
             gr_vector_const_void_star& input_items,
             gr_vector_void_star& output_items) override;
};

} /* namespace analog */
} /* namespace gr */

#endif /* INCLUDED_ANALOG_SIMPLE_SQUELCH_CC_IMPL_H */