On Tue, Jun 3, 2014 at 11:08 PM, Activecat <[email protected]> wrote:

>
> Create a general block with two inputs and two outputs.
> The two outputs connect to the USRP UHD sink. The first input connects to
> the constantly transmitting source while the second input connects to the
> non-consistent source.
>
> In your forecast function:
>
>    ninput_items_required[0] = noutput_items;
>    ninput_items_required[1] = 0;
>
>
> Then in your general_work function:
>
>   const gr_complex *in0 = (const gr_complex*) input_items[0];
>   const gr_complex *in1 = (const gr_complex*) input_items[1];
>   gr_complex *out0 = (gr_complex*) output_items[0];
>   gr_complex *out1 = (gr_complex*) output_items[1];
>
>   for (int i=0; i < noutput_items; i++)
>       out0[i] = in0[i];
>
>   for (int i=0; i < ninput_items[1]; i++)
>       out1[i] = in1[i]
>
>    for (int i=ninput_items[1]; i < noutput_items; i++)
>       out1[i] = 0.0;     // here you fill in the zeros, but won't
> over-filled.
>
>   consume( 0, noutput_items);
>   consume( 1, ninput_items[1]);
>
>   return noutput_items;
>
>

I've tested out above idea, it works.
Its implementation source file is at
https://github.com/activecat/gr-test2/blob/master/lib/streamer1_impl.cc
To test it out, just run the flowgraph of
https://github.com/activecat/gr-test2/blob/master/examples/flowgraph_09.grc

https://github.com/activecat/gr-test2
_______________________________________________
Discuss-gnuradio mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to