kampfschlaefer / jackmix

Matrix-Mixer for the Jack-Audio-connection-Kit
http://www.arnoldarts.de/jackmix/
GNU General Public License v2.0
44 stars 13 forks source link

Use linear ramps between volume changes #6

Closed dsheeler closed 5 years ago

dsheeler commented 5 years ago

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.

nickbailey commented 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?

dsheeler commented 5 years ago

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.

kampfschlaefer commented 5 years ago

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…

nickbailey commented 5 years ago

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.