- added alpha to s quelch
git-svn-id: http://moon:8086/svn/software/trunk/projects/GnuRadio@519 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
@@ -4,13 +4,19 @@
|
|||||||
<key>jay_squelch</key>
|
<key>jay_squelch</key>
|
||||||
<category>[jay]</category>
|
<category>[jay]</category>
|
||||||
<import>import jay</import>
|
<import>import jay</import>
|
||||||
<make>jay.squelch($initValue)</make>
|
<make>jay.squelch($initValue, $alpha)</make>
|
||||||
<param>
|
<param>
|
||||||
<name>Initial Value</name>
|
<name>Initial Value</name>
|
||||||
<key>initValue</key>
|
<key>initValue</key>
|
||||||
<value>0.0</value>
|
<value>0.0</value>
|
||||||
<type>float</type>
|
<type>float</type>
|
||||||
</param>
|
</param>
|
||||||
|
<param>
|
||||||
|
<name>Alpha</name>
|
||||||
|
<key>alpha</key>
|
||||||
|
<value>0.01</value>
|
||||||
|
<type>float</type>
|
||||||
|
</param>
|
||||||
<sink>
|
<sink>
|
||||||
<name>control</name>
|
<name>control</name>
|
||||||
<type>message</type>
|
<type>message</type>
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ namespace gr {
|
|||||||
* class. jay::squelch::make is the public interface for
|
* class. jay::squelch::make is the public interface for
|
||||||
* creating new instances.
|
* creating new instances.
|
||||||
*/
|
*/
|
||||||
static sptr make(float initValue);
|
static sptr make(float initValue, float alpha);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace jay
|
} // namespace jay
|
||||||
|
|||||||
@@ -30,22 +30,23 @@ namespace gr {
|
|||||||
namespace jay {
|
namespace jay {
|
||||||
|
|
||||||
squelch::sptr
|
squelch::sptr
|
||||||
squelch::make(float initValue)
|
squelch::make(float initValue, float alpha)
|
||||||
{
|
{
|
||||||
return gnuradio::get_initial_sptr
|
return gnuradio::get_initial_sptr
|
||||||
(new squelch_impl(initValue));
|
(new squelch_impl(initValue, alpha));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The private constructor
|
* The private constructor
|
||||||
*/
|
*/
|
||||||
|
|
||||||
squelch_impl::squelch_impl(float initValue)
|
squelch_impl::squelch_impl(float initValue, float alpha)
|
||||||
: gr::sync_block("squelch",
|
: gr::sync_block("squelch",
|
||||||
gr::io_signature::make(1, 1, sizeof(float)),
|
gr::io_signature::make(1, 1, sizeof(float)),
|
||||||
gr::io_signature::make(1, 1, sizeof(float)))
|
gr::io_signature::make(1, 1, sizeof(float)))
|
||||||
, m_gain_target(initValue)
|
, m_gain_target(initValue)
|
||||||
, m_gain(0.0f)
|
, m_gain(0.0f)
|
||||||
|
, m_alpha(alpha)
|
||||||
{
|
{
|
||||||
m_msg_port_in = pmt::mp("control");
|
m_msg_port_in = pmt::mp("control");
|
||||||
message_port_register_in(m_msg_port_in);
|
message_port_register_in(m_msg_port_in);
|
||||||
@@ -120,7 +121,7 @@ namespace gr {
|
|||||||
const float *in = (const float *) input_items[0];
|
const float *in = (const float *) input_items[0];
|
||||||
float *out = (float *) output_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+>
|
// Do <+signal processing+>
|
||||||
for (int i=0; i < noutput_items; i++)
|
for (int i=0; i < noutput_items; i++)
|
||||||
|
|||||||
@@ -33,9 +33,10 @@ namespace gr {
|
|||||||
pmt::pmt_t m_msg_port_in;
|
pmt::pmt_t m_msg_port_in;
|
||||||
float m_gain_target;
|
float m_gain_target;
|
||||||
float m_gain;
|
float m_gain;
|
||||||
|
float m_alpha;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
squelch_impl(float initValue);
|
squelch_impl(float initValue, float alpha);
|
||||||
~squelch_impl();
|
~squelch_impl();
|
||||||
void print_pair(pmt::pmt_t pair);
|
void print_pair(pmt::pmt_t pair);
|
||||||
void on_message(pmt::pmt_t msg);
|
void on_message(pmt::pmt_t msg);
|
||||||
|
|||||||
@@ -2420,6 +2420,10 @@
|
|||||||
</block>
|
</block>
|
||||||
<block>
|
<block>
|
||||||
<key>jay_squelch</key>
|
<key>jay_squelch</key>
|
||||||
|
<param>
|
||||||
|
<key>alpha</key>
|
||||||
|
<value>0.01</value>
|
||||||
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<key>alias</key>
|
<key>alias</key>
|
||||||
<value></value>
|
<value></value>
|
||||||
|
|||||||
Reference in New Issue
Block a user