About gr.buffer

Hi every one,
Now I am trying to use gr.buffer. I wrote some very simple codes to
test how to use gr.buffer correctly. The main codes are as below:
self.u=gr.sig_source_c(1e4,gr.GR_SIN_WAVE,1e3,1) #to
create a sin source
self.buf=gr.buffer(1000,gr.sizeof_gr_complex,self.u)
#create a buffer by applying gr.buffer
self.csink=gr.vector_sink_c()

self.connect(self.buf,self.csink)
#send buffer volume to the sink

But unfortunately, I got a despondent error reply says: in method
‘buffer’, argument 3 of type ‘gr_block_sptr’. I looked up the gr_buffer
class and found that the so called argument 3 is a link to a block which
writes data to this buffer. As my understanding, the sig_source block
should write data to the buffer so I write self.buf as above way. From
the error hint, I ever thought perhaps the error just comes from the
incorrect type. Because the sin_source object is pointed by the pointer
type of “gr_sin_source_c_sptr”. But how can I get an object that merely
inherited from gr.block class? I tried to construct a class inherits
from gr.block but there exists another error says that "‘module’ object
has no attribute ‘block’ ".
I checked the internet but found nothing helpful. A surprising fact is
that looks no one ever used gr.buffer in gnuradio by adopting python
way. Is there anybody know how to use it correctly?
Your instruction is fairly appreciated.

Br,
Zhonghua

On Thu, Sep 22, 2011 at 10:11 AM, Zhonghua [email protected] wrote:

I checked the internet but found nothing helpful. A surprising fact is that
looks no one ever used gr.buffer in gnuradio by adopting python way. Is
there anybody know how to use it correctly?
Your instruction is fairly appreciated.

Br,
Zhonghua

The gr.buffer is not meant to be used this way. It’s the data structure
used
in the input and output ports of the blocks to move data. There’s no
reason
to use it in a flowgraph or anything like that.

What’s your reason for wanting a buffer there in the first place? It’s
likely that there is an actual block meant for your purpose.

Tom

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs