psycha0s / airwave

Airwave is a WINE-based VST bridge, that allows for the use of Windows 32- and 64-bit VST 2.4 audio plugins with Linux VST hosts
MIT License
575 stars 35 forks source link

Embedded plugin window has a wrong position #41

Open psycha0s opened 8 years ago

psycha0s commented 8 years ago

Copied from issue #23 discussion:

I can load the plugin and I can hear it's working but the gui is black (which is new so there is evidence that something has changed): 2016-03-21-202720_1920x1174_scrot

When I maximize the window I see a part of the GUI (but I cannot click anything because probably the real 'hitboxes' are somwhere else in one of our 11 dimensions): 2016-03-21-204112_1920x1174_scrot

As soon as I close the plugin window Ardour freezes and crashes. Tested with LE456 64bit, LE456 32 bit and Amplitube 4 64 bit.

I did update my links using the Airwave manager.

I'm on Ubuntu 14.04.4 LTS (kernel 3.13.0-83-generic, x86_64) I have Ardour 4.7.0, jack2 (1.9.11-20160223) started using Cadence with the following settings: 2016-03-21-203526_759x572_scrot

Snevzor commented 8 years ago

wine --version produces 'wine 1.8', but synapic shows I have the staging 1.9.6? Weird: 2016-03-31-201457_1920x1174_scrot

Snevzor commented 8 years ago

Fyi, in release 1.3.1 I couldn't control the GUI, but in 1.3.2 I can, so I probably made a faulty assumption that it was related to the offset. In both versions Ardour freezes and ultimately crashes when closing the embedded plugin window.

psycha0s commented 8 years ago

It seems that you're using wine with RT patches (wine-rt). I don't know whether it's the reason or not, but I think that it could be the root of the problem. At least, I highly recommend you to try plain wine or wine-staging (especially since you have it already installed). The RT patchset gives you almost no benefits. You could have a lower latency with it but a plain wine could also give you a relativetly low (256 frames) latency. It's good enough for producing music, as I think.

Snevzor commented 8 years ago

Ok, removed RT and I'm now at 1.6.2. GUI is still shifted, but Ardour does not crash anymore when closing the embedded window.

Snevzor commented 8 years ago

Could this be related to my dual monitor setup? I have a second monitor on the left of my primary screen but my X,Y coordinates are actually 0 at my left (secondary screen). So if I start the embedded window on my secondary screen and then stretch it over to my primary I can see the complete GUI and it actually matches the edge of the screen:

2016-03-31-222610_3600x1200_scrot

I don't think that this should matter because the X,Y zero's should be in the embedded window itself, but you never know. Maybe this is the bug :8ball:

psycha0s commented 8 years ago

wine 1.6 is too old. Could you try wine 1.8?

sudo add-apt-repository ppa:ubuntu-wine/ppa
sudo apt-get update
sudo apt-get install wine
psycha0s commented 8 years ago

Of course, it could be an airwave issue. But I never saw this before and I know that XEMBED support was added to wine in branch 1.7.

Snevzor commented 8 years ago

Still the same: 2016-03-31-223837_3600x1200_scrot

But unfortunately Ardour crashes again after closing the plugin window :(

psycha0s commented 8 years ago

Ok, then I will investigate this issue more presisely. I can't reproduce it on my side, so it will not be easy :-/

Snevzor commented 8 years ago

I understand, just let me know what I can do to help testing this.

I just changed the resolution of my left screen to 800x600 to see if that changes the offset in the plugin window and it actually does: 2016-03-31-232149_2720x1200_scrot So I can now see it fully on my primary screen and it has a left offset of 800 + edge of window + additional small black offset around the gui: 2016-03-31-232358_1920x1174_scrot

Also, I do think the actual size of the popup when opening initially is the same size as the gui, so it's just the location of the drawing or something... .

Hope this helps.

psycha0s commented 8 years ago

The offset could depend on the initial position of the outer window. But as I can see, only X coordinate has the offset, which is a little strange.

Snevzor commented 8 years ago

Indeed it's strange that it is only on the X axis, especially when you look at my screen layout which has a Y-offset already: 2016-03-31-234435_499x587_scrot

Do you mean the ardour window (as its parent) as outer window? When I test it with ardour on my secondary screen before opening the plugin window it gives exactly the same result as viewed in the screenshots in the above posts.

When I remove my secondary screen the offset-issue is gone: 2016-03-31-234832_1920x1200_scrot (The crashing issue still remains but that's possibly an unrelated bug)

psycha0s commented 8 years ago

I meant the window with buttons "add", "save", "delete", "bypass". Ardour creates it and then asks a plugin to place its editor inside as a child. According to your description, it can be a bug in wine's implementation of the XEMBED protocol. I will test it tomorrow on my other computer, which has two screens.

Snevzor commented 8 years ago

I'm not skilled enough to understand your code (I just know a bit of asm and C), but I spot a difference in parameters used with the SetWindowPos between Ardour and Airwave.

Airwave: SetWindowPos(hwnd_, 0, 0, 0, rect->right - rect->left, rect->bottom - rect->top, SWP_NOACTIVATE | SWP_NOMOVE);

Ardour: SetWindowPos (fst->windows_window, 0, 9999, 9999, 2, 2, 0);

Sorry if this is bollocks... a bit of wild guessing here. I don't find any SetWindowPos documentation explaining 9999 for X and Y. I should actually test this myself before posting but because of my lack of skills I'm unable to compile Airwave myself.

Btw, thanks a lot already on your effort concerning this issue! Greatly appreciated.

psycha0s commented 8 years ago

You're welcome! I can't reproduce your behaviour on my two-screen configuration, it's very strange. I still tend to think that your wine could be too old. Maybe it's a stupid question, but are you sure you have only one wine version installed and it's higher, than ~1.7.10 ?

psycha0s commented 8 years ago

I can't explain the values of 9999 for the SetWindowPos call too. But this Ardour's code is related to FST (FeSTige) and it's not executed when you're using the airwave.

x42 commented 8 years ago

it's all in pieces. Linux VST GUI size request in Ardour is in gtk2_ardour/lxvst_plugin_ui.cc:81

    _socket.set_size_request(
        new_width + _vst->state()->hoffset,
        new_height + _vst->state()->voffset)

new_width, new_height are from the plugin's "audioMasterSizeWindow" callback (libs/ardour/session_vst.cc:326, the offsets are zero in case of LXVST (calloc() in vstfx_new() ./libs/ardour/linux_vst_support.cc:85)

Unless I've missed something and short of a hidden bug somewhere, the only explanation would be that the VST plugin returns a wrong size in audioMasterSizeWindow.

x42 commented 8 years ago

PS. there was a change in Ardour 4.4-643-gd959461 to allow resizable/scalable Linux VST UIs (mainly for the benefit of u-he). Versions prior to that did not forward size-requests to X11 child windows but Ardour 4.7 mentioned above does.

Snevzor commented 8 years ago

Thanks for checking @x42!

Sorry for the late reply @phantom-code. I'm pretty sure I have wine 1.8. Additional wine related installed packages: wine-gecko, playonlinux, wine-mono, wineasio.

Llamatron2112 commented 8 years ago

I have the same problem in Ardour, and also in Renoise, but not in Bitwig. Wine version is a staging 1.9.9 patched with the xembed patch.

Snevzor commented 8 years ago

@Llamatron2112 what distro are you using? Do you also have a dual monitor setup? If so on which side is your primary monitor?

Llamatron2112 commented 8 years ago

I am using Arch, with a dual monitor setup and my primary monitor is to the right. Configuring my display to declare the secondary monitor to the right "fixes" the issue.

Snevzor commented 8 years ago

Ok so it's not desktop environment dependent. Still no clue if this bug originates in Wine or Airwave. Probably not Ardour since you have the same problem in Renoise. @phantom-code is it possible to install the same staging version of wine as mentioned by @Llamatron2112 and check with dual monitor setup with the right screen as primary?

muzzol commented 7 years ago

Im facing same problem with xfce4 and dual screen setup.

if I disable dual screen I can see plugin correctly, but with 2 monitors positioning is wrong.

I also get a wine error on closing ardour, but saving just befor makes it just annoying, not a stopper for me.

psycha0s commented 7 years ago

It looks like a wine or xfce issue. Sadly, I barely can do anything here.

ryan-ronnander commented 7 years ago

After finally stumbling here after many hours of troubleshooting...

My Setup:

I was elated to get Reaper working with some old school Windows based VST plugins (Guitar Rig 3 for an old project). This was on my laptop. When I moved to an identical setup using my desktop machine (dual monitors) my plugins were blank.

Sure enough, going back to a single monitor fixes the issues and plugins render as expected.

ryan-ronnander commented 7 years ago

@phantom-code Work around for this issue: run the following command:

# Disable primary monitor before launching DAW software
xrandr --noprimary

# Re-enable primary monitor after DAW session
xrandr --output <monitor_name> --primary

In my case I run xrandr --output DVI-D-0 --primary after closing Reaper. The above commands allow me to use dual monitors with correctly rendered VST plugins. As always, you can use the "Display Settings" configuration GUI in [insert desktop environment here] to set the same values.