Forums > Dev

Passing a variable from one function to another.


Anonymous
August 1, 2011 | 10:46 pm

Hello,

you can do something like that (even if IMHO you should avoid to free/alloc memory each time) ;
you don’t need to use float *storage = x->storage ;
correct me if i didn’t understand your problem.

...

sysmem_freeptr (x->storage);
x->storage = (float *)sysmem_newptr (totalframes * b_nchans * sizeof(float)); 

memcpy (x->storage, b_samples + (startframe * b_nchans), totalframes * b_nchans * sizeof(float));

n = totalframes;

fbuf_paste (x, n);
}
...

fbuf_paste (t_myObject *x, long n)
{
float *toto = x->storage;
...
}

HTH


Viewing 1 post (of 1 total)