I checked it a hundred times. Input is a Sine wave. In theory this is a mini convolution. but it always ouputs a zero. if i forget the loop and the arrays and use float vars, it works flawlessly
and the array has size=4.
The way the arrays are implemented in order to be user friendly and not crash is to use the last value in the array when the index is higher.
Anyway, maybe I dont understand your code and it is a bug.
I think you mean to have n=0,n=1,n=2,n=3,n=0,n=1,n=2 etc
Although I didnt try it, you can probably initialize the n variable every 3rd sample with:
hop(3)
{
n=0;
}
or another way would be to make sure n wraps around the size of the array like:
n=n-(n>3.5)&4;
also note that at the moment using arrays as variables is not very efficient ( although that will change ). The code compiled for var=array[3]; is at the moment similar to when you're indexing the array with a float variable. The "3" is treated like a float that is converted to an integer which is then used to get a value from memory for each of the SSE channel separately. The same could be done with just one instruction and like I said it will change to be efficient.
unkargherth ·
Sure n is working this way ?
Note the line saying
n=0;o=0;
So, in theory, is setting n=0 and also initializing output at every sample
( note that this is the reason i didn't done float n=0;
jorge ·
unkargherth wrote: Sure n is working this way ?
Note the line saying
n=0;o=0;
So, in theory, is setting n=0 and also initializing output at every sample
( note that this is the reason i didn't done float n=0;
yeah, you're right, must be a bug then.
I'll try your code.
I'm suspecting it could be related to the line "z[n]=z[n+1];"
which would probably work if you had "var=z[n+1];z[n]=var;" but I havent tried it yet.
Which narrows down the cause of the bug quite a lot. I think the array indeces for reading ( n+1 ) and writing ( n ) are getting mixed up as they use the same internal arrayindex variable. I'll change the code to cope with it.
unkargherth ·
Lots of thanks jorge !!!! Man, you're damned fast. I lasted more to find the bug than you to find a workaround !!!!
I was thinking more ona Loop bug, but from that new POV i agrre with you that seems an array index corruption issue
Wrote something here? To have a post removed or your name hidden, write to [email protected].