I am currently trying to do the signal processing of multiple channels in parallel using a custom source block. Up to now I created an OOT-source block which streams data for only one channel into one output perfectly fine.
Now I am searching for a way to expand this module so that it can support a higher number of channels ( = outputs of the source block; up to 64) in parallel. Because the protocol used to pull the samples pulls them all at one it is not possible to use more instances of the same source block.
Things I have found so far:
Is there are known solution or workaround for this problem?
Look at the add
block: It has configurable many inputs!
Now, the trick here is threefold:
io_signature
as input and output that allows for adjustable numbers. If you use gr_modtool add
to create a new block, your io_signatures
will be filled with <+MIN_IN+>
, <+MAX_IN+>
, <+MIN_OUT+>
and <+MAX_OUT+>
. Adjust these to reflect your actual minimum and maximum in- and output port numbers. If you want to have 1
to infinity
inputs, use 1
, -1
. general_
)work
method, check for the number of inputs by doing something like ninputs = input_items.size()
, and for the number of outputs by doing noutputs = output_items.size()
.(optionally, if you want to use GRC) modify the <sink>
/<source>
definitions in your block GRC XML:
<sink>
<name>in</name>
<type>complex</type>
<nports>$num_inputs</nports>
</sink>
num_inputs
could be a block parameter; compare the add_XX
block source code.