Function createPluginInstance has strange work on window


#1

Hi,

I call createPluginInstance from AudioPluginFormatManager object 3 times to load another plugin. But they have strange work. 2 times it called from AudioProcessor::setStateInformation and from the GUI menu are both ok. But when i reload preset it also call createPluginInstance but the PT hangs.

I debugge. With the time calling from preset createPluginInstance -----> format->createInstanceFromDescription -----> createPluginInstanceAsync (desc, initialSampleRate, initialBufferSize, eventSignaler.release()) ------------> (new InvokeOnMessageThread (this, description, initialSampleRate, initialBufferSize, callback))->post(); but it never call back void messageCallback() override to create plugin object handle. Then the PT on window hangs.

Do you have any solution with this case.
If you like you can remote my pc(via teamviewer) to check it.

Thanks.


#2

It’s probably hanging in the initialisation routine of whatever plug-in you are trying to create. What plug-in are you creating?


#3

I create the VST plugin from my AAX plugin.( My project manage other plugins).


#4

I mean which other plugins do you create. Are these third party VST plug-ins?


#5

Hi Fabien

Hung and I are working on Contra, a plugin host within a DAW. I seem to have found the following scenarios.

Contra has a no 3rd party plugin hosted:

ProTools will load a saved session where the Contra GUI was open at the time of saving.

Contra has 1 or more 3rd party plugins loaded:

  • ProTools will crash at the building FX windows of loading a saved session, where the Contra GUI was open at the time of saving the session file.

  • ProTools will crash when recalling a Contra PT preset file with the Contra GUI open

  • If the GUI is not open at the point of save, the session loads

  • ProTools will load saved settings of preset file, from the track insert selector menu in ProTools, if GUI is not open


#6

this may happen because you are restoring your plug-ins on other non message-main thread, we had something like in AGENT, check before creating those plug-ins that you are on the main message thread, if not do an asyncupdate so it ends up being called from it.


#7

As i debugged. The process to call Create Plugin all same on all 3 times. But the time from the Preset. It also creates plugin. (new InvokeOnMessageThread (this, description, initialSampleRate, initialBufferSize, callback))->post(); will be called but never call void messageCallback() override to create plugin. I think all cases come from the GUI. This bug occur when I reload preset from GUI.

If you have time. I ll show you on my pc.
If yes please give me time when you are available.


#8

sounds like an unload issue… check your crashes… remember you need to wait a bit after the editors are destroyed to destroy the plugin object…


#9

It does not crash, just hang. So i use delay function to do that. Do you have any idea ?


#10

lots of breakpoints… go step by step until you know where it hangs…


#11

Yes i did it, and as i said above, It hangs on this function: (new InvokeOnMessageThread (this, description, initialSampleRate, initialBufferSize, callback))->post();


#12

Can you check whether the JUCE message thread has been initialized (MessageManager::getInstanceWithoutCreating() != nullptr)?
I remember that in PT the JUCE message thread is only initialized after the GUI has been opened.


#13

Hi ckhf

It should be right, i dont know why i cant invoke to message thread anymore after editor show on. I tried to invoke but when call post method. Plugin waiting … and hang.

But the post method will be call if use act to the GUI. and the pos work well in that case.

Is there any workarround solution ?


#14

Another question:
SO what is difference between non MeasgeThead and Message thread?
and why load plugin we have to invoke to Message thread?

Thanks


#15

No one help me. Please help me


#16

You’re probably not getting any answers because your posts are confusing and hard to understand. Maybe clearly explain what you’re doing and exactly what you’re seeing happen.


#17

Thanks for your comment.

So let me explain:

I want to load another plugin in my plugin. Every thing is ok except I load other plugin via loading preset on Pro Tool. It make pro tool hang, I check the message handling does not work any more after i load plugin via changing preset (After post() function call ).

After i debug, i found the reason is “Pro tool can’t post message to load another plugin”:
when i change preset of pro tool: I load other plugin using this function createPluginInstance -----> format->createInstanceFromDescription -----> createPluginInstanceAsync (desc, initialSampleRate, initialBufferSize, eventSignaler.release()) ------------> (new InvokeOnMessageThread (this, description, initialSampleRate, initialBufferSize, callback))->post()

It never call call back function input to load another plugin.
When i load plugin via preset that thread is no Message thread then the code need to invoke to message thread to load another plugin.

More: But i load another plugin from a button on my plugin is ok.

My question:

Why need to invoke Message thread when you load plugin.
Please explain me why it hands .

Thanks.


#18

Did you realise that the Avid AAX developer license specifically forbids loading other plugin formats inside an AAX plugin?

Regardless of whether you can make your code work, this might not be something that you should be attempting to do!

(BTW it’s many years since I last saw an Avid license, but this always used to be the case - if it has changed recently, someone please correct me!)


#19

Did you realise that the Avid AAX developer license specifically forbids loading other plugin formats inside an AAX plugin?

Sorry i dont know that, with the plugin with preset. I can load them into plugin, it work well, but from preset, it hangs.

Please answer me why loading plugin we have to invoke thread message ? and why “post mesage” make application hang


#20

The plugin must be created on the message thread because on Windows there are certain things the plugin may want to do which must be done on that thread.

As to why your code hangs, obviously nobody here can magically know what’s going on in your code, you’d need to debug it yourself and see what threads are locked to figure out what’s going on.