ok, so I Do have a question about those functions...
yesterday I tried to made an oscillator, which would only need one single function for the oscillator.
I hoped by recalling that function within a for-loop, I could generate multiple voices.
Though it seems that the internal parameters of this function should be arrays instead of normal int32_t...
( eg. uint32_t phase[8] for 8 possible phase generations).
When I tried using the "normal" "uint32_t phase", it just added all these phases together and output a single wave with a frequency of the sum of all the frequencies of all the voices..
I did this like (simplified version):
in local data:
uint32_t phase;
uint32_t sine;
int32_t out[8];
int32_t sum;
int32_t oscillator(freq)
{
phase+=freq;
SINE2TINTERP(phase,sine)
}
in S-rate data:
sum=0;
for(i=0;i<8;i++)
{
oscillator(pitch[i]);
out[i]=sine;
sum+=out[i]>>6;
}
outlet_out=sum;
but it seems I have to change both phase and sine (and additional declarations) into arrays for it to work, like:
uint32_t phase[8];
int32_t sine[8];
So.. I think I'm doing something wrong here, or not?
I hoped to be able to design a simple function for an oscillator, which could then be called upon multiple times to generate an # amount of voices (by feeding it array-values for frequency, FM etc).
Or is it just necessary to also make an array of phases?