jpcima / ADLplug

FM Chip Synthesizer — OPL & OPN — VST/LV2/Standalone

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

High CPU usage on Windows when UI is visible

vvrbanc opened this issue · comments

When ADL/OPNplug UI is visible and a long note is playing in a DAW, cpu usage goes up to 80-100% of a single core.

Seems to be related to the ADL/OPNplug UI's MIDI keyboard display. If the part of the window with the midi keyboard is moved off the bottom of the screen, the cpu usage drops back to normal.

Same behavior with both VST and LV2 versions of ADLplug and OPNplug on Windows.
Linux versions do not exhibit this behavior.

Reproduced in 2 different DAWs on Win10: Reaper and LMMS. In Reaper it is especially annoying because it freezes the position cursor.

Steps to reproduce:

  1. create a midi track with a single long sustained note in a DAW program on Windows and assign the ADLplug instrument to it.
  2. while the ADLplug UI is visible, start playing the track and observe the CPU usage.
  3. cpu usage drops if the part of the ADLplug UI window with the midi keyboard is moved off the bottom of the screen

I am guessing that it is repainting/redrawing too quickly in a tight loop.

Reproduced on Renoise 3.3.2 on Windows as well.

There is a suspicion on that, but atm I don't have the windows environment to test it unfortunately.
At least to me, this never happened back when I tested.
But I might have a potential quick fix, I'll give that an attempt.
What are the characteristics of the system? CPU/GPU

i5-3570K, 16GB, GTX 1060 3GB for me.

A patch is in, but the binaries have troubled to rebuild for windows since the juce 6 upgrade.
It takes a little more work to get the things fully back on track.

Please check with the minGW build out of this revision if you don't mind.
https://ci.appveyor.com/project/jpcima/adlplug/builds/40450641

Hi,

Thank you for taking the time to look into this.

I tried the LV2 versions from the CI link above and I don't see any difference in CPU usage.

See task manager screenshot:
cpu

It's jumping between cores but one is always at 100%, with significant amount in kernel time.

FWIW the cpu is ryzen 3700x and gpu is rtx 3070.

Right I can reproduce at least that there's a LOT of repaint requests that occur during the note playback, using Reaper. I'll see if I can get to the origin of this.

Yeah, I've been using the release VST3 version and switching between that and this VST2 build is like night and day.

It was not a good idea to build VST3 to start, it created misbehavior with program changes.
So I've turned it off; but this particular problem has nothing to do with VST2 vs VST3.
It's OK to close this issue?

So I've turned it off; but this particular problem has nothing to do with VST2 vs VST3.

That's what I figured.

It's OK to close this issue?

Looks like it to me. 👍