summaryrefslogtreecommitdiff
path: root/gr-analog/lib/squelch_base_ff_impl.h
blob: 3e9128d152ca255a4bbbac607ea8e552b9817c10 (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
48
49
50
51
52
53
54
55
56
/* -*- c++ -*- */
/*
 * Copyright 2006,2012 Free Software Foundation, Inc.
 *
 * This file is part of GNU Radio
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 *
 */

#ifndef INCLUDED_GR_SQUELCH_BASE_FF_IMPL_H
#define INCLUDED_GR_SQUELCH_BASE_FF_IMPL_H

#include <gnuradio/analog/squelch_base_ff.h>
#include <pmt/pmt.h>

namespace gr {
namespace analog {

class squelch_base_ff_impl : public squelch_base_ff
{
private:
    int d_ramp;
    int d_ramped;
    bool d_gate;
    double d_envelope;
    enum { ST_MUTED, ST_ATTACK, ST_UNMUTED, ST_DECAY } d_state;
    const pmt::pmt_t d_sob_key, d_eob_key;
    bool d_tag_next_unmuted;

protected:
    void update_state(const float& sample) override{};
    bool mute() const override { return false; };

public:
    squelch_base_ff_impl(const char* name, int ramp, bool gate);
    ~squelch_base_ff_impl() override;

    int ramp() const override;
    void set_ramp(int ramp) override;
    bool gate() const override;
    void set_gate(bool gate) override;
    bool unmuted() const override;

    std::vector<float> squelch_range() const override = 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) override;
};

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

#endif /* INCLUDED_ANALOG_SQUELCH_BASE_IMPL_FF_H */