discuss-gnuradio
[Top][All Lists]
Advanced

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

[Discuss-gnuradio] __int__ , self in dial tone


From: Quenton Bonds
Subject: [Discuss-gnuradio] __int__ , self in dial tone
Date: Fri, 14 Jul 2006 09:44:19 -0700
User-agent: Thunderbird 1.5.0.2 (Macintosh/20060308)

Hello
In an effort to understand the GNU python programming instance, I am trying to 
create an instance of the flow graph in the dial_tone example (codeA) just to make 
sure I understand how instancing works. 
I did this below in ,'mycodeA, but the program did not work.
What am I missing?
This was done in the FM receiver example, i just listed it below(codeB) as a quick reference.  

codeA-------------------------------------------------------------------------
def build_graph ():
    sampling_freq = 32000
    ampl = 0.1

    fg = gr.flow_graph ()
    src0 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE, 350, ampl)
    src1 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE, 440, ampl)
    dst = audio.sink (sampling_freq)
    fg.connect (src0, (dst, 0))
    fg.connect (src1, (dst, 1))
-------------------------------------------------------------------------------

mycodeA-----------------------------------------------------------------------------------------------------------------
def build_graph ():
    sampling_freq = 32000
    ampl = 0.1

    gr.flow_graph (self)
    src0 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE, 350, ampl)
    src1 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE, 440, ampl)
    dst = audio.sink (sampling_freq)
    self.connect (src0, (dst, 0))
    self.connect (src1, (dst, 1))
-------------------------------------------------------------------------------


codeB---------------------------------------------------------------------------------------------------------------------
class wfm_rx_graph (stdgui.gui_flow_graph):
    def __init__(self,frame,panel,vbox,argv):
        stdgui.gui_flow_graph.__init__ (self,frame,panel,vbox,argv)

IF_freq = parseargs(argv[1:])
        adc_rate = 64e6

        decim = 250
        quad_rate = adc_rate / decim               # 256 kHz
        audio_decimation = 8
        audio_rate = quad_rate / audio_decimation  # 32 kHz

        # usrp is data source
        src = usrp.source_c (0, decim)
        src.set_rx_freq (0, IF_freq)
        src.set_pga(0,20)

        guts = blks.wfm_rcv (self, quad_rate, audio_decimation)

        # sound card as final sink
        audio_sink = audio.sink (int (audio_rate))

        # now wire it all together
        self.connect (src, guts)
       self.connect (guts, (audio_sink, 0)
--------------------------------------------------------------------------------

reply via email to

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