How to change the title of the AudioProcessorEditor window in a plugin?

Hello,
i am new with JUCE. I don’t succeed to change the name (or title) of the window of the AudioProcessorEditor in the code of a Plugin.
(This title has been set in the Projucer).
In the constructor i tried:

Editor::Editor (Processor& p)
    : AudioProcessorEditor (&p), processor (p) 
{
	setTitle("My plugin");
	setName("My plugin");
..
}

This does not work.
Do you know how to do please?
Thanks,
Frédéric.

Is this in a DAW or as standalone?

  1. In a DAW:
    nothing you can do. The host creates and decorates the window. You can report back a name from AudioProcessor::getName(), but that’s all you can do.
  2. In standalone:
    Either you create a custom standalonePluginWindow, or you use getTopLevelComponent and set the window title there.
    Caveat: in the constructor you cannot access the top level component, because it wasn’t added yet. You need to use something like MessageManager::callAsync or Timer::callAfterDelay

Thanks for your explanations.
This is in a DAW.
Isee that the DAW put a title that includes a string taken from the ‘Project name’ or ‘Plugin name’ that i put in the Projucer in the menu/View/Set project settings.
This is this string that i would like to set from the c++ code.

I see it is written in the file JuceLibraryCode/JucePluginDefines.h in the line:
#define JucePlugin_Name “name”

So i can edit this file, but this is may be not the best solution?

May be the best solution for me is to change the name in the menu of Projucer.
Thanks,
Frédéric.

Yes, you are free to choose any name, but all text around is chosen by the host.
And IMHO the name should be consistent. The user wants to recognise the window with your plugin easily.

And I doubt you can change the name at runtime, not even sure if it makes a difference without rescanning…

Ok i understand. It is better to keep always the same name for the plugin. I wanted to put the version number in the name, but it is may be better to put it elsewhere.

Isn’t JucePlugin_Name defined in the projucer project? All of mine have this defined with the correct name I enter in the projects

Maybe the following code will help some. Note the last bit which shows the macro JucePlugin_VersionString.

If you have set your version in Projucer, it will allow you to use the version within your program/plugin.

juce::String wrapperType{ "???" };

switch (processor.wrapperType)
{
	case AudioProcessor::wrapperType_VST:
          	wrapperType = "VST";
          	break;
      case AudioProcessor::wrapperType_VST3:
          	wrapperType = "VST3";
           	break;
      case AudioProcessor::wrapperType_AudioUnit:
           	wrapperType = "AU";
           	break;
      case AudioProcessor::wrapperType_AAX:
           	wrapperType = "AAX";
           	break;
      default:
           	break;
}

juce::String systemInfo << wrapperType << " V" << juce::String(JucePlugin_VersionString) << newLine;

thanks