matrix~ in gen~
Hi all,
I just developed a matrix~ copy in gen~ (using genexpr), that I'd like to share:
Basically it does exactly the same thing as matrix~, except that the smoothing ramp is not linear but exponential to minimize the cpu cost (1st order filter with "mix"). The main advantage of implementing a matrix in gen, compared to matrix~ is to allow feedback loops within gen~ with a delay smaller than the buffer size.
In terms of CPU cost, it takes on my machine something that 2.5 times more cpu than an equivalent matrix~ which can be considered as not-too-bad but not optimal, if we compare this ratio to other gen~ patches, which run almost as quickly as the equivalent external object. I'm really open to any comments regarding optimization, I'm stuck at the moment with my current knowledge of genexpr.
To change the number of inputs and outputs, one have to modify some numbers in the code (buffer size, data size, number of loops), add/remove some lines at the beginning of the code (when the input values are stored in the data "matrix_invals") and the end (when the output values are read from the data "matrix_outvals")... and of course create the corresponding new inputs and outputs. It should however be quite easy to generate the genexpr code (with "text" for example) from any number of inputs and outputs.
As I said, any comments are warmly welcome,
Cheers
Alexis