Hi everyone,

I am trying to develop a frame based structure for gnuradio block on

c++.

The frame size will be 2048 point and i will calculate the normalized

amplitude for every frame i.e.

ma = sum(every 2048 points)/2048;

normalized amplitude = all 2048 points / ma;

i wrote a code that gives me the desired result under “work” function;

int

gr_gama_maks_ff::work (int noutput_items,

gr_vector_const_void_star &input_items,

gr_vector_void_star &output_items)

{

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

float *out = (float *) output_items[0];

float ma = 0.0;

float acn[noutput_items], an[noutput_items];

int C = 2048;

int a = 0;

int count = 0;

for (int i = 0; i < noutput_items; i++){

ma = 0.0;

for (int m = a*C; m < a*C+C ; m++) {

ma += in[m]/C;

}

```
an[i] = in[i]/ma;
acn[i] = an[i]-1;
out[i] = acn[i]*d_k;
```

if ((i+1) % C == 0) {

a = a + 1;

}

}

As you see i didn’t keep a 2048 point array, i just find the sum of

2048 points and then use it for the output (an[i]= in[i]/ma). But i

couldn’t figure out how this happens. I mean the while index “i = 1”

in the first for loop, i can reach the i+2047th sample in the second

for loop.

Is there a buffer for every block in gnuradio. If yes what is the size

of the buffer?

I hope i would explain it clear.

Mehmet.