Mert,
10/3 isn't an integer, so that's not going to work. Here's a correct scheme.
In the constructor:
set_output_multiple(54);
In forecast:
ninput_items_required[0] = (noutput_items / 54) * 180;
In work:
for (int i = 0; i < noutput_items; i += 54) {
/* The processing needs to read 180 items from *in and write 54 items
to *out */
}
consume_each ((noutput_items / 54) * 180);
Ron
On 10/31/18 17:58, Salahi, Mert E wrote:
Hi all,
I am trying to make a custom block that implements a MELP vocoder. The
block takes in audio samples(floats) at 8kHz and outputs bits at
2.4kbps. Given that, I think I will need to use a general block to get
the correct input/output buffer sizes.
The vocoder blocks the audio input to 22.5ms (180 samples) and outputs
54 bits. I know that I will need to modify the forecast() function,
but I am not sure how. My guess would be something like this:
/void/
/gr::block::forecast(int noutput_items,/
/ gr_vector_int &ninput_items_required)/
/ {/
/ unsigned ninputs = ninput_items_required.size ();/
/ for(unsigned i = 0; i < ninputs; i++)/
/ ninput_items_required[i] = (10/3)*noutput_items;/
/ }/
//
/Then call,/
//
/consume_each ((10/3)*noutput_items);/
//
Is this the correct approach or am I missing something here? Once I
get this working I will likely try to pack the bits into some integer
data type for efficiency’s sake - so I’ll need to be to do this for
different input/output ratios other than 10/3.
Thanks!
_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio