Re: Dynamically changing parameters of a block

Karthik:

Here are some code segments that I borrowed and put together from
several of the gnu-radio examples.

#Complex Multiply Block

self.mc_2 = gr.multiply_const_cc(gain_2)
.
.

#Gain Control Slider

myform[‘Gain 2’] =
form.quantized_slider_field(parent=self.panel, sizer=hbox,
label = “Gain 2”,
weight=3, range=(-20, 20, .2),
callback=self.set_gain_2)
.
.

#Gain Control

def set_gain_2 (self, gain):
gain = max(-20, min(20, gain))
gain_2 = 10**(gain/20)
self.mc_2.set_k(gain_2)

These seem to work in my application, although I’m just learning Python.
Anytime the gain control slider changes, the gain is updated.

RCJ…

On Sun, Sep 28, 2008 at 11:22 AM, Richard J.
[email protected] wrote:

RCJ…

Thanks to everyone for answering. I had forgotten that I could use the
public member functions in a block to dynamically change the block
behavior, thanks for pointing that out.

Regards,
Karthik