Juce for only GUI


#1

Hi Jules,

I am working on an existing VST plugin that is using MFC on windows to use JUCE as UI. The current plugin has all the code derived from AudioEffectX and AEffEditor. So i am not touching that part to port over to Juce Audio plugin framework.

What i want to do is create component derived window and put the gui controls in there in AEffeditor::open method. The problem is Paint(Graphics& g) is not called for that component when i load the plugin. Is there something i am missing to initialize ?

Here is what i did:
I added code in DllMain to set the plugin instance and call juce_initializeGUI() and corresponding shutdown when dll unloads.
Here is what i added in

[code]AEffEditor::open(void* ptr)
{
CPlugInDlg* pComp = new CPlugInDlg(NULL, NULL, m_pPlug);
//m_pCWnd->addToDesktop (0);
pComp->setTopLeftPosition (0, 0);
pComp->setSize(m_eRect.right-m_eRect.left, m_eRect.bottom-m_eRect.top);
pComp->addMouseListener(m_pCWnd, true);
pComp->addToDesktop(0);

	HWND hostWindow = (HWND) ptr;
	HWND editorWnd = (HWND) pComp->getWindowHandle();

	SetParent (editorWnd, hostWindow);

	DWORD val = GetWindowLong (editorWnd, GWL_STYLE);
	val = (val & ~WS_POPUP) | WS_CHILD;
	SetWindowLong (editorWnd, GWL_STYLE, val);

	pComp->setVisible (true);

}[/code]

The part of code that calls addToDesktop() and then changes the style i took it from Juce AudioPlugin framework.

Appreciate if you could let me know what i am doing wrong.

Thanks
Sathish


#2

jeez… so you’re wrapping the plugin wrapper in your own MFC plugin wrapper… you’re certainly a sucker for punishment! Sounds like an absolutely barmy way of doing it. Why not write the whole thing in visual basic for a laugh, too!

I can’t see anything immediately wrong with your code snippet, but it’s a very complex beast. You’ll need to spend a lot of time debugging the windows callback to see what’s going on.

…or just move your audio processing code into the juce wrapper classes, and get rid of the atrocity that is MFC.


#3

Thanks for the reply jules.
Ok. i think i might have put it wrong. The existing plugin is using MFC for UI only. The code that derives from AudioEffectX and AEffEditor are not using MFC. I am trying to replace MFC with JUCE. say for e.g in AEffEditor::open called, the plugin used to create a CWnd derived object and set that as a child of the HWND passed. The CWnd derived object will create bunch of CSliders, CButtons etc… Now i have eliminated all CWnd derived code and trying to create a Component derived object and set that as child of HWND passed. That is what the code snippet that posted earlier does. I have removed the MFC dependency… But still Paint Message is not coming to the Component derived object.

Hope that clears.

Thanks


#4

Ok, but it still seems crazy… No matter how complex your audio processing code is, moving it into the juce framework must be trivial compared with trying to embed one GUI framework inside another?


#5

I have sorta similar situation - In may case I’m trying to write and DXi/MFX wrapper for the JuceAudioPlugin framework. My main problem is that the DXi/MFX uses COM interfaces that expect DialogProc callbacks for their UI, but Juce at it’s lowest level on the Win32 side on with WindowProc callbacks, as it doens’t really have for dialogs, I guess. Any help would be greatly appreciated.


#6

sorry I should have added that I’m not using MFC, I trying to write DXi/MFX in the same way you wrote VST/RTAS and AU wrappers for the JuceAudioPlugin framework.


#7

Have to admit I know nothing about COM at all, so no idea what a DialogProc is… If you’ve got anything substantial though, I’d be interested in sharing and collaborating on getting a DX wrapper working…


#8

I understand the COM stuff, since that’s the development environment framework I ulready se at at work. I already started on developing the Cakewalk MFX wrapper but unstuck when had to create the UI portion because it uses OLE PropertyPages for UIs rather than normally win32 windows. in drilling into the juce source codeto no availoc I’d seen that at the core of the UI code you have these component peers in which for example for windows implementation there juce_win32_windowing.cpp, etc. I tried modifying that include support for StaticDialogProc calls as well as WindowProc calls, but to no avail, so in the end have to my whole VST plugin aource code I had from JUCE to initially MFC/MFX, and then start building from there. I didn’t really need a wrapper for VSTis or VST audio effects, since the Host I was using (Cakewalk Project5) had a wrapper to support those - It just didn’t support midi only VST FX plugins.


#9