Doe
Doe

Reputation: 195

GNU Radio: Set minimum input/output buffer size for a Python block

I am writing my own GNU Radio block in Python, and I want to set a minimum buffer size for both (or either) the input and output buffers of that block.

Is there a function or piece of code that can do this?

Upvotes: 4

Views: 5928

Answers (1)

Marcus Müller
Marcus Müller

Reputation: 36442

You can only set the minimum output buffer size (that's not a problem; every input buffer is the output buffer of another block), using the gr.block.set_min_output_buffer(port, size) call, for example by doing:

  • by adding the call def __init__(self): gr.sync_block.__init__(self, name="block_with_buffer", in_sig=[numpy.float32], out_sig=[numpy.float32]) self.set_min_output_buffer(2**20) in your constructor, or
  • by calling
    your_block_handle.set_min_output_buffer(2**20)
    in whatever python script you're using to set up your flow graph, or
  • by using GNU Radio Companion's "advanced" tab (in your block's property dialog) to set the minimum output buffer size.

However, GNU Radio forgot to wrap that call in its python block class. Hence, you currently can't use that with python blocks, sorry, only with C++ blocks. I'm currently writing a patch for that; if all goes well, you'll see this on the master branch soon :)

Upvotes: 5

Related Questions