Query format (AU/VST/RTAS) inside PluginEditor?

Is there an easy way to determine the current format a Introjucer-built audio plug-in is being used as from within PluginEditor.cpp? Something akin to getHostType() but that returns AU/VST/RTAS instead of the host name?

Sure, something could be cobbled into the wrappers but thought I’d ask if anyone had a more elegant solution.

-Frank

Probably not viewtopic.php?f=8&t=8066

Should indeed be easy enough to add this bit of info to the AudioProcessor class and have it set by the wrappers…

I know this is stone old, but still needed. Has this been implemented in the meanwhile?

Since all formats are compiled in one go (the shared target at least), there is no easy way to determine the format at runtime, other than wrappers setting a flag when an instance is created.

Why would one need this in the first place? For example, if the plug-in communicates with some outside instance that needs to know whether it’s an AU or VST, or whatever. The plug-in may also need to infer about features that an individual format doesn’t support.

Yeah, see AudioProcessor::wrapperType

Check this post:
This snippet from my PluginEditor code fills a string with the current version, format, and bit depth – seems to work well on Windows and OSX.

String displayString("Version "); displayString += JucePlugin_VersionString; displayString += " "; switch (getProcessor()->wrapperType) { case AudioProcessor::wrapperType_VST: displayString += "VST"; break; case AudioProcessor::wrapperType_VST3: displayString += "VST3"; break; case AudioProcessor::wrapperType_AudioUnit: displayString += "AU"; break; case AudioProcessor::wrapperType_RTAS: displayString += "RTAS"; break; case AudioProcessor::wrapperType_AAX: displayString += "AAX"; break; default: displayString += "Unknown"; break; } #if defined(__LP64__) || defined(_WIN64) displayString += String(" (64)"); #else displayString += String(" (32)"); #endif #ifdef _DEBUG displayString += String(" DEBUG"); #endif

Thanks! Me stupid.

@jules is there any reason that PluginHostType::getHostDescription() exists but PluginHostType::getPluginDescription() does not?

seems like getting a human-readable version of what plugin type is being used might be useful for logging purposes.

You can query that value using PluginHostType::getPluginLoadedAs(). You just have to define strings to your liking…

I know that. JUCE did it for all the host types. why didn’t they do it for all the plugin types?

        String pluginType;
        switch( PluginHostType::getPluginLoadedAs() )
        {
            case AudioProcessor::wrapperType_Undefined:     pluginType = "undefined";
            case AudioProcessor::wrapperType_VST:           pluginType = "VST";
            case AudioProcessor::wrapperType_VST3:          pluginType = "VST3";
            case AudioProcessor::wrapperType_AudioUnit:     pluginType = "AU";
            case AudioProcessor::wrapperType_AudioUnitv3:   pluginType = "AUv3";
            case AudioProcessor::wrapperType_RTAS:          pluginType = "RTAS";
            case AudioProcessor::wrapperType_AAX:           pluginType = "AAX";
            case AudioProcessor::wrapperType_Standalone:    pluginType = "Standalone";
        }

…definitely seems like this should be a part of the library.

I’ll add something to do this, but you might want to play “spot the coding mistake” on the code you posted there :slight_smile:

Here’s mine:

const String    getWrapperTypeString (AudioProcessor::WrapperType type)
{
    switch (type)
        {
            case AudioProcessor::wrapperType_Undefined:    return "Undefined";

            case AudioProcessor::wrapperType_VST:          return "VST";

            case AudioProcessor::wrapperType_VST3:         return "VST3";

            case AudioProcessor::wrapperType_AudioUnit:    return "Audio Unit";
            
            case AudioProcessor::wrapperType_AudioUnitv3:  return "Audio Unit v3";

            case AudioProcessor::wrapperType_RTAS:         return "RTAS";

            case AudioProcessor::wrapperType_AAX:          return "AAX";

            case AudioProcessor::wrapperType_Standalone:   return "Standalone";
        }

    return "Unknown";
}

Rail

1 Like

Using a default label in the switch would be safer IMHO, since the enum might be extended (like wrapperType_Unity that is missing here…) :wink:

…or use a StringArray and the AudioProcessor::WrapperType as the index. :wink:

Rail

1 Like