This PR contains a major refactoring of the HOASphericalHarmonics class. These changes allow the coefficients to be calculated at a fraction of the CPU cost.
It is now possible in to use this class as a efficient Pseudo-UGen inside a SynthDef. It works for constantly changing azimuth and elevations at audio rate.
Before, the calculations would always be done up to order 5. Now, only the coefficients for the order requested are calculated and returned.
Values that were previously calculated multiple times are now stored in variables and reused for greater efficiency.
The refactoring includes a large amount of duplicated code. Efforts were made to try and avoid this error prone and harder to maintain duplicated code. In the end, this version of the class was the most efficient. I'm not sure how I could have avoided all duplications while achieving the previous two optimizations. I'm open to suggestions though.
This PR contains a major refactoring of the
HOASphericalHarmonics
class. These changes allow the coefficients to be calculated at a fraction of the CPU cost.It is now possible in to use this class as a efficient Pseudo-UGen inside a
SynthDef
. It works for constantly changing azimuth and elevations at audio rate.Before, the calculations would always be done up to order 5. Now, only the coefficients for the order requested are calculated and returned.
Values that were previously calculated multiple times are now stored in variables and reused for greater efficiency.
The refactoring includes a large amount of duplicated code. Efforts were made to try and avoid this error prone and harder to maintain duplicated code. In the end, this version of the class was the most efficient. I'm not sure how I could have avoided all duplications while achieving the previous two optimizations. I'm open to suggestions though.
pinging @djiamnot @nicobou