I was wondering if it's possible to stop a processing graph, swap one of its blocks with another with the same number of input/output channels and data types, and restart it, without tearing down the entire graph? So for example:
MAX = 10000
class my_top_block(gr.top_block):
def __init__(self, peak_hold=80):
gr.top_block.__init__(self)
self.sample_rate = 10e3
self.s = gr.noise_source_f (gr.GR_UNIFORM, MAX)
u = foo.peak_fv (MAX, peak_hold)
self.connect(s, u)
self.v = foo.wait_vv ()
self.connect(u, v)
self.t = gr.null_sink (4 * 1024)
self.connect(v, t)
def set_peak_record(self, record, peak_hold=80):
self.stop()
if record == True:
u = foo.peak_record_fv (MAX, peak_hold)
else:
u = foo.peak_fv (MAX, peak_hold)
self.connect(self.s, u)
self.connect(u, self.v)
self.start()
This is somewhat contrived, but I hope it illustrates my question. Thank you!