Plugin wrapper (SOLVED)


#1

Hi :)

This is my first post here ... browsing through forums, great community.

i am just starting with JUCE, real rookie here. 

I am trying to make a plugin which is hosting/wrapping an existing VST plugin.  This is already working in a  basic form. 

Have few questions, which will help me to progress with this thing...

1. as wrapped plugin is loaded before my plugin is actually shown on screen (in its constructor), size of wrapped plugin editor is yet unknown. What is the best approach to get editor size in this case. I've seen a solution using/forcing plugin editor add/remove from desktop inside constructor, doesn't seem very elegant.

2. how can i retrieve info about host current sample rate & buffer size, i need them to load wrapped plugin

3. More general: are there any known considerations, problems etc. when loading plugin inside plugin.

Thx in advance for your help!!

Cheers, Franci


#2

It's a tough choice for your first project! Yes, wrapping plugins is possible but there are endless edge-case problems when you do this depending on which hosts and plugins are involved.

To get the editor size, you may need to make it create a fake editor and check its size.

Buffer size and sample rate shouldn't be needed for creating a plugin - obviously you only get them when the audio starts, and they may change. If you can't create your plugin without them then you'll need to wait until the host starts running your wrapper plugin and those values become available.


#3

It's a tough choice for your first project! Yes, wrapping plugins is possible but there are endless edge-case problems when you do this depending on which hosts and plugins are involved.

Yes, i know it is tough one but it has to be done sooner or later :) Fortunately, only one specific VST plugin has to be wrapped, hopefully this makes things a bit less complex, still different hosts issues has to be considered.

To get the editor size, you may need to make it create a fake editor and check its size.

I am creating wrapped plugin editor in JUCE plugin's constructor. At that stage its size is still undefined, so i guess this is not the right place to do it ?? I guess it should be created after JUCE plugin window is actually displayed.

Buffer size and sample rate shouldn't be needed for creating a plugin - obviously you only get them when the audio starts, and they may change. If you can't create your plugin without them then you'll need to wait until the host starts running your wrapper plugin and those values become available.

I am loading a plugin using following code:

pluginInstance = pluginFormatManager.createPluginInstance (desc, getSampleRate(), getBlockSize(), pluginLoadError);

As you said,  looks like sample rate and block size at that stage don't affect plugin's behaviour so i'll leave it as it is for now.

Thx for help!!


#4

There might be some obvious reasons that I can't think of, but why must you know the size of the editor before it opens? Can't your wrapper editor not adjust dynamically on startup to the wrapped plugin size? Also, if you just wish to wrap the same specific plugin each time, then won't you already know the size of that plugin's editor?  As Jules said you only need the buffer and sample rate details when the audio starts. So it's best to make sure your instance gets this info in its prepareToPlay() method:


void PluginWrapper::prepareToPlay (double sampleRate, int samplesPerBlock)
{
if(pluginInstance)
        pluginInstance->prepareToPlay(sampleRate,samplesPerBlock);
}

#5

There might be some obvious reasons that I can't think of, but why must you know the size of the editor before it opens? Can't your wrapper editor not adjust dynamically on startup to the wrapped plugin size?

MASTER = my wrapper plugin

SLAVE = wrapped plugin

 

I am trying to find the right place/method in MASTER, where SLAVE editor is already shown, so i can adjust my MASTER editor size properly. If i do this in MASTER editor constructor, SLAVE editor is not yet shown, so its size is invalid.

 There may be simple solution for this, but i am having hard time to find/understand it.

Can't your wrapper editor not adjust dynamically on startup to the wrapped plugin size? Also, if you just wish to wrap the same specific plugin each time, then won't you already know the size of that plugin's editor?  

SLAVE support skins with different sizes,  so its size is not predictable.

As Jules said you only need the buffer and sample rate details when the audio starts. So it's best to make sure your instance gets this info in its prepareToPlay() method:

Great, i already have this, good to know the exact purpose of this method.

Big thx for your help!!!


#6

Ok, plugin wrapper is working on windows - editor size issue is not crucial for now.

 

I have encountered another issue with VST3 of my plugin. VST2 doesn't suffer from it.

There is some kind of "collision" message displayed multiple times in debugger output right after wrapped plugin editor is displayed ("Opening VST UI" message),

This leads to the really bad behaviour with effEditClose (screen corruption, blinking etc.), which lasts for few seconds), then things work again as expected.

Not sure what this collision means, what could be possible reason(s) for this ??

Again, this is happening only with VST3 version.

Thx!


#7

I'm afraid I haven't even started to look at VST3 yet, so I can't offer any insights there :(


#8

I am no VST3 expert either,  but i have both VST2 and VST3 option included and i always test them both.

I suspect that wrapped plugin might still have some hidden bugs and issues, so i'll do some additional troubleshooting there.


#9

I've found the origin of this message and it was not JUCE blush

Misbehavior remains the same, though ...


#10

I have another question. 

 

I've noticed that wrapped plugins doesn't react on mousewheel, but it should (it has support for it). Clicking on a plugin works as expected, though.

Anyway, looks like plugins can have several different implementations of mousewheel support. When i wrap some other plugins, they immediately work.

Looks in my case like mousewheel messages are not forwarded properly to wrapped plugin  ??

Any hints or ideas how to fix this ? 

Thx!

Franci


#11

I've just discovered VSTFormatManager dispatch() method :)

This one is a real life saver :)wink

 


#12

Still strugging with mousewheel issue.

I've tested few hosts with my wrapper and looks like mousewheel is working OK in Reaper & ProTools for example (wrapped plugin is reacting to mousewheel as expected) ...

.... but not in Cubase/Nuendo, EnergyXT, JUCE PluginHostDemo and some other hosts where it is simply ignored.

 

Any ideas how could this "working" hosts handle mousewheel differently - i am really running out of ideas here ???

Thx!

Franci


#13

Forgot to mention, this is Windows only, same code works on OSX version as expected.


#14

The two hosts you listed as handling the mouse wheel movements correctly are closed source, so it's rather impossible to tell how they might be handling mouse wheel events.


#15

I' am doing some heavy debugging, getting deeper into JUCE, understanding more and more of a background.

Mousewheel is defnitively detected in VSTPluginWindow object, all mousewheel related methods are called (internalMouseWheel, mouseWheelMove etc, etc.), but no mousewheel is detected in wrapped plugin - this is really, really weird.  Wrapped/hosted plugin is otherwise working great, all mouseclicks work as expected).

Another strange thing is, if i wrap JUCE based VST plugin, mousewheel works !!! Grrrr angry

Regulary writing about my investigation progress here, maybe someone will get a clue about what could be wrong here.

Thx for reading this.


#16

Have you implemented mouseWheelMove() in your hosted plugin editor?


#17

I haven't yet, but component's default method mouseWheelMove() is definitively called (i've debugged it). Hosted plugin doesn't detect it, though.

Anyway, I have no idea, what should i do in this function, shouldn't this work automatically if hosted plugin supports mousewheel ??

For example mouse clicking is working ok without any additional method overriding. And OSX is working with the same code ?!?

I still don't understand a lot of JUCE code, so it just might be that i am doing something extremely stupid here, or forgetting something crucial.

Thanks!

Franci


#18

It works Ok on Linux too, but I just tried one of my plugins on Windows, hosted in a wrapper plugin, and it suffers from the same issue you have reported. I'll need to look into this myself at some point but I really don't have time to look into it now. Nor have I any ideas of the top of my head what you might do. If I do find a solution I'll be sure to let you know. Btw, have you seen this:

http://www.juce.com/forum/topic/using-componentmousewheelmove-vst-plugins

 


#19

Thx for checking this out.

I've even tried to use DocumentWindow for wrapped plugin editor, the similar approach as in JUCE Audio Plugin Host example, with no success.

Everything works except mousewheel. There must be something specific related to mousewheel handling when hosting plugin inside plugin.


#20

I've just checked this with well known DDMF Metaplugin wrapper (which is obviously based on JUCE framework) in Cubase/Nuendo.

Problem is exactly the same - mousewheel is not working with wrapped plugin !!!