From e692e71305ecd71d3681fe37f3d76f350d67e276 Mon Sep 17 00:00:00 2001
From: jcorgan <jcorgan@221aa14e-8319-0410-a670-987f0aec2ac5>
Date: Tue, 18 Sep 2007 18:59:00 +0000
Subject: Merge r6461:6464 from jcorgan/t162-staging into trunk.

* Final gr.top_block and gr.hier_block2 implementation inside
  gnuradio-core/src/lib/runtime

* Implementation of gr.hier_block2 versions of all the old-style blocks
  in blks.  These live in blks2.

* Addition of gr.hier_block2 based versions of gr-wxgui blocks

* Conversion of all the example code in gnuradio-examples to use this
  new code

* Conversion of all the gr-utils scripts to use the new code

The OFDM examples and related hierarchical blocks have not yet been
converted.  Code in the rest of the tree that is outside the core
and example components has also not yet been converted.



git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@6466 221aa14e-8319-0410-a670-987f0aec2ac5
---
 gr-cvsd-vocoder/src/python/cvsd.py | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

(limited to 'gr-cvsd-vocoder/src/python/cvsd.py')

diff --git a/gr-cvsd-vocoder/src/python/cvsd.py b/gr-cvsd-vocoder/src/python/cvsd.py
index a69c783a9b..4defbf9a25 100644
--- a/gr-cvsd-vocoder/src/python/cvsd.py
+++ b/gr-cvsd-vocoder/src/python/cvsd.py
@@ -23,7 +23,7 @@
 from gnuradio import gr
 from gnuradio.vocoder import cvsd_vocoder
 
-class cvsd_encode(gr.hier_block):
+class cvsd_encode(gr.hier_block2):
     '''
     This is a wrapper for the CVSD encoder that performs interpolation and filtering
     necessary to work with the vocoding. It converts an incoming float (+-1) to a short, scales
@@ -33,11 +33,16 @@ class cvsd_encode(gr.hier_block):
     higher the interpolation rate are, the better the sound quality.
     '''
     
-    def __init__(self, fg, resample=8, bw=0.5):
+    def __init__(self, resample=8, bw=0.5):
         '''
         When using the CVSD vocoder, appropriate sampling rates are from 8k to 64k with resampling rates
         from 1 to 8. A rate of 8k with a resampling rate of 8 provides a good quality signal.
         '''
+
+	gr.hier_block2.__init__(self, "cvsd_encode",
+				gr.io_signature(1, 1, gr.sizeof_float), # Input signature
+				gr.io_signature(1, 1, gr.sizeof_char))  # Output signature
+
         scale_factor = 32000.0
         self.interp = resample
 
@@ -47,11 +52,10 @@ class cvsd_encode(gr.hier_block):
         f2s = gr.float_to_short()
         enc = cvsd_vocoder.encode_sb()
 
-        fg.connect(src_scale, interp, f2s, enc)
-        gr.hier_block.__init__(self, fg, src_scale, enc)
+        self.connect(self, src_scale, interp, f2s, enc, self)
 
 
-class cvsd_decode(gr.hier_block):
+class cvsd_decode(gr.hier_block2):
     '''
     This is a wrapper for the CVSD decoder that performs decimation and filtering
     necessary to work with the vocoding. It converts an incoming CVSD-encoded short to a float, decodes it
@@ -61,11 +65,15 @@ class cvsd_decode(gr.hier_block):
     higher the interpolation rate are, the better the sound quality.
     '''
 
-    def __init__(self, fg, resample=8, bw=0.5):
+    def __init__(self, resample=8, bw=0.5):
         '''
         When using the CVSD vocoder, appropriate sampling rates are from 8k to 64k with resampling rates
         from 1 to 8. A rate of 8k with a resampling rate of 8 provides a good quality signal.
         '''
+	gr.hier_block2.__init__(self, "cvsd_decode",
+				gr.io_signature(1, 1, gr.sizeof_char),  # Input signature
+				gr.io_signature(1, 1, gr.sizeof_float)) # Output signature
+
         scale_factor = 32000.0
         self.decim = resample
 
@@ -75,6 +83,5 @@ class cvsd_decode(gr.hier_block):
         decim = gr.fir_filter_fff(self.decim, taps)
         sink_scale = gr.multiply_const_ff(1.0/scale_factor)
 
-        fg.connect(dec, s2f, decim, sink_scale)
-        gr.hier_block.__init__(self, fg, dec, sink_scale)
+        self.connect(self, dec, s2f, decim, sink_scale, self)
 
-- 
cgit v1.2.3