Avatar

Please consider registering
Guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed sp_TopicIcon
Issues with CUICtrl with x64 Plugin
No permission to create posts
January 7, 2015
5:52 pm
Avatar
tobias_hd
Member
Members
Forum Posts: 7
Member Since:
October 16, 2014
sp_UserOfflineSmall Offline

Hello Will et.al.,

I have a Win32 plugin based on RackAFX that I am currently porting to x64. I ran into issues with the huge stack memory that is consumed by the initUI methods. Those methods store all CUICtrl UI controls on the stack and not on the heap. I have quite a high number of controls (~90) and so on 64bit (where more stack memory is consumed) the stack memory gets close to 1 MB (default limit on VS C++).

As a quick fix / workaround I have reduced the size of the following variables to char[64]:

char cName[1024];
char cUnits[1024];
char cVName[1024];
char cMeterVName[1024];

Do they really have to be 1024 characters?
Or is there an option to change the CUICtrl behavior to dynamic allocation so that it will occupy the heap and not the stack?

Thanks and best regards,

Tobias Laugh

January 7, 2015
8:43 pm
Avatar
W Pirkle
Admin
Forum Posts: 143
Member Since:
January 28, 2017
sp_UserOfflineSmall Offline

Hi Tobias

Wow - 90 controls? What kind of plugin is it?

Yes, there are several sets of large arrays that get initialized in initUI(). And, no, the char arrays do not need to be 1024 in length; this was a paradigm left over from an old consulting project where the strings had to have 1024 as the limit - so just an old habit that worked its way into the code.

I can easily change these to 64 characters in length, but not so easily change the allocation to dynamic, though I may add this to the list for the next (post v6.5) update.

However, since you are changing them in pluginconstants.h you will need to keep re-using that particular file as it will be re-generated for each new project.

- Will

January 7, 2015
9:04 pm
Avatar
Tom
Admin
Forum Posts: 65
Member Since:
April 3, 2014
sp_UserOfflineSmall Offline

Hi Tobias,

the CUICtrl objects are copied in m_UIControlList.append(ui0); So you're right, during the initUI call, all the original CUICtrl objects are stack objects. But after they have been copied in m_UIControlList.append() (into heap objects) they are not needed anymore and just occupy stack space. You could try to add some { } around the block of each control, so that there's only one object alive on the stack at a time.

Which version of RackAFX are you using? I'm asking because the current RackAFX UI won't work with x64 in the current RackAFX release. So if you port to 64bit, you would need to write your own UI, but then you won't need to deal with CUICtrl objects.

Another option to solve the issue would be to just increase the stack memory in the linker settings Wink.

Tom

January 7, 2015
9:10 pm
Avatar
W Pirkle
Admin
Forum Posts: 143
Member Since:
January 28, 2017
sp_UserOfflineSmall Offline

Tom is correct

Changing the lengths of these arrays will change the memory footprint for the base class object and it will crash RackAFX. If I do change these array limits, I will also have to set a RAFX version number that you can find in the pluginconstants.h file CURRENT_PLUGIN_API and I will have to recompile RackAFX itself with the updated version.

When RackAFX loads a DLL, it checks this value and performs the necessary upgrade as needed. Since the initial release of RackAFX in 2012, this value has never changed, so no one (except my pre-2012 students, who experienced the upgrades often) has ever seen the message. So, changing these would require a recompile of RackAFX. This can't happen until after the official release of the new v6.5, whose GUIs are 64-bit capable.

The old and now outdated RackAFX GUIs used assembly language for some of the controls including the knobs, so that prevents easy porting to 64-bit. They also link to a library that is 32-bit only.

- Will

January 8, 2015
4:55 am
Avatar
tobias_hd
Member
Members
Forum Posts: 7
Member Since:
October 16, 2014
sp_UserOfflineSmall Offline

Hello Will and Tom,

thanks for the prompt reply.
I have developed an experimental synth plugin. For this I had chosen the following setup:
- RackAFX as test, designing and prototyping environment for the "core sound engine" and for definition of the parameters
- JUCE for the platform independent UI parts (I intend to do Win32, x64, and OS X / AU)
So I export the "engine" via "Make VST" and link it in my JUCE project.
For this setup I have developed some kind of Juce / RackAFX wrapper which binds the "engine" including the parameters to the JUCE UI. So: yes, I still need the CUICtrl objects from RackAFX here since they define the parameters of my core engine.
And since I am changing / adding parameters from time to time I do not want to loose the RackAFX option.

Back to the original topic:
I guess I like Tom's proposal with the { } around the control blocks most. But doing this manually in the coding each time I change a parameter is not so nice. Could this be added to RackAFX so that it is generated automatically?

Thanks so much,

Tobias

January 8, 2015
9:35 pm
Avatar
W Pirkle
Admin
Forum Posts: 143
Member Since:
January 28, 2017
sp_UserOfflineSmall Offline

Interesting setup with the RackAFX/JUCE combination!

You might be interested in the new RackAFX GUI Designer in v6.5 (slated for release next Monday, Jan 12) as it now produces platform-independent UIs which export to VST2/3/AU 32/64 bit. Just a thought (there are videos on the Home Page here that show some of this).

I will add the {} request to the RackAFX list for a future update.

- Will

January 17, 2015
10:32 pm
Avatar
W Pirkle
Admin
Forum Posts: 143
Member Since:
January 28, 2017
sp_UserOfflineSmall Offline

Hi Tobias

I have changed the RackAFX code so that it now dynamically declares the control objects and deletes them after use, which results in a massive reduction in stack size when entering initUI(). This will be available in the v6.5 version that we are still testing.

To convert your project over to use the new dynamic paradigm, just load the RackAFX project (.prj) and hit the Synchronize Code button in the toolbar or PlugIn->Synchronize Code, and the update will occur. You can then just recompile and go.

All the best,

Will

Forum Timezone: America/New_York

Most Users Ever Online: 36

Currently Online:
3 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Skyler: 47

Peter: 41

Derek: 41

clau_ste: 39

Frodson: 38

Gwen: 32

EZB: 24

lppier: 23

Msaldaña: 18

Jorge: 17

Member Stats:

Guest Posters: 1

Members: 476

Moderators: 1

Admins: 4

Forum Stats:

Groups: 11

Forums: 30

Topics: 482

Posts: 1876

Newest Members:

sam, annaharris, Marie Weaver, kev, Steven, Mr Anderson, mguy, omelc

Moderators: W Pirkle: 143

Administrators: Tom: 65, JD Young: 80, Will Pirkle: 0, W Pirkle: 143