[Peak Detector]

- added callbacks for dynamic parameter change

git-svn-id: http://moon:8086/svn/software/trunk/projects/GnuRadio@535 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
2019-06-01 09:38:51 +00:00
parent 560e8f95ec
commit a4626e99fc
4 changed files with 68 additions and 3 deletions
+45 -3
View File
@@ -48,8 +48,8 @@ namespace gr {
, m_fcenter (fcenter)
, m_peak_thresh (peak_thresh)
, m_peak_hysteresis (peak_hysteresis)
, m_peak_width_min ((int)((float)m_vlen/bandwidth*peak_width_min + 0.5f))
, m_peak_width_max ((int)((float)m_vlen/bandwidth*peak_width_max + 0.5f))
, m_peak_width_min ((int)((float)m_vlen/m_bandwidth*peak_width_min + 0.5f))
, m_peak_width_max ((int)((float)m_vlen/m_bandwidth*peak_width_max + 0.5f))
, m_alpha_s (alpha_s)
, m_alpha_m(alpha_m)
, m_frameCount(0)
@@ -96,7 +96,49 @@ namespace gr {
delete [] m_pXm;
delete [] m_pXs;
delete [] m_pX;
}
}
void peak_detect_impl::set_bandwidth(float bandwidth_Hz)
{
boost::mutex::scoped_lock guard(m_mutex);
m_bandwidth = bandwidth_Hz;
fprintf(stderr, "set_bandwidth(%f)\n", bandwidth_Hz);
}
void peak_detect_impl::set_centerFrequency(float freq_Hz)
{
boost::mutex::scoped_lock guard(m_mutex);
m_fcenter = freq_Hz;
fprintf(stderr, "set_centerFrequency(%f)\n", freq_Hz);
}
void peak_detect_impl::set_peakThresh(float thresh_dB)
{
boost::mutex::scoped_lock guard(m_mutex);
m_peak_thresh = thresh_dB;
fprintf(stderr, "set_peakThresh(%f)\n", thresh_dB);
}
void peak_detect_impl::set_peakHysteresis(float hysteresis_dB)
{
boost::mutex::scoped_lock guard(m_mutex);
fprintf(stderr, "set_peakHysteresis(%f)\n", hysteresis_dB);
m_peak_hysteresis = hysteresis_dB;
}
void peak_detect_impl::set_peakWidthMin(float width_Hz)
{
boost::mutex::scoped_lock guard(m_mutex);
fprintf(stderr, "set_peakWidthMin(%f)\n", width_Hz);
m_peak_width_min = (int)((float)m_vlen/m_bandwidth*width_Hz + 0.5f);
}
void peak_detect_impl::set_peakWidthMax(float width_Hz)
{
boost::mutex::scoped_lock guard(m_mutex);
fprintf(stderr, "set_peakWidthMax(%f)\n", width_Hz);
m_peak_width_max = (int)((float)m_vlen/m_bandwidth*width_Hz + 0.5f);
}
float peak_detect_impl::mean(float* pSrc, int length)
{