JUCE icon indicating copy to clipboard operation
JUCE copied to clipboard

[Bug]: VST3 setVisible has no effect on Windows

Open kevin-- opened this issue 3 years ago • 3 comments

Detailed steps on how to reproduce the bug

Steps To Repro 0. run app on windows

  1. Host a VST3 Plugin in JUCE
  2. create and display the editor component as a child component of your window
  3. Call setVisible(false) on the child component, or on the AudioProcessorEditor directly

Observed Behavior

  • the plugin GUI remains visible

Environment / Context

  • using JUCE 6.1.4
  • possibly related to this forum post https://forum.juce.com/t/vst3-window-visibility-handling/20709

What is the expected behaviour?

Plugin GUI becomes invisible.

Operating systems

Windows

What versions of the operating systems?

Windows 10 and 11

Architectures

x86_64

Stacktrace

n/a

Plug-in formats (if applicable)

VST3

Plug-in host applications (DAWs) (if applicable)

Host written in JUCE

Testing on the develop branch

I have not tested against the develop branch

Code of Conduct

  • [X] I agree to follow the Code of Conduct

kevin-- avatar May 02 '22 17:05 kevin--

Steps to repro

  • Apply the following patch, which causes the AudioPluginHost to show/hide plugin editors every two seconds. It also wraps the editors in a new Wrapper component, to ensure that transitive visibility works as expected:
From 24df063aceb3c32d25840c2ed4d3c47f7bace694 Mon Sep 17 00:00:00 2001
From: reuk <[email protected]>
Date: Wed, 4 May 2022 19:48:45 +0100
Subject: [PATCH] Update AudioPluginHost to show and hide plugin editors

---
 .../AudioPluginHost/Source/UI/PluginWindow.h  | 29 +++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)

diff --git a/extras/AudioPluginHost/Source/UI/PluginWindow.h b/extras/AudioPluginHost/Source/UI/PluginWindow.h
index 12ee688a6e..43966d9144 100644
--- a/extras/AudioPluginHost/Source/UI/PluginWindow.h
+++ b/extras/AudioPluginHost/Source/UI/PluginWindow.h
@@ -138,7 +138,7 @@ private:
 /**
     A desktop window containing a plugin's GUI.
 */
-class PluginWindow  : public DocumentWindow
+class PluginWindow  : public DocumentWindow, private Timer
 {
 public:
     enum class Type
@@ -151,6 +151,29 @@ public:
         numTypes
     };
 
+    void timerCallback() override
+    {
+        auto* comp = getContentComponent();
+        comp->setVisible (! comp->isVisible());
+    }
+
+    struct Wrapper : public Component
+    {
+        Wrapper (std::unique_ptr<AudioProcessorEditor> editorIn)
+            : editor (std::move (editorIn))
+        {
+            addAndMakeVisible (*editor);
+            setSize (editor->getWidth(), editor->getHeight());
+        }
+
+        void resized()
+        {
+            editor->setBounds (getLocalBounds());
+        }
+
+        std::unique_ptr<AudioProcessorEditor> editor;
+    };
+
     PluginWindow (AudioProcessorGraph::Node* n, Type t, OwnedArray<PluginWindow>& windowList)
         : DocumentWindow (n->getProcessor()->getName() + getFormatSuffix (n->getProcessor()),
                           LookAndFeel::getDefaultLookAndFeel().findColour (ResizableWindow::backgroundColourId),
@@ -158,11 +181,13 @@ public:
           activeWindowList (windowList),
           node (n), type (t)
     {
+        startTimer (2000);
+
         setSize (400, 300);
 
         if (auto* ui = createProcessorEditor (*node->getProcessor(), type))
         {
-            setContentOwned (ui, true);
+            setContentOwned (new Wrapper (rawToUniquePtr (ui)), true);
             setResizable (ui->isResizable(), false);
         }
 
-- 
2.36.0.windows.1
  • Run the AudioPluginHost on Windows 11, and load some VST3 plugins. I tested 6.1.4, 6.1.6, and the juce7 preview branch.

Result

The editor does not hide and show correctly with 6.1.4 or 6.1.6. However, with juce7 the editor hides and shows correctly. I haven't bisected to find out where this issue was fixed, but hosted VST3 editors got a large overhaul on the juce7 branch. I suspect that this issue was fixed as a side-effect of other bugfixes on the branch.

Action items

Please test with the juce7 branch and confirm that it resolves the issue for you. If the issue is not resolved, please provide detailed instructions (or ideally, a diff for the AudioPluginHost) to reproduce the issue on the juce7 branch.

reuk avatar May 04 '22 19:05 reuk

Hi @reuk thank you for looking into this. We can follow up and confirm the fix on JUCE 7. As an org are hesitant to ship with pre-release frameworks. Any idea when JUCE 7 general availability may be scheduled?

kevin-- avatar May 04 '22 19:05 kevin--

We don’t have a firm date in mind, but we're aiming to release within the next two months.

Please do give the juce7 branch a test. One of the aims of the juce7 branch is to get as much exposure to different use cases before the official release. Any problems uncovered now will be much easier to address than later.

reuk avatar May 04 '22 19:05 reuk