Update comments on the VST3 info caches

This commit is contained in:
Robbert van der Helm
2021-02-09 23:19:17 +01:00
parent 2d62347393
commit 10b01b5140
+17 -19
View File
@@ -24,18 +24,19 @@
* plugin. We sadly had to deviate from yabridge's 'one-to-one passthrough' * plugin. We sadly had to deviate from yabridge's 'one-to-one passthrough'
* philosphy in two places: * philosphy in two places:
* *
* 1. REAPER requests the plugin's input and output bus count and information * 1. We cache parameter information, and these caches are flushed whenever the
* every processing cycle, even though this information cannot change during * plugin requests a restart. This is needed because REAPER repeatedly
* processing. With plugins with many outputs this can lead a lot of extra * queries this information four times per second for all of a plugin's
* back and forth before the plugin gets to process audio, which thus leads * parameters while the editor is open. The issue has been reported and it's
* to very inflated DSP usage. * been fixed in REAPER's current pre-release builds (as of February 2021).
* 2. REAPER in some situations (because it doesn't always seem to happen) * Bitwig also seems to query this information twice on startup, so the cache
* fetches the plugin's parameter information exactly four times per second. * is likely also useful there.
* When plugins have thousands of parameters, this unnecessarily uses up a * 2. We also cache input and output bus counts and information. REAPER would
* lot of CPU time. * query this information for every I/O bus before processing audio, which
* * ended up increasing audio processing latency considerably for no reason
* Both of these caches were necessary to get decent performance in REAPER, and * (since this information cannot change during processing). REAPER has fixed
* they should be removed as soon as REAPER no longer needs this. * this issue as of a pre-release build in February 2021. JUCE based hosts
* like Carla also seem to query the bus counts every processing cycle.
*/ */
class Vst3PluginProxyImpl : public Vst3PluginProxy { class Vst3PluginProxyImpl : public Vst3PluginProxy {
public: public:
@@ -79,8 +80,8 @@ class Vst3PluginProxyImpl : public Vst3PluginProxy {
* functions many times per second, even though their values will never * functions many times per second, even though their values will never
* change. * change.
* *
* HACK: Once REAPER stops calling these functions, we should remove this * HACK: See the doc comment on this class for more information on these
* caching layer ASAP as it can only cause issues * caches
* *
* @see clear_bus_cache * @see clear_bus_cache
* @see clear_parameter_cache * @see clear_parameter_cache
@@ -482,9 +483,7 @@ class Vst3PluginProxyImpl : public Vst3PluginProxy {
* Since this information cannot change during processing, this will not * Since this information cannot change during processing, this will not
* contain a value while the plugin is not processing audio. * contain a value while the plugin is not processing audio.
* *
* HACK: This is only necessary because REAPER requests this information * HACK: See the doc comment on this class
* once per procession cycle. We can get rid of this once it no longer
* does that.
*/ */
std::optional<BusInfoCache> processing_bus_cache; std::optional<BusInfoCache> processing_bus_cache;
std::mutex processing_bus_cache_mutex; std::mutex processing_bus_cache_mutex;
@@ -510,8 +509,7 @@ class Vst3PluginProxyImpl : public Vst3PluginProxy {
* but it can also happen in some other cases so I'm not quite sure what the * but it can also happen in some other cases so I'm not quite sure what the
* trigger is. * trigger is.
* *
* HACK: This is only necessary because REAPER sometimes requests this * HACK: See the doc comment on this class
* information four times per second.
*/ */
ParameterInfoCache parameter_info_cache; ParameterInfoCache parameter_info_cache;
std::mutex parameter_info_cache_mutex; std::mutex parameter_info_cache_mutex;