ryukau / VSTPlugins

Uhhyou Plugins VST 3 repository.

Home Page:https://ryukau.github.io/VSTPlugins/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Plugins CPU load increase while no input/output in REAPER (Win64)

nekotaro6 opened this issue · comments

There is a weird behaviour of some plugins in REAPER on Win64: after plugin process input audio and there is no more input and plugin output is silent, CPU load rises significantly. So far i could observe this in UltrasonicRingMod, PitchShiftDelay, EsPhaser, UltraSynth (in synth it happens when output becomes silent after MIDI input). Rarely issue was present in L4Reverb.

The amount of CPU load increase varies with each plugin. Changing sample rate/buffer size has no effect. The issue is present in REAPER 6.71 Win64 (i have checked on 2 different PCs with different hardware). On some other DAWs i have tried (Ableton Live, Bitwig Studio) the issue is not present, on Mac ARM64 native/Rosetta in REAPER the issue is not present. This may be a bug in REAPER's plugin host on Win64, but i'd like to let you know anyway.

Attached a video example of issue with UltrasonicRingMod. CPU load increase is so high with this one it causes playback dropouts.

UltrasonicRingModREAPER.mp4
commented

Thanks for the report. I think it's better to contact REAPER developers about the issue.

I got similar behaviour on REAPER v6.58. The amount of CPU load increase on my environment isn't as drastic as your video (0.3c to 0.45c). I changed DSP buffer size between 128 and 512 samples, but CPU load increase was the same.

CPU load increase didn't occur on FL 21.0.

Relevant code is probably somewhere around in following link:

If anyone around here could point out the mistake in my code, please do so. It's entirely possible that I'm doing something wrong.

What I Tried

I suspected that REAPER is calling setActive() too frequent. I tried something as following:

tresult PLUGIN_API PlugProcessor::setActive(TBool state)
{
  if (state) {
    if (!isActive) dsp.setup(processSetup.sampleRate);
    isActive = true;
  } else {
    if (isActive) dsp.reset();
    isActive = false;
    lastState = 0;
  }
  return AudioEffect::setActive(state);
}

dsp.setup() and dsp.reset() are the heavy part, so the above code avoids calling them when state is staying same as the previous setActive() call. However, this isn't the cause of the problem.

I also tried getProcessContextRequirements() to return 0, and it didn't solve the problem.

Other suspected parts are parameter handling and MIDI note handling. However, it implies that REAPER is sending unnecessary events when there's no input, and I don't think this is the case.

Small update: running plugins as separate process fixes issue.

commented

I found another problem on REAPER v6.71/win64. It occasionally freezes when following conditions are met. It won't always happen, but the chance is high.

  • Plugin is VST 3 and has an event input and GUI.
  • Set "Run as" to "Separate process".
  • Load as FX.

This bug also occured with NoteExpressionSynth with UI, which is an example plugin of VST 3 SDK.

Affected plugins on this repository are all the synthesizers and UltrasonicRingMod.

Hi, regarding the CPU load issue from first post, perhaps the issue is due to denormalisation? There were some similar issues with different plugins that had the same description, e.g. https://forums.acoustica.com/viewtopic.php?t=11178 and https://vladgsound.wordpress.com/2013/03/14/molot-denormalization-problems/.

Here is a denormalisation description from a while back (also provided normalizer plugin solved CPU load issue): https://web.archive.org/web/20200620054140/http://www.digitalfishphones.com/main.php?item=2&subItem=6.

And some info regarding SSE flags: https://gearspace.com/board/mastering-forum/1251646-iis-denormalization-noise-redundant-when-dithering.html.

commented

Thanks for the information.

I ported ScopedNoDenormals from JUCE, and it solved the issue on my environemnt that is Windows 10, x86_64, REAPER v6.79. The commit is 4ba1c3e.

UltrasonicRingMod with ScopedNoDenormals is available on the links below. Let me know if it solves the issue on your environment. I'd also like to know if it also improves the performance on ARM Mac.

Once the fix is confirmed, I'll apply it to all the other plugins.

Tested fix on Win11 x86_64, REAPER v6.79. The issue is resolved.

On ARM64 Mac, REAPER v6.79, in both Native and Rosetta modes the performance has not changed.

commented

Thanks for testing!

The fix will be soon released as UhhyouPlugins 0.55.0. It will take 30 minutes to an hour after this comment.

I'll close this issue as completed. If I missed something, feel free to add comment or open another issue.