PluginHostType::getHostDescription() fails for Logic on M1

Hi,

this returns “Unknown” for Logic and isLogic() returns false.

thx

Same show on Final Cut Pro X.
I made a little Plugin to test, the returned hostname is the XPCServices:
Bildschirmfoto 2021-01-09 um 23.46.08

Seems none of the PluginHostTypes will work. Don’t know, if Big Sur or M1 Silicon is the culprit.

1 Like

guess it will be the M1 as sandboxing isn’t used on Big Sur, just on M1.

I think it is not sandboxing but the out of process processing. sandboxing relates to the filesystem, IIUC. Here the host is the “AUHostingServiceXPC_arrow”, which is returned by PluginHostType.getHostPath(), which I let print in the screenshot above.
Tere is no way for JUCE with the current approach to know, who spawned the AUHostingServiceXPC process.

I struggle to keep up with Apples changing approaches, so I don’t know if sandboxing and Out-of-process comes in pairs… And I have only a M1 Big Sur and an Intel Mojave. Not a big test farm…

I was referring to the out-of-process when saying sandboxing as I think they come as a pair?

Yes, I wasn’t sure as well, if they come in pairs.

I found a little information on the apple webpage:
https://developer.apple.com/library/archive/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW24

Seems they are separate. But chances are that the new OS pushes both technologies. I remember a Q&A session with Apple developers IIRC 2017 already, where they said the plan is to move all plugin loading in separate processes.

I wonder if AudioPluginHost will now automatically use out-of-process as well…

So AudioPluginHost doesn’t use XPC:

This is the code btw., in case somebody wants to reproduce:

void TestPluginHostTypeAudioProcessorEditor::paint (juce::Graphics& g)
{
    // (Our component is opaque, so we must completely fill the background with a solid colour)
    g.fillAll (getLookAndFeel().findColour (juce::ResizableWindow::backgroundColourId));

    g.setColour (juce::Colours::white);
    g.setFont (15.0f);
    juce::PluginHostType type;
    juce::String wrapper;
    switch (type.getPluginLoadedAs())
    {
        case juce::AudioProcessor::wrapperType_VST: wrapper = "VST"; break;
        case juce::AudioProcessor::wrapperType_VST3: wrapper = "VST3"; break;
        case juce::AudioProcessor::wrapperType_AudioUnit: wrapper = "AudioUnit"; break;
        case juce::AudioProcessor::wrapperType_AudioUnitv3: wrapper = "AudioUnitv3"; break;
        case juce::AudioProcessor::wrapperType_RTAS: wrapper = "RTAS"; break;
        case juce::AudioProcessor::wrapperType_AAX: wrapper = "AAX"; break;
        case juce::AudioProcessor::wrapperType_Standalone: wrapper = "Standalone"; break;
        case juce::AudioProcessor::wrapperType_Unity: wrapper = "Unity"; break;
        default: wrapper = "Unknown"; break;
    }
    g.drawFittedText (juce::String ("Host: ") + type.getHostDescription() + "\n"
                      + "loaded as: " + wrapper + "\n"
                      + type.getHostPath(), getLocalBounds(), juce::Justification::centred, 1);
}

I’ve added a fix for this issue here:

Unfortunately I can’t find the kAudioUnitProperty_AUHostIdentifier strings reported by Final Cut Pro or Mainstage anywhere online, and I’m reluctant to pay for licenses just to query a couple of strings.

If users with access to FCPX or MainStage can let me know the result of PluginHostType::getHostIdReportedByWrapper() when loading an AU, I’ll add the appropriate checks to getHostType.

Please let me know if you run into any issues with this change.

I am happy to take care of FCPX, thanks for looking into it…

On MainStage,
Am I calling it correctly?

g.drawFittedText (PluginHostType::getHostIdReportedByWrapper(), getLocalBounds(), Justification::centred, 1);

(I’ve checked and this is arm64 debug build hosted under the AUHostingService (MainStage) )

Ok,
oddly it seems there’s some synchronization problem.

Now I got:

com.apple.mainstage

Unfortunately I get only an empty string in Final Cut Pro.

I have this in the editor:

juce::PluginHostType type;
juce::String wrapper;
switch (type.getPluginLoadedAs())
{
    case juce::AudioProcessor::wrapperType_VST: wrapper = "VST"; break;
    case juce::AudioProcessor::wrapperType_VST3: wrapper = "VST3"; break;
    case juce::AudioProcessor::wrapperType_AudioUnit: wrapper = "AudioUnit"; break;
    case juce::AudioProcessor::wrapperType_AudioUnitv3: wrapper = "AudioUnitv3"; break;
    case juce::AudioProcessor::wrapperType_RTAS: wrapper = "RTAS"; break;
    case juce::AudioProcessor::wrapperType_AAX: wrapper = "AAX"; break;
    case juce::AudioProcessor::wrapperType_Standalone: wrapper = "Standalone"; break;
    case juce::AudioProcessor::wrapperType_Unity: wrapper = "Unity"; break;
    default: wrapper = "Unknown"; break;
}
g.drawFittedText (juce::String ("Host: ") + type.getHostDescription() + "\n"
                  + "loaded as: " + wrapper + "\n"
                  + "PluginHostType::getHostIdReportedByWrapper(): " + juce::PluginHostType::getHostIdReportedByWrapper() + "\n"
                  + type.getHostPath(), getLocalBounds(), juce::Justification::centred, 1);

Bildschirmfoto 2021-03-10 um 21.50.45

OK, it sounds like there may be problems with this approach.

Perhaps as a fallback to the existing fallback, we can query the name of the hosting process.

In Activity Monitor, what’s the name of the hosting process when running FCPX? I’m guessing it’s something like AUHostingProcess (Final Cut Pro).

Affirmative. I missed it at first, but I saw now the AUHostingService (Final Cut Pro) when running another JUCE plugin in Final Cut Pro on the M1.

1 Like

Since there are only four hosts and three of them CAN be identified with this method, isn’t it OK to use “Final Cut Pro X” as the fallback? Of course future Apple hosts then may misreport, but it’s not any worse than having all four fail.

That’s true, but it sounds like there may be timing issues with the current approach too. Calls to getHostType may return ‘unknown’ if they are made before the host sets the AUHostIdentifier property.

I’ve left in the current checks, but augmented them with another check using the name of the hosting process: