Reaper creates two editors for my plugin


#1

With count vars and debugging statements I got confirmed what I already suspected from seeing other debugging statements: when my plugin gets loaded into a Reaper project, it (or the processor) creates the editor twice...

 

My plugin is still very simple. based on the Introducer and example plugins.

 

Anyone seen something like this as well? What can I possibly be doing wrong?

 

TIA!


#2

Yeah this has been seen before: http://www.juce.com/forum/topic/plugineditor-ctor


#3

Thanks!

But this leaves me then with another question:

which object should then "own" my plugin's objects?

I have a convolution engine, that can be owned by the processor, but also a class/object that is capable of loading a library with impulse response buffers. A candidate IMO for the editor, but I noticed it was being initialised twice.


#4

You need to think of the editor as an optional extra - it may or may not exist. The processor needs to own everything necessary for its operation.

 

So if the user loads an impulse response in the editor then you could do one of the following:

  • order the processor to load the same impulse response itself, or
  • find a way to safely transfer that information to the plugin processor (which can then keep its own copy)

#5

Very clear answer, thanks Andrew!


#6

I noticed this too -- I see an editor object being created in response to effEditGetRect (so that it can calculate the size), then REAPER calls effEditOpen after, which destroys the first editor object and creates a new one. I suppose this process could be optimized (if an editor was created by effEditGetRect, reuse it for effEditOpen...)