diff --git a/gr-jay/grc/jay_squelch.xml b/gr-jay/grc/jay_squelch.xml
index e5b50bb..df01398 100644
--- a/gr-jay/grc/jay_squelch.xml
+++ b/gr-jay/grc/jay_squelch.xml
@@ -4,13 +4,19 @@
jay_squelch
[jay]
import jay
- jay.squelch($initValue)
+ jay.squelch($initValue, $alpha)
Initial Value
initValue
0.0
float
+
+ Alpha
+ alpha
+ 0.01
+ float
+
control
message
diff --git a/gr-jay/include/jay/squelch.h b/gr-jay/include/jay/squelch.h
index 523b509..6cb62a0 100644
--- a/gr-jay/include/jay/squelch.h
+++ b/gr-jay/include/jay/squelch.h
@@ -46,7 +46,7 @@ namespace gr {
* class. jay::squelch::make is the public interface for
* creating new instances.
*/
- static sptr make(float initValue);
+ static sptr make(float initValue, float alpha);
};
} // namespace jay
diff --git a/gr-jay/lib/squelch_impl.cc b/gr-jay/lib/squelch_impl.cc
index d9a438e..dc5a89b 100644
--- a/gr-jay/lib/squelch_impl.cc
+++ b/gr-jay/lib/squelch_impl.cc
@@ -30,22 +30,23 @@ namespace gr {
namespace jay {
squelch::sptr
- squelch::make(float initValue)
+ squelch::make(float initValue, float alpha)
{
return gnuradio::get_initial_sptr
- (new squelch_impl(initValue));
+ (new squelch_impl(initValue, alpha));
}
/*
* The private constructor
*/
- squelch_impl::squelch_impl(float initValue)
+ squelch_impl::squelch_impl(float initValue, float alpha)
: gr::sync_block("squelch",
gr::io_signature::make(1, 1, sizeof(float)),
gr::io_signature::make(1, 1, sizeof(float)))
, m_gain_target(initValue)
, m_gain(0.0f)
+ , m_alpha(alpha)
{
m_msg_port_in = pmt::mp("control");
message_port_register_in(m_msg_port_in);
@@ -120,7 +121,7 @@ namespace gr {
const float *in = (const float *) input_items[0];
float *out = (float *) output_items[0];
- m_gain = 0.99f*m_gain + 0.01f*m_gain_target;
+ m_gain = (1.f-m_alpha)*m_gain + m_alpha*m_gain_target;
// Do <+signal processing+>
for (int i=0; i < noutput_items; i++)
diff --git a/gr-jay/lib/squelch_impl.h b/gr-jay/lib/squelch_impl.h
index 68e016b..70e8588 100644
--- a/gr-jay/lib/squelch_impl.h
+++ b/gr-jay/lib/squelch_impl.h
@@ -33,9 +33,10 @@ namespace gr {
pmt::pmt_t m_msg_port_in;
float m_gain_target;
float m_gain;
-
+ float m_alpha;
+
public:
- squelch_impl(float initValue);
+ squelch_impl(float initValue, float alpha);
~squelch_impl();
void print_pair(pmt::pmt_t pair);
void on_message(pmt::pmt_t msg);
diff --git a/peak_det_eval.grc b/peak_det_eval.grc
index ed3ad39..d8905a1 100644
--- a/peak_det_eval.grc
+++ b/peak_det_eval.grc
@@ -2420,6 +2420,10 @@
jay_squelch
+
+ alpha
+ 0.01
+
alias