# AAX resizing Bug and fix

**URL:** <https://forum.juce.com/t/aax-resizing-bug-and-fix/27116>\
**Category:** Audio Plugins\
**Created:** [April 6, 2018, 11:07am UTC](https://forum.juce.com/t/aax-resizing-bug-and-fix/27116 "2018-04-06T11:07:15Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![chkn](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/chkn/32/3862_2.png) [@chkn](https://forum.juce.com/u/chkn)\
**Post date:** [April 6, 2018, 11:07am UTC](https://forum.juce.com/t/aax-resizing-bug-and-fix/27116/1 "2018-04-06T11:07:15Z")

</div>

in the AAX wrapper GetViewContainer()-\>SetViewSize(newSize) can **FAIL**

this can happen when the plugin is too big (like described in the comments) but also if the offscreen bounds of the plugin are too big.

The result is that the internal size, and the window size are different, which may hide important controls in the plugin (including resize-symbol)

This is a fix for the AAX Wrapper  
It remembers the last successful resizing of the plugin, and if it wasn’t successful, it just applies the old size to the internal plugin again.  
A listener-loop (because of the component lister) should not happen, because it checks if the current size is equal to the new size)

```
			Point<int> lastCorrectSize;
			void childBoundsChanged(Component*) override
			{
				if (pluginEditor != nullptr)
				{
					auto w = pluginEditor->getWidth();
					auto h = pluginEditor->getHeight();

					if (lastCorrectSize.isOrigin() || lastCorrectSize.getX() != w || lastCorrectSize.getY() != h)
					{

						AAX_Point newSize((float)h, (float)w);
						if (owner.GetViewContainer()->SetViewSize(newSize) != AAX_SUCCESS)
						{
							// Because setViewSize has failed, we have set the internal plugin-size to the same size
							// this is tricky because the constrainer may not allow smaller bounds, but if we don't do it the internal size 
							// is bigger than UI element, and may hide important controls;
							
							auto bounds=pluginEditor->getBounds();
							bounds.setWidth(lastCorrectSize.getX());
							bounds.setHeight(lastCorrectSize.getY());
							pluginEditor->setBoundsConstrained(bounds);
							
						}
						else
						{
							lastCorrectSize.setXY(w, h);
							setSize(w, h);
						};
					};

				}
			}
```

---

<div class="post-metadata">

**Author:** ![chkn](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/chkn/32/3862_2.png) [@chkn](https://forum.juce.com/u/chkn)\
**Post date:** [April 9, 2018, 9:47am UTC](https://forum.juce.com/t/aax-resizing-bug-and-fix/27116/2 "2018-04-09T09:47:41Z")

</div>

bump

---

<div class="post-metadata">

**Author:** ![fr810](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/fr810/32/841_2.png) [@fr810](https://forum.juce.com/u/fr810)\
**Post date:** [April 9, 2018, 2:07pm UTC](https://forum.juce.com/t/aax-resizing-bug-and-fix/27116/3 "2018-04-09T14:07:53Z")

</div>

This is now fixed on develop with commit [`b4da453`](https://github.com/WeAreROLI/JUCE/commit/b4da4539f16e3843583ea5f35fb2a1cff57611d1).

---

<div class="post-metadata">

**Author:** ![chkn](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/chkn/32/3862_2.png) [@chkn](https://forum.juce.com/u/chkn)\
**Post date:** [April 9, 2018, 3:07pm UTC](https://forum.juce.com/t/aax-resizing-bug-and-fix/27116/4 "2018-04-09T15:07:25Z")

</div>

thanks, i cannot compile because

`jucedev\modules\juce_audio_plugin_client\aax\juce_aax_wrapper.cpp(606): error C2872: 'Rectangle': ambiguous symbol`

– \> have to use juce::Rectangle

---

<div class="post-metadata">

**Author:** ![fr810](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/fr810/32/841_2.png) [@fr810](https://forum.juce.com/u/fr810)\
**Post date:** [April 9, 2018, 3:26pm UTC](https://forum.juce.com/t/aax-resizing-bug-and-fix/27116/5 "2018-04-09T15:26:33Z")

</div>

Thanks I’ve pushed a fix for this to develop (it will appear shortly). Just to avoid this in the future - with which compiler are you seeing this. Our CI system did not flag this and we build with VS2015 and VS2017, Xcode.

---

<div class="post-metadata">

**Author:** ![chkn](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/chkn/32/3862_2.png) [@chkn](https://forum.juce.com/u/chkn)\
**Post date:** [April 9, 2018, 3:46pm UTC](https://forum.juce.com/t/aax-resizing-bug-and-fix/27116/6 "2018-04-09T15:46:28Z")

</div>

VS2017

---

<div class="post-metadata">

**Author:** ![fr810](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/fr810/32/841_2.png) [@fr810](https://forum.juce.com/u/fr810)\
**Post date:** [April 9, 2018, 3:47pm UTC](https://forum.juce.com/t/aax-resizing-bug-and-fix/27116/7 "2018-04-09T15:47:53Z")

</div>

Hmmm that’s odd. We build with VS2017 as well. Do you include any extra headers? Which AAX SDK version are you using?

---

<div class="post-metadata">

**Author:** ![chkn](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/chkn/32/3862_2.png) [@chkn](https://forum.juce.com/u/chkn)\
**Post date:** [April 9, 2018, 3:58pm UTC](https://forum.juce.com/t/aax-resizing-bug-and-fix/27116/8 "2018-04-09T15:58:49Z")

</div>

#define AAX\_SDK\_VERSION ( 0x0203 )

No extra headers

In projucer windows target platform is 8.1 (??? i never had set this, i will try remove it, to use the default value)

---

<div class="post-metadata">

**Author:** ![chkn](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/chkn/32/3862_2.png) [@chkn](https://forum.juce.com/u/chkn)\
**Post date:** [April 9, 2018, 4:05pm UTC](https://forum.juce.com/t/aax-resizing-bug-and-fix/27116/9 "2018-04-09T16:05:04Z")

</div>

with default sdk same problem

---

<div class="post-metadata">

**Author:** ![chkn](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/chkn/32/3862_2.png) [@chkn](https://forum.juce.com/u/chkn)\
**Post date:** [April 9, 2018, 4:11pm UTC](https://forum.juce.com/t/aax-resizing-bug-and-fix/27116/10 "2018-04-09T16:11:04Z")

</div>

rectangle from wingdi.h

include hierarchy

```
Note: including file: jucedev\modules\juce_audio_plugin_client\aax\../utility/juce_IncludeSystemHeaders.h
Note: including file: C:\Program Files (x86)\Windows Kits\10\Include\10.0.16299.0\um\windows.h
Note: including file: C:\Program Files (x86)\Windows Kits\10\Include\10.0.16299.0\um\wingdi.h
```

---

<div class="post-metadata">

**Author:** ![railjonrogut](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/railjonrogut/32/505_2.png) [@railjonrogut](https://forum.juce.com/u/railjonrogut)\
**Post date:** [April 9, 2018, 7:38pm UTC](https://forum.juce.com/t/aax-resizing-bug-and-fix/27116/11 "2018-04-09T19:38:32Z")

</div>

See if this helps:

> [@'Rectangle' : ambiguous symbol](https://forum.juce.com/t/rectangle-ambiguous-symbol/6891/5):
>
> I’m having exactly this problem while trying to arrange some existing sources in “juce module” fashion. One of these .cpp files needs windows.h so I put an #include for it into the main “juce\_module.cpp” file. This causes all the other .cpp files that use Rectangles to complain like shown above. What is the preferred way to cope with this?

> [@](#):
>
> define NOGDI before any Windows headers:
> 
> #if defined(\_MSC\_VER)
> 
> #define NOGDI  
> #include \<windows.h\>  
> #include \<WinBase.h\>  
> #include
> 
> #endif  
> You can also define WIN32\_LEAN\_AND\_MEAN after defining NOGDI (if that’ll work for you).

Rail

---

<div class="post-metadata">

**Author:** ![fr810](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/fr810/32/841_2.png) [@fr810](https://forum.juce.com/u/fr810)\
**Post date:** [April 10, 2018, 8:09am UTC](https://forum.juce.com/t/aax-resizing-bug-and-fix/27116/12 "2018-04-10T08:09:39Z")

</div>

Thank you. I’ve already just put `juce::` namespace in front of the single use of `Rectangle`. But good to know.

---

<div class="post-metadata">

**Author:** ![APRiedweg](https://avatars.discourse-cdn.com/v4/letter/a/f04885/32.png) [@APRiedweg](https://forum.juce.com/u/APRiedweg)\
**Post date:** [July 8, 2026, 10:03am UTC](https://forum.juce.com/t/aax-resizing-bug-and-fix/27116/13 "2026-07-08T10:03:17Z")

</div>

Hi all,

Digging into juce\_audio\_plugin\_client\_AAX.cpp (JUCE 8.0.14), I can see the childBoundsChanged/resizeHostWindow mechanism already does what the 2018 thread proposed (checking SetViewSize’s return value):

bool resizeHostWindow()  
{  
if (pluginEditor != nullptr)  
{  
auto newSize = convertToHostBounds ({ (float) pluginEditor-\>getHeight(),  
(float) pluginEditor-\>getWidth() });  
return owner.GetViewContainer()-\>SetViewSize (newSize) == AAX\_SUCCESS;  
}  
return false;  
}

void childBoundsChanged (Component\*) override  
{  
if (resizeHostWindow())  
{  
setSize (pluginEditor-\>getWidth(), pluginEditor-\>getHeight());  
lastValidSize = getBounds();  
}  
else  
{  
pluginEditor-\>setBoundsConstrained (pluginEditor-\>getBounds().withSize (lastValidSize.getWidth(),  
lastValidSize.getHeight()));  
}  
}

Setup: JUCE 8.0.14, Pro Tools Developer (latest). Plugin works fine in VST3/AU — issue is AAX-only.

Symptom: On first insert on a new track, the editor opens at a much smaller size than the frame Pro Tools reserves (grey gap around it). Dragging the corner manually fixes it instantly.

My read of the code: lastValidSize defaults to an empty Rectangle. If SetViewSize fails on the very first childBoundsChanged call (likely because the host’s ViewContainer isn’t fully ready yet when the editor first reports its size), the editor gets clamped down to lastValidSize (0x0, constrained to the resize limits minimum) instead of the size I actually requested in the constructor. This would explain both the small initial size AND why repeatedly retrying setSize() from a timer didn’t help — each retry re-triggers childBoundsChanged, and if the host still isn’t ready, it gets clamped back down again.

Questions:

1. Is this understanding correct?
2. Is there a known timing/readiness signal I should wait for before requesting my initial size, to avoid landing in the SetViewSize-fails branch?
3. Would initializing lastValidSize to the intended starting size (rather than leaving it default-constructed) be a reasonable local patch, or is there a cleaner supported way to influence the initial AAX view size?

Thanks!
