Correct VST window size FIX

I got to poking around the Juce VST demo, because I like using eXT to test juce vst ideas (drag and drop .dll’s makes it really nice)… anyway, the window size is wrong… and I guess this was reported in other apps outside of Tracktion.

Here’s the fix… look for the ‘else if (opCode == effEditGetRect)’ bit in JuceVstMain.cpp… and replace it with this chunk.

[code] else if (opCode == effEditGetRect)
{
if (editorComp != 0)
{

			ERect** rect;
			rect = (ERect**)ptr;
			editorSize.left = 0;
			editorSize.top = 0;
			editorSize.right = editorComp->getWidth();
			editorSize.bottom = editorComp->getHeight();
			
			*rect = &editorSize;

			return (long) &editorSize; 
        }
        else
        {
            return 0;
        }
    }[/code]

The problem: the old code never put the address to editorSize inside the dispatcher ptr. Seems like most apps need the ptr.

I’ve tested this in eXT, AudioMulch, FL, and T (of course)… and the windows are properly sized now. The resize isn’t functional yet (outside of T), but I’m working on that… :smiley:

Cheers Mod, I’ll put that in.

I notice you’ve changed the co-ords to 0, 0 - is that definately what the hosts are expecting? Obviously no point expecting the VST spec to actually explain this, but it seems odd to pass a rectangle if all it really wants is a size…

Yeah, I think you are s’posed to pass (0,0,width,length). Here is a segment from ADelayEditGUI (ADEditor.cpp) in the VSTSDK.

// init the size of the plugin rect.left = 0; rect.top = 0; rect.right = (short)hBackground->getWidth (); rect.bottom = (short)hBackground->getHeight ();

I also checked this against Toby’s delphi template, and it does the same. Honestly, I think the spec might very well ignore left and top… but if lemmings hurl themselves off cliffs, I say do as the lemmings do… :?: :lol:

BTW, I just tested using Rect.left, and Rect.top points other than 0 in AudioMulch and FruityLoops, and it does not display properly… while in eXT it’s fine. All that to say… Rect.left and Rect.top should definately be set to 0 for proper display.

The resize window thing is comming up… I think I’ve got it pretty sorted out now. :smiley:

IIRC there was some discussion on the vst mailing list about this.

The general consensus was basically ‘undefined behaviour’, set it to zero to be safe.

:roll:

Nothing like a well defined standard, and in the wise words of Stadtler and Waldorf, that is nothing like a well defined standard. :wink: