Detecting end of a stream of samples in a block

Hi All,

I am trying to write a block which operates only if the number of
input samples is a multiple of some fixed number “M”. In general_work
I have a statement

int k = (int) ninput_items[0]/M //number of samples in input stream
if (k<1) return 0;

When I do “return 0”, I am assuming that this is equivalent to waiting
for the input stream to get filled with more samples. Is this a
correct assumption? If it is, then how do I deal when I use a source
where the number of samples is finite and the last few samples aren’t
multiples of this number M? Is there some way to detect end of a
stream of samples from within the block, so that I can terminate my
block when I get that condition.

Thanks,
Karthik


www.stanford.edu/~karthikv

On Wed, May 14, 2008 at 12:44:58PM -0700, Karthik Vijayraghavan wrote:

Hi All,

I am trying to write a block which operates only if the number of
input samples is a multiple of some fixed number “M”. In general_work
I have a statement

When you have M inputs, how many outputs do you produce?

Is a fixed ratio?

If so, derive your class from gr_sync_decimator.

Eric

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs