obiwanjacobi / vst.net

Virtual Studio Technology (VST) for .NET. Plugins and Host applications.
https://obiwanjacobi.github.io/vst.net/index.html
GNU Lesser General Public License v2.1
420 stars 53 forks source link

PluginCommandStub.Commands.EditorGetRect(out Rectangle wndRect) seems to always return Rect(X=0, Y=0, Width=400, Height=300) #63

Closed paulpv closed 1 year ago

paulpv commented 2 years ago

Describe the bug I am so far only using Jacobi.Vst.Samples.Host with https://www.reaper.fm/reaplugs/. Whenever I show any of their Editors, the returned Rect size is always 400x300. image

To Reproduce Steps to reproduce the behavior:

  1. Install https://www.reaper.fm/reaplugs/
  2. Launch Jacobi.Vst.Samples.Host, load any of the plugins
  3. Set a breakpoint at EditorFrame.ShowDialog call to PluginCommandStub.Commands.EditorGetRect
  4. View the plugin's Editor

Expected behavior The plugin returns the correct Rect size. I have stepped through the code in OBS Studio and it loads the correct Rect size from all reaplugs.

Actual behavior Rect size always comes back as Rect(X=0, Y=0, Width=400, Height=300)

Desktop:

paulpv commented 2 years ago

See https://github.com/NightVsKnight/vst.net/commit/855f6291e2134c3554a93be10f864b1868ced7f3

It returns non-400x300 rect when queried in OnLoad, which appears to be the more appropriate place to resize the control.

obiwanjacobi commented 1 year ago

My guess is that this plugin just returns 400x300 as a default value until it has initialized fully. I have enhanced the Host Sample to implement a more robust Window Size handling of the plugin editor window. The EditorGetRect call after the plugin has initialize yield more sensible values. I have also forwarded the SizeWindow call on the host command stub to the EditorFrame. This would allow dynamically sizing plugin editors to adjust the containing editor window.