Hi all,
I’m running the plugin host on Mac OSX 10.7 ( 32-bit) and loading a juce VST plugin into it, also built on Mac 32-bit OSX 10.7. Both the plugin and the host works fine on mouse clicks and processes.
My problem is that the host crashes when it is minimized and then restored. I tried setting up the debugger on the plugin host solution, and narrowed it down to juce_VSTPluginFormat.cpp:
void removeView (HIViewRef)
{
if (owner.isOpen)
{
owner.isOpen = false;
owner.dispatch (effEditClose, 0, 0, 0, 0);
owner.dispatch (effEditSleep, 0, 0, 0, 0);
}
}
It seems that the plugin is deleted when the host is minimized and that change is picked up in juce_mac_CarbonViewWrapperComponent.h :
[code]void componentVisibilityChanged()
{
if (isShowing())
createWindow();
else
deleteWindow();
setEmbeddedWindowToOurSize();
}[/code]
juce_mac_CarbonViewWrapperComponent.h :
[code]void deleteWindow()
{
removeView (embeddedView);
embeddedView = 0;
if (wrapperWindow != 0)
{
NSWindow* ownerWindow = getOwnerWindow();
if ([[ownerWindow childWindows] count] > 0)
{
[ownerWindow removeChildWindow: carbonWindow];
[carbonWindow close];
}
RemoveEventHandler (eventHandlerRef);
DisposeWindow (wrapperWindow);
wrapperWindow = 0;
}
}[/code]
I was looking at other threads in the Juce forum and stumbled across this : http://www.rawmaterialsoftware.com/viewtopic.php?f=2&t=10168&hilit=plugin+goes+black
The changes that Jules made in regard to this thread is to not destroy the plugin when the host is minimized in windows. Making that change in Mac kinda fixed my problem as well:
juce_VSTPluginFormat.cpp:
[code]class InnerWrapperComponent : public CarbonViewWrapperComponent
{
public:
InnerWrapperComponent (VSTPluginWindow& owner_)
: owner (owner_), alreadyInside (false)
{
}
~InnerWrapperComponent()
{
owner.dispatch (effEditClose, 0, 0, 0, 0); //Delete the plugin Window when the host closes.
deleteWindow();
}
HIViewRef attachView (WindowRef windowRef, HIViewRef rootView)
{
owner.openPluginWindow (windowRef);
return 0;
}
void removeView (HIViewRef)
{
if (owner.isOpen)
{
owner.isOpen = false;
//owner.dispatch (effEditClose, 0, 0, 0, 0); //omit deletion of the plugin Window.
owner.dispatch (effEditSleep, 0, 0, 0, 0);
}
}[/code]:
I’m still a newbie so I’m not sure whether this is necessarily the solution to the problem, so any advice on this from Jules and others is appreciated! BTW, I updated JUCE about 2 months ago, so am not sure if this is solved somewhere else but AFAIK the files in question are the latest from the GIT repository. Updating the whole JUCE again would mean integrating those changes which would take some time!