discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] gr_block::set_history()


From: Tom Rondeau
Subject: Re: [Discuss-gnuradio] gr_block::set_history()
Date: Fri, 21 Sep 2012 13:23:49 -0400

On Fri, Sep 21, 2012 at 1:18 PM, cjpatton <address@hidden> wrote:
> Tom and Kyle,
>
> Thanks for your replies. Suppose I want in[0] to refer to the beginning of
> the new data. Then I could do this:
>
>    const float *in = (const float *) input_items[history()-1];
>
> So in[noutput_items-1] is the last? Thanks!
>
> Chris

Chris,
Close. Remember that input_buffers is a vector of buffers. So you want
the first buffer and then offset it. I think this should work:

>    const float *in = (const float *)(&input_items[0][history()-1]);

A good one to look at is the gr_quadrature_demod_cf block where the
history is set to 2 and the work function has:

    const float *in = (const float *) input_items[0];
    in++;

So the 'in++' sets the pointer forward that one sample so that in[i-1] is valid.

Tom



reply via email to

[Prev in Thread] Current Thread [Next in Thread]