From e692e71305ecd71d3681fe37f3d76f350d67e276 Mon Sep 17 00:00:00 2001 From: jcorgan 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 --- gnuradio-examples/python/digital_voice/cvsd_test.py | 18 +++++++----------- gnuradio-examples/python/digital_voice/encdec.py | 12 ++++++------ 2 files changed, 13 insertions(+), 17 deletions(-) (limited to 'gnuradio-examples/python/digital_voice') diff --git a/gnuradio-examples/python/digital_voice/cvsd_test.py b/gnuradio-examples/python/digital_voice/cvsd_test.py index 843201d6e..f8f1b9cce 100755 --- a/gnuradio-examples/python/digital_voice/cvsd_test.py +++ b/gnuradio-examples/python/digital_voice/cvsd_test.py @@ -20,7 +20,7 @@ # Boston, MA 02110-1301, USA. # -from gnuradio import gr, blks +from gnuradio import gr, blks2 from gnuradio import audio from gnuradio.eng_option import eng_option from optparse import OptionParser @@ -41,25 +41,21 @@ def main(): parser.print_help() raise SystemExit, 1 - fg = gr.flow_graph() + tb = gr.top_block() src = audio.source(int(options.sample_rate), options.audio_input) - tx = blks.cvsd_encode(fg, options.resample_rate) + tx = blks2.cvsd_encode(options.resample_rate) # todo: add noise - rx = blks.cvsd_decode(fg, options.resample_rate) + rx = blks2.cvsd_decode(options.resample_rate) dst = audio.sink(int(options.sample_rate), options.audio_output) - fg.connect(src, tx, rx, dst) + tb.connect(src, tx, rx, dst) + tb.run() - fg.start() - - raw_input ('Press Enter to exit: ') - fg.stop() - - if __name__ == '__main__': + print "Enter CTRL-C to exit" try: main() except KeyboardInterrupt: diff --git a/gnuradio-examples/python/digital_voice/encdec.py b/gnuradio-examples/python/digital_voice/encdec.py index a2e9d1e49..e87d57e2b 100755 --- a/gnuradio-examples/python/digital_voice/encdec.py +++ b/gnuradio-examples/python/digital_voice/encdec.py @@ -20,15 +20,15 @@ # Boston, MA 02110-1301, USA. # -from gnuradio import gr, blks +from gnuradio import gr, blks2 from gnuradio import audio from gnuradio.eng_option import eng_option from optparse import OptionParser -class my_graph(gr.flow_graph): +class my_top_block(gr.top_block): def __init__(self): - gr.flow_graph.__init__(self) + gr.top_block.__init__(self) parser = OptionParser(option_class=eng_option) parser.add_option("-I", "--audio-input", type="string", default="", @@ -42,10 +42,10 @@ class my_graph(gr.flow_graph): sample_rate = 8000 src = audio.source(sample_rate, options.audio_input) - tx = blks.digital_voice_tx(self) + tx = blks2.digital_voice_tx(self) if_gain = gr.multiply_const_cc(10000) # channel simulator here... - rx = blks.digital_voice_rx(self) + rx = blks2.digital_voice_rx(self) dst = audio.sink(sample_rate, options.audio_output) self.connect(src, tx, if_gain, rx, dst) @@ -53,6 +53,6 @@ class my_graph(gr.flow_graph): if __name__ == '__main__': try: - my_graph().run() + my_top_block().run() except KeyboardInterrupt: pass -- cgit