commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r4290 - gnuradio/branches/developers/trondeau/ethernet


From: trondeau
Subject: [Commit-gnuradio] r4290 - gnuradio/branches/developers/trondeau/ethernet/gnuradio-examples/python/hier/networking
Date: Thu, 18 Jan 2007 07:34:44 -0700 (MST)

Author: trondeau
Date: 2007-01-18 07:34:43 -0700 (Thu, 18 Jan 2007)
New Revision: 4290

Modified:
   
gnuradio/branches/developers/trondeau/ethernet/gnuradio-examples/python/hier/networking/dial_tone_source.py
   
gnuradio/branches/developers/trondeau/ethernet/gnuradio-examples/python/hier/networking/vector_source.py
Log:
added throttle to sources to keep packet loss down

Modified: 
gnuradio/branches/developers/trondeau/ethernet/gnuradio-examples/python/hier/networking/dial_tone_source.py
===================================================================
--- 
gnuradio/branches/developers/trondeau/ethernet/gnuradio-examples/python/hier/networking/dial_tone_source.py
 2007-01-17 22:47:16 UTC (rev 4289)
+++ 
gnuradio/branches/developers/trondeau/ethernet/gnuradio-examples/python/hier/networking/dial_tone_source.py
 2007-01-18 14:34:43 UTC (rev 4290)
@@ -25,27 +25,29 @@
 from optparse import OptionParser
 
 class dial_tone_source(gr.hier_block2):
-    def __init__(self, local_ipaddress, remote_ipaddress, port, mtu):
+    def __init__(self, local_ipaddress, remote_ipaddress, port, mtu, 
sample_rate):
         gr.hier_block2.__init__(self, 
                                 "dial_tone_source",    # Block type 
                                 gr.io_signature(0,0,0), # Input signature
                                 gr.io_signature(0,0,0)) # Output signature
 
-        sample_rate = 32000
         amplitude = 0.3
         self.define_component("src0", gr.sig_source_f (sample_rate, 
gr.GR_SIN_WAVE,
                                                        350, amplitude))
         self.define_component("src1", gr.sig_source_f (sample_rate, 
gr.GR_SIN_WAVE,
                                                        440, amplitude))
         self.define_component("add", gr.add_ff())
-        self.define_component("dst",  gr.udp_sink(gr.sizeof_float,
+
+       self.define_component("thr", gr.throttle(gr.sizeof_float, sample_rate))
+       self.define_component("dst",  gr.udp_sink(gr.sizeof_float,
                                                   local_ipaddress, 0,
                                                   remote_ipaddress, port,
                                                   mtu))
         
         self.connect("src0", 0, "add", 0)      
         self.connect("src1", 0, "add", 1)
-       self.connect("add", 0, "dst", 0)
+       self.connect("add", 0, "thr", 0)
+       self.connect("thr", 0, "dst", 0)
 
 if __name__ == '__main__':
     parser = OptionParser(option_class=eng_option)
@@ -57,6 +59,8 @@
                       help="port value to connect to")
     parser.add_option("", "--mtu", type="int", default=540,
                      help="packet size.")
+    parser.add_option("-r", "--sample-rate", type="int", default=8000,
+                    help="audio signal sample rate [default=%default]")
     (options, args) = parser.parse_args()
     if len(args) != 0:
         parser.print_help()
@@ -64,7 +68,7 @@
 
     # Create an instance of a hierarchical block
     top_block = dial_tone_source(options.local_ipaddr, options.remote_ipaddr,
-                                 options.remote_port, options.mtu)
+                                 options.remote_port, options.mtu, 
options.sample_rate)
     
     # Create an instance of a runtime, passing it the top block
     runtime = gr.runtime(top_block)

Modified: 
gnuradio/branches/developers/trondeau/ethernet/gnuradio-examples/python/hier/networking/vector_source.py
===================================================================
--- 
gnuradio/branches/developers/trondeau/ethernet/gnuradio-examples/python/hier/networking/vector_source.py
    2007-01-17 22:47:16 UTC (rev 4289)
+++ 
gnuradio/branches/developers/trondeau/ethernet/gnuradio-examples/python/hier/networking/vector_source.py
    2007-01-18 14:34:43 UTC (rev 4290)
@@ -33,12 +33,14 @@
 
         data = [i*0.1 for i in range(1000)]
         self.define_component("data", gr.vector_source_f(data, True))
+       self.define_component("thr", gr.throttle(gr.sizeof_float, 8000))
 
         udp = gr.udp_sink(gr.sizeof_float, local_ipaddress, 0,
                           remote_ipaddress, port, mtu)
         self.define_component("dst",  udp)
 
-        self.connect("data", 0, "dst", 0)
+        self.connect("data", 0, "thr", 0)
+       self.connect("thr", 0, "dst", 0)
 
 if __name__ == '__main__':
     parser = OptionParser(option_class=eng_option)





reply via email to

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