polluxsynth / audio-plugins

Audio plugins using the Distrho Plugin Framework
https://butoba.net/homepage/mimid.html
GNU General Public License v2.0
5 stars 0 forks source link

Decrease CPU load by not running modulators at oversampling rate #14

Open polluxsynth opened 1 month ago

polluxsynth commented 1 month ago

Try decreasing CPU load by running LFOs and envelopes at the output sample rate even when oversampling is enabled, with the idea being that little would be gained by having modulator waveforms at the higher rate. In fact, in Voice:processSample(), break out everything that does not take place at the audio rate to a separate function, using method variables to communicate the values to processSample().

In effect, we will be introducing a 'k-rate', although the k-rate will not be some low rate like 3 kHz, but rather the same as the output sample rate.

This mostly affects Voice.h and the set-oversampling functions, which in some cases need communicate both the sample rate and the oversampling factor to lower level modules.