Closed dsheeler closed 5 years ago
That's the bullet points in the above comments sorted out and @dsheeler 's changes merged into the qt5 branch. Thanks, Daniel! Do you want to pull the qt5 branch and test it?
re jack_backend.h: I still think the private QHashs outvolumes and outvolumes_new (and the same for volumes, volumes_new and involumes, involumes_new) should be merged because they are basically a local state and the current and target volumes belong together associated with the QString, not in separate structures. I need to look in how to do this exactly.
By the way, why are involumes and outvolumes stored in a QHash, but volumes stored in a QMap? Can you remember, @kampfschlaefer or is this lost in the mists of time? As I understand it, QHash is faster, but QMap retains order when iterating over the elements in the container. Is that the reason?
I will pull and test, yes.
I agree about having target and current volumes together as a pair.
There also might be an abstraction here for the type of transition (linear vs. like @nickbailey said a hanning crossfade) and the transition itself, like a transition object that has a life of it's own that has a prescribed time length as opposed to having it rely on the buffer length.
re jack_backend.h: I still think the private QHashs outvolumes and outvolumes_new (and the same for volumes, volumes_new and involumes, involumes_new) should be merged because they are basically a local state and the current and target volumes belong together associated with the QString, not in separate structures. I need to look in how to do this exactly.
I think the volumes and volumes_new should be merged into one map of maps of pairs ;-)
By the way, why are involumes and outvolumes stored in a QHash, but volumes stored in a QMap? Can you remember, @kampfschlaefer or is this lost in the mists of time? As I understand it, QHash is faster, but QMap retains order when iterating over the elements in the container. Is that the reason?
If I remember correctly, back in the time QHash couldn't use another QHash as values. But boy has it been ages since I wrote that…
I've refactored the interpolating controls and put a convenience function in the abstract base class
The code is quite a bit smaller now, and I hope more intuitive.
Linear ramping between volume changes over the course of an audio buffer's worth of samples. If buffer is too small (not sure how small is too small) this implementation can still lead to pops, but it does a good job at 256 samples at 48kHz sampling rate.