-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Embed VST GUI in subwindow #2856
Conversation
Synth1 works good, I only notice the shaking. Effect plugins (vst) seems not work. |
I'm on Ubuntu 14.04 now and have that graphic glitches too (on 16.04 I hadn't these glitches). If I click "show/hide Gui" twice everything works fine. But if I merge #2826 (which only changed QMdiSubindow to our Subwindow) it doesn't work anymore. I hoped this fixes the glitches on the title bar which I notice on Qt4 build. |
@jasp00 What do you think? Better to have a window than none at all or wait until this issue is sorted out? |
Test results (screenshots provided below):
|
On Linux, the visual artifacts are annoying.
I do not have a clear answer with the current proposal. Perhaps launching a helper application that embeds the VST GUI, out of MDI, would work around this. |
Is there a way to launch it in a separate OS-decorated process? Also
@jasp00 do you experience this or do you suspect it to be a VM-specific bug? Only Qt is affected, but once the VST window becomes active, I can't drag around any subwindows properly. |
I experience it.
I was thinking of a helper application that used Qt/LMMS decorations, but using a commented function for |
FYI, without this patch, Windows seems to be OK in the latest tests: https://youtu.be/exQwD1Kjsmg |
To solve the Linux Qt5 program, I will use a separate window. To unify the implementation, Windows and Qt4 will use a separate window too. |
I really agree on separate VST windows, since this will allow you to put a, say large VST spectrum analyzer on a seperate screen, if you're running a dual or more monitor setup. |
I tested this PR on Kubuntu 16.10 64-bit (Qt 5.6.1). Didn't notice any regression compared to Qt4 when when using various VST plugins. 👍 |
@karmux thanks for the testing. If your results are consistent with newer Qt versions, we should merge this PR, epecially considering it only applies to Qt > 5. Any objections? |
I have an implementation that uses a separate window to avoid the detected glitches; I am sorry I cannot commit yet. Are you sure the glitches are gone with current Qt 5? |
@jasp00 yes. Even in GTG DPC 3 (drum sampler on screenshots above) I couldn't see any artifacts. |
The glitches are still there with Qt 5.7.1. |
One glitch with Qt 5 when moving a separate window is that mouse events happen in the Qt application, and it may draw over the moving window. So there is no glitch-free method and the real solution would be to fix Qt. I will finish the separate window workaround: it is more complicated, but visually acceptable, and it does not leave a broken state when VST windows are gone. |
I see that #2855 is the only bug that prevents the switch to Qt5 on Linux, and that the switch can be done on Windows. This PR could work with Qt4 on Linux, but may I implement Qt5 only? Qt5 implementation works, just needs cleaning and error checking. More important, to unify the behavior as much as possible, since there are no embedding functions with Qt4 on Windows, may I drop Qt4 support for Windows? |
Sure so as long you're OK helping us revert it all if Qt5 exposes unexpected Windows issues in RC2. |
There is the will, but no time. I will keep Qt4, write the implementation guidelines for Qt5, and delay unification until RC2 is tested. |
ddcc57f
to
e20b648
Compare
On the first load of plugin, it's loaded separately from Qt window (there's empty Qt window and borderless VST window). Pressing show/hide GUI button twice loads it correctly. Using same setup as I wrote before. |
@karmux, GTG DPC 3 plug-in on Qt 5.6.1? |
@jasp00 When VST is loaded in new project then it loads properly inside Qt's window. But when some project has VSTs saved then it loades like I described in my previous #2856 (comment). This applies to all VSTs. |
@@ -62,6 +62,9 @@ class VstEffectControlDialog : public EffectControlDialog | |||
VstPlugin * m_plugin; | |||
|
|||
QLabel * tbLabel; | |||
|
|||
private slots: | |||
void togglePluginUI( bool checked ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
void togglePluginUI( const bool checked );
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should use const
only when it is useful:
- Pointers and references.
- Read-only methods.
- Constants.
As I said, only when it is useful, not when it is possible. Excessive use of const
makes the code harder to read (this is subjective, but it is simpler). Without const
, you can reuse parameters (simplicity) and you do not have to take const
back if you need write access later (less typing and less thinking).
const bool
and alike are useless in prototypes because values are copied. Do you see const
in the dup2
prototype?
It used to be a good idea to add const
to avoid if (x = 5)
errors, but a good compiler with warnings will warn you. I will not ask you to remove const
in a complex function body, but you should not ask others to use const
unless there is a clear benefit.
|
||
|
||
|
||
void VstEffectControlDialog::togglePluginUI( bool checked ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
void VstEffectControlDialog::togglePluginUI( const bool checked )
plugins/vst_base/CMakeLists.txt
Outdated
@@ -3,7 +3,7 @@ IF(LMMS_SUPPORT_VST) | |||
INCLUDE(BuildPlugin) | |||
|
|||
IF(LMMS_BUILD_WIN32) | |||
ADD_DEFINITIONS(-DPTW32_STATIC_LIB) | |||
ADD_DEFINITIONS(-DPTW32_STATIC_LIB -std=c++0x) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c++0x
The working draft of the upcoming ISO C ++ 0x standard. This option enables experimental features that are likely to be included in C ++ 0x. The working draft is constantly changing, and any feature that is enabled by this flag may be removed from future versions of GCC if it is not part of the C ++ 0x standard.
Your commit say you wanted to enable C++11, so, it's more like -std=c++11
I guess.
Or the compiler on win32 is old, and what's considered like experimental at the time is now C++11 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's more like -std=c++11 I guess
Same effectiveness. c++0x
is fine for now. We can switch it down the road as more compilers adopt the official standard. BTW, this specific change superseded by 607d3f4; Can be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GCC supports -std=c++14 ; so I guess -std=c++0x includes C++14 and some features of C++17.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess -std=c++0x includes C++14 and some features of C++17.
Perhaps but that should be equally called C++1y
, etc.
https://herbsutter.com/2011/08/12/we-have-an-international-standard-c0x-is-unanimously-approved/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess -std=c++0x includes C++14 and some features of C++17.
It does not.
plugins/vst_base/RemoteVstPlugin.cpp
Outdated
@@ -464,24 +478,103 @@ RemoteVstPlugin::~RemoteVstPlugin() | |||
|
|||
|
|||
|
|||
#ifdef USE_LINUX_EMBEDDER | |||
static void checkExitStatus( int status ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static void checkExitStatus( const int status )
plugins/vst_base/RemoteVstPlugin.cpp
Outdated
@@ -619,9 +712,34 @@ void RemoteVstPlugin::init( const std::string & _plugin_file ) | |||
|
|||
|
|||
|
|||
#ifdef USE_LINUX_EMBEDDER | |||
static void assert_dup2( int oldfd, int newfd ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static void assert_dup2( const int oldfd, const int newfd )
plugins/vst_base/embed-window.cpp
Outdated
|
||
void EmbedderApplication::readCommand() | ||
{ | ||
int c = getchar(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const int c = getchar();
plugins/vst_base/embed-window.cpp
Outdated
const char * title = argv[1]; | ||
unsigned int windowId = strtol( argv[2], NULL, 16 ); | ||
int width = strtol( argv[3], NULL, 16 ); | ||
int height = strtol( argv[4], NULL, 16 ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const unsigned int windowId = strtol( argv[2], NULL, 16 );
const int width = strtol( argv[3], NULL, 16 );
const int height = strtol( argv[4], NULL, 16 );
plugins/vst_base/embed-window.cpp
Outdated
|
||
QTimer::singleShot( 0, app, SLOT( applicationReady() ) ); | ||
|
||
int ret = app->exec(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const int ret = app->exec();
{ | ||
public: | ||
void init( const char * title, unsigned int windowId, int width, | ||
int height ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
void init( const char * title, const unsigned int windowId, const int width, const int height );
virtual ~EmbedderApplication(); | ||
|
||
void init( const char * title, unsigned int windowId, int width, | ||
int height ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
void init( const char * title, const unsigned int windowId, const int width, const int height );
Unreproducible with Qt 5.7.1 and Wine 1.8.6. If I tamper with the window system, I get that behavior. @karmux, do you see any errors in the console? When you have the empty window, what is the output of |
@jasp00 I'd like to test this again with ouput of command you gave but can't compile this anymore. Compilation error:
wine-devel and qt5-embed merge result:
|
@karmux, could you explain the screenshot? In the taskbar on the left, what application does the white window icon represent? The one between the selected VeSTige logo and the LMMS logo. Could you try running Wine 2.0? |
@jasp00, white icon is actual VST instrument window on the left and red/green VST icon is blank Qt window on the right. |
Wine 2.0 works. @karmux, according to #2856 (comment) and #3295 (comment), it looks like your Qt 5 environment has trouble embedding native windows. Could you try 1ded76b and post the debug information? |
@jasp00 That's an issue with certain window managers, as I have stated in #3295 (comment). I've been able to reproduce it with both PRs on Plasma and i3, bot not on Xfce for example. I already debugged this issue in #3295 with lines similar to those in 1ded76b, which showed the correct window ids with Qt 5.6.1, Plasma desktop, and Wine 2.4. I expect @karmux will get the same results. I could work around it by sleeping ( |
Interestingly GTG DPC 3 once opened correctly but I couldn't reproduce it. |
Because embedding native windows on Qt 5 is not reliable on some systems, I propose to let Wine handle the window interface. There is an issue with this procedure:
This may happen because Wine has already accepted the close event. This solution affects usability, but it is the best compromise. |
Continued at #3497. |
This fixes #2855, but the new window causes glitches. Initially, the window may not be painted properly. When any window is moved, it may shake.