commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] [gnuradio] 02/16: analog: Moved CTCSS squelch FFT para


From: git
Subject: [Commit-gnuradio] [gnuradio] 02/16: analog: Moved CTCSS squelch FFT parameter calculations
Date: Sun, 29 Mar 2015 02:27:25 +0000 (UTC)

This is an automated email from the git hooks/post-receive script.

jcorgan pushed a commit to branch master
in repository gnuradio.

commit 47320cf0dfdd6a4294d60ec3b704dd3a0f33023b
Author: Jon Szymaniak <address@hidden>
Date:   Tue Feb 3 14:05:16 2015 -0500

    analog: Moved CTCSS squelch FFT parameter calculations
    
    This routine will be re-used in an upcoming commit, so it has been
    moved to a private method.
---
 gr-analog/lib/ctcss_squelch_ff_impl.cc | 33 ++++++++++++++++++++-------------
 gr-analog/lib/ctcss_squelch_ff_impl.h  |  1 +
 2 files changed, 21 insertions(+), 13 deletions(-)

diff --git a/gr-analog/lib/ctcss_squelch_ff_impl.cc 
b/gr-analog/lib/ctcss_squelch_ff_impl.cc
index 7714da3..a82ca46 100644
--- a/gr-analog/lib/ctcss_squelch_ff_impl.cc
+++ b/gr-analog/lib/ctcss_squelch_ff_impl.cc
@@ -55,6 +55,25 @@ namespace gr {
       return -1;
     }
 
+    void
+    ctcss_squelch_ff_impl::compute_freqs(const float &freq,
+                                         float &f_l, float &f_r)
+    {
+      int i = find_tone(freq);
+
+      // Non-standard tones or edge tones get 2% guard band, otherwise
+      // guards are set at adjacent ctcss tone frequencies
+      if(i == -1 || i == 0)
+       f_l = freq*0.98;
+      else
+       f_l = ctcss_tones[i-1];
+
+      if(i == -1 || i == max_tone_index)
+       f_r = freq*1.02;
+      else
+       f_r = ctcss_tones[i+1];
+    }
+
     ctcss_squelch_ff_impl::ctcss_squelch_ff_impl(int rate, float freq, float 
level,
                                                 int len, int ramp, bool gate)
       :        block("ctcss_squelch_ff",
@@ -71,20 +90,8 @@ namespace gr {
       else
        d_len = len;
 
-      int i = find_tone(freq);
-
-      // Non-standard tones or edge tones get 2% guard band, otherwise
-      // guards are set at adjacent ctcss tone frequencies
       float f_l, f_r;
-      if(i == -1 || i == 0)
-       f_l = freq*0.98;
-      else
-       f_l = ctcss_tones[i-1];
-
-      if(i == -1 || i == max_tone_index)
-       f_r = freq*1.02;
-      else
-       f_r = ctcss_tones[i+1];
+      compute_freqs(d_freq, f_l, f_r);
 
       d_goertzel_l = new fft::goertzel(rate, d_len, f_l);
       d_goertzel_c = new fft::goertzel(rate, d_len, freq);
diff --git a/gr-analog/lib/ctcss_squelch_ff_impl.h 
b/gr-analog/lib/ctcss_squelch_ff_impl.h
index ee0cfa7..6a137e0 100644
--- a/gr-analog/lib/ctcss_squelch_ff_impl.h
+++ b/gr-analog/lib/ctcss_squelch_ff_impl.h
@@ -43,6 +43,7 @@ namespace gr {
       fft::goertzel *d_goertzel_r;
 
       static int find_tone(float freq);
+      static void compute_freqs(const float &freq, float &f_l, float &f_r);
 
     protected:
       virtual void update_state(const float &in);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]