Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Bug Reports

Reply
 
Thread Tools Display Modes
Old 12-22-2023, 02:53 AM   #1
mike@overtonedsp
Human being with feelings
 
mike@overtonedsp's Avatar
 
Join Date: Sep 2018
Location: Oxford, England
Posts: 210
Default [CLAP] Plugin GUI Size not Persistent in Reaper 7.07 for Windows

I'm having problems getting Reaper to remember the plugin UI size of CLAP plugins on Windows. Opening / closing the UI or floating / embedding the UI appears to work, however if I save and then reload the session, reaper creates its own (host) plugin window the correct size, but fails to call any of the plugin's getSize, adjustSize setSize etc API functions, so the plugin window appears back to its default size. (All these functions get called when 'live' resizing the plugin so it appears Reaper knows about them)

All these calls work as intended and the UI size is correct on Linux and these are basically a direct port to Windows. Can anyone offer some clarification about how the UI size is supposed to persist across session save / load. Is this part of the CLAP standard, or something more ad-hoc like it was in VST2?

Last edited by mike@overtonedsp; 12-22-2023 at 07:56 AM.
mike@overtonedsp is offline   Reply With Quote
Old 01-02-2024, 11:56 AM   #2
mike@overtonedsp
Human being with feelings
 
mike@overtonedsp's Avatar
 
Join Date: Sep 2018
Location: Oxford, England
Posts: 210
Default

Just wanted to bump this - it would be good to know if this is a Reaper issue or not (I don't have any other Windows CLAP hosts or plugins to test with, and it would be good to know what the 'correct' way to ensure a resizable CLAP plug-in UI size persists across session saves currently is)
mike@overtonedsp is offline   Reply With Quote
Old 01-16-2024, 04:59 PM   #3
mike@overtonedsp
Human being with feelings
 
mike@overtonedsp's Avatar
 
Join Date: Sep 2018
Location: Oxford, England
Posts: 210
Default

Anyone?
mike@overtonedsp is offline   Reply With Quote
Old 01-16-2024, 06:14 PM   #4
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 15,701
Default

hmm do you have the "auto-size to plug-in" options set (prefs/plugins) ? If they are set it should ask the plugin for size and then size up/down to it... if not set, then it uses the last window size.
Justin is offline   Reply With Quote
Old 01-17-2024, 02:14 AM   #5
mike@overtonedsp
Human being with feelings
 
mike@overtonedsp's Avatar
 
Join Date: Sep 2018
Location: Oxford, England
Posts: 210
Default

Quote:
Originally Posted by Justin View Post
hmm do you have the "auto-size to plug-in" options set (prefs/plugins) ? If they are set it should ask the plugin for size and then size up/down to it... if not set, then it uses the last window size.
I tried various combinations of auto-size settings, the issue I have is that the (resized) plugin GUI dimesnions are persistent across opening and closing the plugin UI, but if I save and reload the session, the plugin returns to its 'default' size - even though reaper's plugin window still retains the custom size (and can_resize is set).
On Linux it seems as if Reaper actively tells the plugin to restore its UI to the custom size, using the clap_plugin_gui.set_size and clap_plugin_gui.adjust_size API whereas on Windows none of those calls happen.

On VST2 (and VST3) it seems as if we are storing the size as part of the plugin state (for VST2 this is understandable as VST2 was never really 'supposed' to support (live) resizable UIs) but with CLAP it seems as if this is assumed the host application's responsibility. It could be something weird is going on, though this is a direct port and it appears to work as expected on Linux. I guess I'm just looking for clarity about what the 'standard' method is?
Should a CLAP plugin expect the host to formally save / restore a custom UI size as part of the session, or should the plugin store its own custom size as part of some local state? Or should the plugin be relying on some OS specific Window resizing hints from the 'parent' Window to informally resize itself? (or all of the above)
mike@overtonedsp is offline   Reply With Quote
Old 01-17-2024, 09:07 AM   #6
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 15,701
Default

Looking at this now. For CLAP plug-ins, you can look in the .rpp file to see if it is saving the size -- in the <CLAP chunk, there should be a "CFG" line, which should be "CFG flags w h preset_name". Are w/h set there?


When displaying the UI, REAPER will:


1) call clap_plugin_ui->create()
2) if the above w/h are set nonzero, and clap_plugin_ui->can_resize() is true, resize the container (HWND or NSView or X11 window) to w/h
3) if not 2 (w/h are 0 or can_resize() returns false) - REAPER will query clap_plugin_ui->get_size() for width/height, and size the container to that
4) call clap_plugin_ui->set_parent / clap_plugin_ui->show
Justin is offline   Reply With Quote
Old 01-17-2024, 09:55 AM   #7
mike@overtonedsp
Human being with feelings
 
mike@overtonedsp's Avatar
 
Join Date: Sep 2018
Location: Oxford, England
Posts: 210
Default

Quote:
if the above w/h are set nonzero, and clap_plugin_ui->can_resize() is true, resize the container (HWND or NSView or X11 window) to w/h
In the <CLAP> section I have CFG 0 386 724 "" - implying the dimensions are being saved correctly, so, does this mean if the w/h saved in the .rpp file are non zero then Reaper will resize the container window? This appears to be working, however on Linux it seems as if the plug-in's clap_plugin_gui.adjust_size or clap_plugin_gui.set_size (I can't remember exactly which so I would have to check a debug build for linux) also gets called to tell the plugin to resize its GUI to match that of Reaper's container Window. On Windows this doesn't appear to be happening.

Is the 0 preceding the size significant? (As far as I can tell I have set can_resize true so reaper should know the UI can be resized, and it all behaves as expected while the project is open, just doesn't restore correctly when reloading the project)
mike@overtonedsp is offline   Reply With Quote
Old 01-17-2024, 10:01 AM   #8
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 15,701
Default

Ah yes, we are not calling set_size() on the initial create... the assumption is that the plug-in would size itself to the container window in set_parent(). If this is a problem we can add the manual set_size() call immediately before/after calling set_parent() (which would you prefer?).
Justin is offline   Reply With Quote
Old 01-17-2024, 10:28 AM   #9
mike@overtonedsp
Human being with feelings
 
mike@overtonedsp's Avatar
 
Join Date: Sep 2018
Location: Oxford, England
Posts: 210
Default

Quote:
Ah yes, we are not calling set_size() on the initial create... the assumption is that the plug-in would size itself to the container window in set_parent(). If this is a problem we can add the manual set_size() call immediately before/after calling set_parent() (which would you prefer?).
I can work with either I think. Probably best to stick to the SDK - I've just found some documentation (comment in clap/ext/gui.h) which says:

Code:
/// Showing the GUI works as follow:
///  1. clap_plugin_gui->is_api_supported(), check what can work
///  2. clap_plugin_gui->create(), allocates gui resources
///  3. if the plugin window is floating
///  4.    -> clap_plugin_gui->set_transient()
///  5.    -> clap_plugin_gui->suggest_title()
///  6. else
///  7.    -> clap_plugin_gui->set_scale()
///  8.    -> clap_plugin_gui->can_resize()
///  9.    -> if resizable and has known size from previous session, clap_plugin_gui->set_size()
/// 10.    -> else clap_plugin_gui->get_size(), gets initial size
/// 11.    -> clap_plugin_gui->set_parent()
/// 12. clap_plugin_gui->show()
/// 13. clap_plugin_gui->hide()/show() ...
/// 14. clap_plugin_gui->destroy() when done with the gui
So it looks like step 9 is the issue, called before set_parent in the example

Last edited by mike@overtonedsp; 01-17-2024 at 10:33 AM.
mike@overtonedsp is offline   Reply With Quote
Old 01-17-2024, 07:09 PM   #10
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 15,701
Default

Thanks for bringing that comment to our attention! The next pre-release build will have this addition, I'll post here when it is available.
Justin is offline   Reply With Quote
Old 01-18-2024, 04:02 PM   #11
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 15,701
Default

7.09+dev0118+ should fix this, thanks!
Justin is offline   Reply With Quote
Old 01-19-2024, 04:10 AM   #12
mike@overtonedsp
Human being with feelings
 
mike@overtonedsp's Avatar
 
Join Date: Sep 2018
Location: Oxford, England
Posts: 210
Default

Quote:
Originally Posted by Justin View Post
7.09+dev0118+ should fix this, thanks!
Thanks, yes that seems to be working
mike@overtonedsp is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 05:17 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.