Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opening and showing 2 times the plugin messes up the graphic screen #44

Open
frank1119 opened this issue Jan 9, 2022 · 6 comments
Open

Comments

@frank1119
Copy link

frank1119 commented Jan 9, 2022

When I open and display two instance of ysfx simultaneously the screen gets garbled big time, where it comes to texts.
In Reaper you can detach the plugin-interfaces by double-clicking the plugin.

Problem does not occur when the plugin-interfaces are not being shown at the same time.

Ysfx garbled

Might be related to ui-lib.jsfx-inc https://geraintluff.github.io/jsfx-ui-lib

@frank1119 frank1119 changed the title Opening and showing 2 times the plugin with the same script messes up the graphic screen Opening and showing 2 times the plugin messes up the graphic screen Jan 9, 2022
@frank1119
Copy link
Author

frank1119 commented Jan 9, 2022

Some extra info: It is the combination of ysfx and ui-lib.jsfx-inc. It doesn't occur when the default theme is used, but with theme 'tron' or 'black' things gets messed up. It does not occur when the standard Reaper implemention for jsfx is used.

Edit: It seems to concentrate around the font-functions. The themes use these function. Using the default theme and then changing the font-face, font-size, or making it italic. the behavior starts

jpcima added a commit that referenced this issue Jan 10, 2022
@jpcima
Copy link
Owner

jpcima commented Jan 10, 2022

It was worked around in cd8b0ca.
It impacts the performance negatively however, I'll come up later with a better fix.
This issue will stay open for now. Thanks for finding this.

@frank1119
Copy link
Author

frank1119 commented Jan 10, 2022

  1. The patch works, so that is very nice. Thank you for that.

  2. Performance. I created a little script to count the fps:

    • On my laptop (I7 from 2020), I can open several screens and I measured a steady 30 fps on all of them.
    • The original ReaJS just 22 fps.
    • The same for Reaper < 6.44 inbuilt jsfx
    • Reaper >= 6.44 inbuilt with 'options:gfx_hz=60' 40 fps

    So the performance is not really too bad. At least std::mutex is a critical section and not as great a performance hit as a Win32 Mutex would be (being a kernel object). As a temporary fix it is not the worst thing to do. I will not impact audio processing anyway, because the UI runs on a separate thread. Of course a better fix will result in a better plugin in the end, especially when you are aiming for higher fps.

I can live with this :-).

Do you want me to close this issue or will I leave it open for you to decide when to close it?

image

@jpcima
Copy link
Owner

jpcima commented Jan 11, 2022

Keep the issue open please. Thanks for your help with the testing :)

Regarding performance: it's doubtful that fps is a significant measure here.
The fps is strongly determined by the timer interval which repeatedly invokes @gfx; both jsfx implementations are using the same underlying graphics code.
(also from some bits of code seen recently, Reaper might be making a move from software to GL, but that's merely speculation)

The implementation of the mutex is not likely to make any significant difference either.

The element that makes ysfx VST special is that it runs the @gfx in a background thread.
The reason is that @gfx code can be blocking for undefinite lengths of time (eg. gfx_showmenu), and hogging the UI thread would freeze the entire DAW.
As I've found out, it was either a background thread or modal loop solution, and the latter is extremely discouraged in juce 6 as it creates subtle bugs.

As of now, each plugin editor is having its own background thread, and as we discovered, calling SWELL from these multiple threads is creating problems.

  • the current solution is a quite wide-scoped lock that forbids background threads to access SWELL in concurrency
  • the preferred one will be to regroup all editors onto one single background thread

@jpcima
Copy link
Owner

jpcima commented Jan 11, 2022

also I never heard about a gfx_hz option before..

@frank1119
Copy link
Author

frank1119 commented Jan 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants