diff --git a/extras/Projucer/Source/Project/jucer_Project.cpp b/extras/Projucer/Source/Project/jucer_Project.cpp index 76058093ba..9bab53734b 100644 --- a/extras/Projucer/Source/Project/jucer_Project.cpp +++ b/extras/Projucer/Source/Project/jucer_Project.cpp @@ -237,12 +237,12 @@ void Project::initialiseAudioPluginValues() pluginAAXIdentifierValue.referTo (projectRoot, Ids::aaxIdentifier, getUndoManager(), getDefaultAAXIdentifierString()); pluginAUExportPrefixValue.referTo (projectRoot, Ids::pluginAUExportPrefix, getUndoManager(), CodeHelpers::makeValidIdentifier (getProjectNameString(), false, true, false) + "AU"); - pluginAUMainTypeValue.referTo (projectRoot, Ids::pluginAUMainType, getUndoManager()); - pluginVSTCategoryValue.referTo (projectRoot, Ids::pluginVSTCategory, getUndoManager(), getDefaultVSTCategories(), ","); + pluginAUMainTypeValue.referTo (projectRoot, Ids::pluginAUMainType, getUndoManager(), getDefaultAUMainTypes(), ","); + pluginVSTCategoryValue.referTo (projectRoot, Ids::pluginVSTCategory, getUndoManager(), getDefaultVSTCategories(), ","); pluginVST3CategoryValue.referTo (projectRoot, Ids::pluginVST3Category, getUndoManager(), getDefaultVST3Categories(), ","); pluginRTASCategoryValue.referTo (projectRoot, Ids::pluginRTASCategory, getUndoManager(), getDefaultRTASCategories(), ","); - pluginAAXCategoryValue.referTo (projectRoot, Ids::pluginAAXCategory, getUndoManager(), getDefaultAAXCategories(), ","); + pluginAAXCategoryValue.referTo (projectRoot, Ids::pluginAAXCategory, getUndoManager(), getDefaultAAXCategories(), ","); } void Project::updateOldStyleConfigList() @@ -391,6 +391,20 @@ void Project::updatePluginCategories() if (vstCategory.isNotEmpty() && getAllVSTCategoryStrings().contains (vstCategory)) pluginVSTCategoryValue = Array (vstCategory); } + + { + auto auMainType = projectRoot.getProperty (Ids::pluginAUMainType, {}).toString(); + + if (auMainType.isNotEmpty()) + { + if (getAllAUMainTypeVars().contains (auMainType)) + pluginAUMainTypeValue = Array (auMainType); + else if (getAllAUMainTypeVars().contains (auMainType.quoted ('\''))) + pluginAUMainTypeValue = Array (auMainType.quoted ('\'')); + else if (getAllAUMainTypeStrings().contains (auMainType)) + pluginAUMainTypeValue = Array (getAllAUMainTypeVars()[getAllAUMainTypeStrings().indexOf (auMainType)]); + } + } } void Project::writeLegacyPluginFormatSettings() @@ -681,6 +695,7 @@ void Project::valueTreePropertyChanged (ValueTree& tree, const Identifier& prope } else if (property == Ids::pluginCharacteristicsValue) { + pluginAUMainTypeValue.setDefault (getDefaultAUMainTypes()); pluginVSTCategoryValue.setDefault (getDefaultVSTCategories()); pluginVST3CategoryValue.setDefault (getDefaultVST3Categories()); pluginRTASCategoryValue.setDefault (getDefaultRTASCategories()); @@ -1010,8 +1025,9 @@ void Project::createAudioPluginPropertyEditors (PropertyListBuilder& props) "The value to use for the JucePlugin_AAXIdentifier setting"); props.add (new TextPropertyComponent (pluginAUExportPrefixValue, "Plugin AU Export Prefix", 128, false), "A prefix for the names of exported entry-point functions that the component exposes - typically this will be a version of your plugin's name that can be used as part of a C++ token."); - props.add (new TextPropertyComponent (pluginAUMainTypeValue, "Plugin AU Main Type", 128, false), - "In an AU, this is the value that is set as JucePlugin_AUMainType. Leave it blank unless you want to use a custom value."); + + props.add (new MultiChoicePropertyComponent (pluginAUMainTypeValue, "Plugin AU Main Type", getAllAUMainTypeStrings(), getAllAUMainTypeVars(), 1), + "AU main type."); { Array vstCategoryVars; @@ -1019,7 +1035,7 @@ void Project::createAudioPluginPropertyEditors (PropertyListBuilder& props) vstCategoryVars.add (s); props.add (new MultiChoicePropertyComponent (pluginVSTCategoryValue, "Plugin VST Category", getAllVSTCategoryStrings(), vstCategoryVars, 1), - "VST category"); + "VST category."); } { @@ -1028,13 +1044,13 @@ void Project::createAudioPluginPropertyEditors (PropertyListBuilder& props) vst3CategoryVars.add (s); props.add (new MultiChoicePropertyComponent (pluginVST3CategoryValue, "Plugin VST3 Category", getAllVST3CategoryStrings(), vst3CategoryVars), - "VST3 category"); + "VST3 category."); } props.add (new MultiChoicePropertyComponent (pluginRTASCategoryValue, "Plugin RTAS Category", getAllRTASCategoryStrings(), getAllRTASCategoryVars()), - "RTAS category"); + "RTAS category."); props.add (new MultiChoicePropertyComponent (pluginAAXCategoryValue, "Plugin AAX Category", getAllAAXCategoryStrings(), getAllAAXCategoryVars()), - "AAX category"); + "AAX category."); } //============================================================================== @@ -1549,6 +1565,17 @@ bool Project::isConfigFlagEnabled (const String& name, bool defaultIsEnabled) co } //============================================================================== +String Project::getAUMainTypeString() const noexcept +{ + auto v = pluginAUMainTypeValue.get(); + + if (auto* arr = v.getArray()) + return arr->getFirst().toString(); + + jassertfalse; + return {}; +} + String Project::getVSTCategoryString() const noexcept { auto v = pluginVSTCategoryValue.get(); @@ -1556,6 +1583,7 @@ String Project::getVSTCategoryString() const noexcept if (auto* arr = v.getArray()) return arr->getFirst().toString(); + jassertfalse; return {}; } @@ -1576,6 +1604,7 @@ String Project::getVST3CategoryString() const noexcept if (auto* arr = v.getArray()) return getVST3CategoryStringFromSelection (*arr); + jassertfalse; return {}; } @@ -1609,38 +1638,6 @@ int Project::getRTASCategory() const noexcept return res; } -String Project::getAUMainTypeString() -{ - auto s = getPluginAUMainTypeString(); - - if (s.isEmpty()) - { - // Unfortunately, Rez uses a header where kAudioUnitType_MIDIProcessor is undefined - // Use aumi instead. - if (isPluginMidiEffect()) s = "'aumi'"; - else if (isPluginSynth()) s = "kAudioUnitType_MusicDevice"; - else if (pluginWantsMidiInput()) s = "kAudioUnitType_MusicEffect"; - else s = "kAudioUnitType_Effect"; - } - - return s; -} - -String Project::getAUMainTypeCode() -{ - auto s = getPluginAUMainTypeString(); - - if (s.isEmpty()) - { - if (isPluginMidiEffect()) s = "aumi"; - else if (isPluginSynth()) s = "aumu"; - else if (pluginWantsMidiInput()) s = "aumf"; - else s = "aufx"; - } - - return s; -} - String Project::getIAATypeCode() { String s; @@ -1686,6 +1683,33 @@ bool Project::isVST3PluginHost() } //============================================================================== +StringArray Project::getAllAUMainTypeStrings() noexcept +{ + static StringArray auMainTypeStrings { "kAudioUnitType_Effect", "kAudioUnitType_FormatConverter", "kAudioUnitType_Generator", "kAudioUnitType_MIDIProcessor", + "kAudioUnitType_Mixer", "kAudioUnitType_MusicDevice", "kAudioUnitType_MusicEffect", "kAudioUnitType_OfflineEffect", + "kAudioUnitType_Output", "kAudioUnitType_Panner" }; + + return auMainTypeStrings; +} + +Array Project::getAllAUMainTypeVars() noexcept +{ + static Array auMainTypeVars { "'aufx'", "'aufc'", "'augn'", "'aumi'", + "'aumx'", "'aumu'", "'aumf'", "'auol'", + "'auou'", "'aupn'" }; + + return auMainTypeVars; +} + +Array Project::getDefaultAUMainTypes() const noexcept +{ + if (isPluginMidiEffect()) return { "'aumi'" }; + if (isPluginSynth()) return { "'aumu'" }; + if (pluginWantsMidiInput()) return { "'aumf'" }; + + return { "'aufx'" }; +} + StringArray Project::getAllVSTCategoryStrings() noexcept { static StringArray vstCategoryStrings { "kPlugCategUnknown", "kPlugCategEffect", "kPlugCategSynth", "kPlugCategAnalysis", "kPlugCategMastering", diff --git a/extras/Projucer/Source/Project/jucer_Project.h b/extras/Projucer/Source/Project/jucer_Project.h index f6831e75f3..c5f3347531 100644 --- a/extras/Projucer/Source/Project/jucer_Project.h +++ b/extras/Projucer/Source/Project/jucer_Project.h @@ -172,6 +172,10 @@ public: bool isPluginAAXMultiMonoDisabled() const { return checkMultiChoiceVar (pluginCharacteristicsValue, Ids::pluginAAXDisableMultiMono); } //============================================================================== + static StringArray getAllAUMainTypeStrings() noexcept; + static Array getAllAUMainTypeVars() noexcept; + Array getDefaultAUMainTypes() const noexcept; + static StringArray getAllVSTCategoryStrings() noexcept; Array getDefaultVSTCategories() const noexcept; @@ -186,13 +190,12 @@ public: static Array getAllRTASCategoryVars() noexcept; Array getDefaultRTASCategories() const noexcept; + String getAUMainTypeString() const noexcept; String getVSTCategoryString() const noexcept; String getVST3CategoryString() const noexcept; int getAAXCategory() const noexcept; int getRTASCategory() const noexcept; - String getAUMainTypeString(); - String getAUMainTypeCode(); String getIAATypeCode(); String getIAAPluginName(); diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h index c8b06df016..635deb310f 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h @@ -1518,7 +1518,7 @@ public: addPlistDictionaryKey (dict, "description", owner.project.getPluginDescriptionString()); addPlistDictionaryKey (dict, "factoryFunction", owner.project.getPluginAUExportPrefixString() + "Factory"); addPlistDictionaryKey (dict, "manufacturer", pluginManufacturerCode); - addPlistDictionaryKey (dict, "type", owner.project.getAUMainTypeCode()); + addPlistDictionaryKey (dict, "type", owner.project.getAUMainTypeString().removeCharacters ("'")); addPlistDictionaryKey (dict, "subtype", pluginSubType); addPlistDictionaryKeyInt (dict, "version", owner.project.getVersionAsHexInteger()); @@ -1553,7 +1553,7 @@ public: addPlistDictionaryKey (componentDict, "description", owner.project.getPluginDescriptionString()); addPlistDictionaryKey (componentDict, "factoryFunction",owner.project. getPluginAUExportPrefixString() + "FactoryAUv3"); addPlistDictionaryKey (componentDict, "manufacturer", owner.project.getPluginManufacturerCodeString().substring (0, 4)); - addPlistDictionaryKey (componentDict, "type", owner.project.getAUMainTypeCode()); + addPlistDictionaryKey (componentDict, "type", owner.project.getAUMainTypeString().removeCharacters ("'")); addPlistDictionaryKey (componentDict, "subtype", owner.project.getPluginCodeString().substring (0, 4)); addPlistDictionaryKeyInt (componentDict, "version", owner.project.getVersionAsHexInteger()); addPlistDictionaryKeyBool (componentDict, "sandboxSafe", true);