def __init__(self, host, port, pkt_size, sample_rate, eof): gr.top_block.__init__(self, "dial_tone_source") amplitude = 0.3 src0 = analog.sig_source_f(sample_rate, analog.OC_SIN_WAVE, 350, amplitude) src1 = analog.sig_source_f(sample_rate, analog.OC_SIN_WAVE, 440, amplitude) add = blocks.add_ff() # Throttle needed here to account for the other side's audio card sampling rate thr = blocks.throttle(gr.sizeof_float, sample_rate) sink = blocks.udp_sink(gr.sizeof_float, host, port, pkt_size, eof=eof) self.connect(src0, (add, 0)) self.connect(src1, (add, 1)) self.connect(add, thr, sink)
def add_ff(N): op = blocks.add_ff() tb = helper(N, op, gr.sizeof_float, gr.sizeof_float, 2, 1) return tb