summaryrefslogtreecommitdiff
path: root/gnuradio-examples/python/digital/rx_voice.py
diff options
context:
space:
mode:
authorjcorgan <jcorgan@221aa14e-8319-0410-a670-987f0aec2ac5>2007-09-18 18:59:00 +0000
committerjcorgan <jcorgan@221aa14e-8319-0410-a670-987f0aec2ac5>2007-09-18 18:59:00 +0000
commite692e71305ecd71d3681fe37f3d76f350d67e276 (patch)
treedc320c9261303aa9a92f4d12bdba85f82720d1bf /gnuradio-examples/python/digital/rx_voice.py
parent6ad04a094ced626e46c210b9847eae46a1ae8e67 (diff)
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
Diffstat (limited to 'gnuradio-examples/python/digital/rx_voice.py')
-rwxr-xr-xgnuradio-examples/python/digital/rx_voice.py29
1 files changed, 16 insertions, 13 deletions
diff --git a/gnuradio-examples/python/digital/rx_voice.py b/gnuradio-examples/python/digital/rx_voice.py
index c9c33c3d56..b3280d432c 100755
--- a/gnuradio-examples/python/digital/rx_voice.py
+++ b/gnuradio-examples/python/digital/rx_voice.py
@@ -31,6 +31,7 @@ from gnuradio.vocoder import gsm_full_rate
import random
import struct
+import sys
# from current dir
from receive_path import receive_path
@@ -41,27 +42,30 @@ import fusb_options
#raw_input('Attach and press enter')
-class audio_tx(gr.hier_block):
- def __init__(self, fg, audio_output_dev):
+class audio_tx(gr.hier_block2):
+ def __init__(self, audio_output_dev):
+ gr.hier_block2.__init__(self, "audio_tx",
+ gr.io_signature(0, 0, 0), # Input signature
+ gr.io_signature(0, 0, 0)) # Output signature
+
self.packet_src = gr.message_source(33)
voice_decoder = gsm_full_rate.decode_ps()
s2f = gr.short_to_float ()
sink_scale = gr.multiply_const_ff(1.0/32767.)
audio_sink = audio.sink(8000, audio_output_dev)
- fg.connect(self.packet_src, voice_decoder, s2f, sink_scale, audio_sink)
- gr.hier_block.__init__(self, fg, self.packet_src, audio_sink)
+ self.connect(self.packet_src, voice_decoder, s2f, sink_scale, audio_sink)
def msgq(self):
return self.packet_src.msgq()
-class my_graph(gr.flow_graph):
-
+class my_top_block(gr.top_block):
def __init__(self, demod_class, rx_callback, options):
- gr.flow_graph.__init__(self)
- self.rxpath = receive_path(self, demod_class, rx_callback, options)
- self.audio_tx = audio_tx(self, options.audio_output)
-
+ gr.top_block.__init__(self)
+ self.rxpath = receive_path(demod_class, rx_callback, options)
+ self.audio_tx = audio_tx(options.audio_output)
+ self.connect(self.rxpath)
+ self.connect(self.audio_tx)
# /////////////////////////////////////////////////////////////////////////////
# main
@@ -120,14 +124,13 @@ def main():
# build the graph
- fg = my_graph(demods[options.modulation], rx_callback, options)
+ tb = my_top_block(demods[options.modulation], rx_callback, options)
r = gr.enable_realtime_scheduling()
if r != gr.RT_OK:
print "Warning: Failed to enable realtime scheduling."
- fg.start() # start flow graph
- fg.wait() # wait for it to finish
+ tb.run()
if __name__ == '__main__':
try: