accessing buffer~
hi everybody,
first of all i'm a newbie in programming and i'm writing this external as the final project for my thesis at university.
i'm trying to access a buffer and copy all the values in an array of doubles,
but max crashes everytime i try to access the buffer.
these are the methods i'm trying to write
void fftesi_bang(t_fftesi *x)
{
post("bang received, provo a leggere il buffer");
t_buffer *buf = x->l_buf;
copio_campioni(buf);
}
void copio_campioni(t_buffer *b)
{
//float *tab;
long i, chan;
//double current_samp = 0.0;
ATOMIC_INCREMENT((int32_t*)&b->b_inuse);
post("speriamo bene");
i = 1; chan = 1;
if (!b->b_valid) {
ATOMIC_DECREMENT(&b->b_inuse);
return;
}
/*
//copio il valore corrente in un array di dimensione 4096
tab = b->b_samples;
chan = 0; //usiamo solo il canale left
for(i=0; ib_frames; i++)
{
segnale[i] = tab[i];
post ("letto campioni");
}
*/
ATOMIC_DECREMENT((int32_t*)&b->b_inuse);
return;
}
the zip file contains the dir placed in MaxSDK-5.1.6/examples/ with my xcode project.
thanks to all
the later.
I'm sorry i didn't explain!
The part between /* is commented because i was tryin to find my mistake, and the chan=1 i=1 is written just to avoid the warning msg "unused var"
Even the tab declaration is commented necause tab is used in the commented part. The error is of course in the uncommented part!
If you download the zip file you get a buildable dir, but max crashes if i send a bang to left inlet
I didn't read abiut the zip... I'll post it later i'm sorry :P
if you are in Milan in the week before Easter, you will get a pair of beer because a little bit of my degree is your.
thanks a lot
Antonio