def __init__(self): gr.top_block.__init__(self, "Affinity Set Test") ################################################## # Variables ################################################## self.samp_rate = samp_rate = 32000 ################################################## # Blocks ################################################## vec_len = 1 self.blocks_throttle_0 = blocks.throttle(gr.sizeof_oc_complex*vec_len, samp_rate) self.blocks_null_source_0 = blocks.null_source(gr.sizeof_oc_complex*vec_len) self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_oc_complex*vec_len) self.filter_filt_0 = filter.fir_filter_ccc(1, 40000*[0.2+0.3j,]) self.filter_filt_1 = filter.fir_filter_ccc(1, 40000*[0.2+0.3j,]) self.filter_filt_0.set_processor_affinity([0,]) self.filter_filt_1.set_processor_affinity([0,1]) ################################################## # Connections ################################################## self.connect((self.blocks_null_source_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.filter_filt_0, 0)) self.connect((self.filter_filt_0, 0), (self.filter_filt_1, 0)) self.connect((self.filter_filt_1, 0), (self.blocks_null_sink_0, 0))
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)