Reputation: 195
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
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:
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, oryour_block_handle.set_min_output_buffer(2**20)in whatever python script you're using to set up your flow graph, or
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