Hi,
I have what should be a pretty basic question about memory management and arrays in JSFX. I've done a good bit of C programming so you can assume a working knowledge in that context and maybe that is why I'm getting confused.
I was looking at the "JS: Chorus" as a vehicle towards understanding how a real effect is programmed. No particular reason for picking this other than having designed/build an analog chorus ages ago and the source code is fairly short.
The real question I have is with the "[]" operator.
i=0;
loop(numvoices,
i[0]=(i+1)/numvoices*$pi;
i+=1;
);
is it true that something like "x[i]" is pretty similar to C in that x is a pointer and i just offsets from there (but by a step size that depends on the storage size of the variables)? So in the example code block are we just filling up memory like:
addr: value
0 : pi/4
1 : 2*pi/4
2 : 3*pi/4
3 : 4*pi/4
but if this is correct, how do I know nothing else is going to use addresses 0,1,2,3? Then later on
bufofs=4096;
and then in the @sample section, the code is shoving samples into this buffer using bpos to index it like:
bpos >= choruslen } (bpos=0

;
bufofs[bpos]=os0;
bpos+=1;
and at the same time reading out with indices that are modulated with respect to bpos.
So I'm back to my original question, does this mean that the buffer sits in memory addresses 4096 on up to 4096+choruslen?
so now I have addresses 0 to numvoices-1 and 4096 to 4096+choruslen being used by these two bits of code. But how do I (or the EEL2 compiler) know that other variables, for example,
tpos = ....
vol=wetmix/numvoices
etc
don't get allocated to one of these addresses that is already being used by these two arrays?
Thanks so much
-Dan