discuss-gnuradio
[Top][All Lists]
Advanced

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

[Discuss-gnuradio] Re: Dynamically changing parameters of a block


From: Richard Jaeger
Subject: [Discuss-gnuradio] Re: Dynamically changing parameters of a block
Date: Sun, 28 Sep 2008 13:22:26 -0500

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....





reply via email to

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