Multirate Blocks

Hi,
I’m implementing a 2-FSK modulator (I Know that a good one already
exists but i have to do it myself for academic purpose).
To do so, i produce a given (N) number of samples corresponding to the
sampling of a complex exponnetial for each incoming bits. The “sampling
rate” (one bit => N samples) is increased by N through the modulator,
so i’m doing this Constructor: set_relative_rate(N);
set_output_multiple(N); General_work: consume_each(noutput_items/N);
Is that correct? and is there anything else to do?
Thanks in advance,
Antoine Dedave

On Sat, Feb 26, 2011 at 8:00 AM, Antoine Dedave <
[email protected]> wrote:

The “sampling rate” (one bit => N samples) is increased by N through the

Is that correct? and is there anything else to do?

Thanks in advance,

Antoine Dedave

First, what type of gr_block are you inheriting from? The fact that you
are
using noutput_items/N in your consume_each function makes it look almost
like you are using a gr_sync_block, which would not be the right answer
here.

In fact, you can use a gr_sync_interpolator since you know the direct
relationship between input and output samples (1-to-N). Set the
interpolation rate as N and you don’t need to worry about any of the
reset
(setting the relative_rate or consume_each; the parent class knows what
to
do with them).

Look at the implementation of gr_sync_interpolator to see how it handles
setting everything up for you to do the interpolation properly.

Tom