[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:
@@ -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)
|
||||
{
|
||||
|
||||
@@ -262,6 +262,8 @@ namespace jay {
|
||||
};
|
||||
|
||||
private:
|
||||
boost::mutex m_mutex;
|
||||
|
||||
void check_pair(pmt::pmt_t pair)
|
||||
{
|
||||
pmt::pmt_t key = pmt::car(pair);
|
||||
@@ -360,6 +362,14 @@ namespace jay {
|
||||
float mean(float *pSrc, int length);
|
||||
std::vector<int> findPeakPos(float* pSrc, int length, float thresh);
|
||||
|
||||
// Callbacks
|
||||
void set_bandwidth(float bandwidth_Hz) override;
|
||||
void set_centerFrequency(float freq_Hz) override;
|
||||
void set_peakThresh(float thresh_dB) override;
|
||||
void set_peakHysteresis(float hysteresis_dB) override;
|
||||
void set_peakWidthMin(float width_Hz) override;
|
||||
void set_peakWidthMax(float width_Hz) override;
|
||||
|
||||
void sort(std::vector<Peak>&peaks)
|
||||
{
|
||||
int n = peaks.size();
|
||||
|
||||
Reference in New Issue
Block a user