I'm not really sure what's going on in my patch (which i'll post here: fm for help.axp (19.9 KB)
)
Short story: there's a 2D array (6x3) in which i store some data.
The array is defined in local data this way:
int32_t modmatrix[6][3]; //row = source; column = dest
Problem is: i can write correctly in every position of the array, except for those of row 0
(example: modmatrix[0][0] , modmatrix[0][1] , modmatrix[0][2] )
I tried experimenting with the code, and i noticed some pretty wild behaviour:
"normal" local data section would be like this:
some stuff here (variable declarations)
int32_t mix[3];
int32_t modmatrix[6][3]; //row = source; column = dest
some other stuff here (variable declarations)
When the code is written like this i get the problem mentioned above.
If instead i write this (flipping the two declarations):
some stuff here (variable declarations)
int32_t modmatrix[6][3]; //row = source; column = dest
int32_t mix[3];
some other stuff here (variable declarations)
The object completely stops working and starts to emit a buzzing sound
I worked around this issue by making the array 7x3 and not using the first row... But it's pretty ugly.
I'd suspect this is some form of variable overflowing, however i fail to see where this is happening... Can someone give me advice?
Solution:
I had defined mix[3] as a 3 values array. In k-rate i wrote in positions 3, 4, 5 (because that's what i intended to do from the beginning).
This overwrites some portions of memory i used for modmatrix array, which was fine.