Browse Source

Projucer: Add a setting to configure the number of MIDI inputs and outputs for VST plug-ins

tags/2021-05-28
ed 7 years ago
parent
commit
ce33b4aea1
7 changed files with 93 additions and 7 deletions
  1. +22
    -0
      extras/Projucer/Source/Project/jucer_Project.cpp
  2. +5
    -3
      extras/Projucer/Source/Project/jucer_Project.h
  3. +2
    -0
      extras/Projucer/Source/ProjectSaving/jucer_ProjectSaver.cpp
  4. +2
    -0
      extras/Projucer/Source/Utility/Helpers/jucer_PresetIDs.h
  5. +40
    -2
      extras/Projucer/Source/Utility/UI/PropertyComponents/jucer_PropertyComponentsWithEnablement.h
  6. +10
    -2
      modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp
  7. +12
    -0
      modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp

+ 22
- 0
extras/Projucer/Source/Project/jucer_Project.cpp View File

@@ -266,6 +266,9 @@ void Project::initialiseAudioPluginValues()
pluginVST3CategoryValue.referTo (projectRoot, Ids::pluginVST3Category, getUndoManager(), getDefaultVST3Categories(), ",");
pluginRTASCategoryValue.referTo (projectRoot, Ids::pluginRTASCategory, getUndoManager(), getDefaultRTASCategories(), ",");
pluginAAXCategoryValue.referTo (projectRoot, Ids::pluginAAXCategory, getUndoManager(), getDefaultAAXCategories(), ",");
pluginVSTNumMidiInputsValue.referTo (projectRoot, Ids::pluginVSTNumMidiInputs, getUndoManager(), 16);
pluginVSTNumMidiOutputsValue.referTo (projectRoot, Ids::pluginVSTNumMidiOutputs, getUndoManager(), 16);
}
void Project::updateOldStyleConfigList()
@@ -1089,6 +1092,25 @@ void Project::createAudioPluginPropertyEditors (PropertyListBuilder& props)
"Check this box if your plug-in is sandbox safe. A sand-box safe plug-in is loaded in a restricted path and can only access it's own bundle resources and "
"the Music folder. Your plug-in must be able to deal with this. Newer versions of GarageBand require this to be enabled.");
{
Array<var> varChoices;
StringArray stringChoices;
for (int i = 1; i <= 16; ++i)
{
varChoices.add (i);
stringChoices.add (String (i));
}
props.add (new ChoicePropertyComponentWithEnablement (pluginVSTNumMidiInputsValue, pluginCharacteristicsValue, Ids::pluginWantsMidiIn,
"Plugin VST Num MIDI Inputs", stringChoices, varChoices),
"For VST and VST3 plug-ins that accept MIDI, this allows you to configure the number of inputs.");
props.add (new ChoicePropertyComponentWithEnablement (pluginVSTNumMidiOutputsValue, pluginCharacteristicsValue, Ids::pluginProducesMidiOut,
"Plugin VST Num MIDI Outputs", stringChoices, varChoices),
"For VST and VST3 plug-ins that produce MIDI, this allows you to configure the number of outputs.");
}
{
Array<var> vst3CategoryVars;


+ 5
- 3
extras/Projucer/Source/Project/jucer_Project.h View File

@@ -142,7 +142,8 @@ public:
String getPluginChannelConfigsString() const { return pluginChannelConfigsValue.get(); }
String getAAXIdentifierString() const { return pluginAAXIdentifierValue.get(); }
String getPluginAUExportPrefixString() const { return pluginAUExportPrefixValue.get(); }
String getPluginAUMainTypeString() const { return pluginAUMainTypeValue.get(); }
String getVSTNumMIDIInputsString() const { return pluginVSTNumMidiInputsValue.get(); }
String getVSTNumMIDIOutputsString() const { return pluginVSTNumMidiOutputsValue.get(); }
//==============================================================================
static bool checkMultiChoiceVar (const ValueWithDefault& valueToCheck, Identifier idToCheck) noexcept
@@ -423,12 +424,13 @@ private:
ValueWithDefault projectNameValue, projectUIDValue, projectLineFeedValue, projectTypeValue, versionValue, bundleIdentifierValue, companyNameValue,
companyCopyrightValue, companyWebsiteValue, companyEmailValue, displaySplashScreenValue, reportAppUsageValue, splashScreenColourValue, cppStandardValue,
headerSearchPathsValue, preprocessorDefsValue, userNotesValue, maxBinaryFileSizeValue, includeBinaryDataInJuceHeaderValue, binaryDataNamespaceValue;
headerSearchPathsValue, preprocessorDefsValue, userNotesValue, maxBinaryFileSizeValue, includeBinaryDataInJuceHeaderValue, binaryDataNamespaceValue,
compilerFlagSchemesValue;
ValueWithDefault pluginFormatsValue, pluginNameValue, pluginDescriptionValue, pluginManufacturerValue, pluginManufacturerCodeValue,
pluginCodeValue, pluginChannelConfigsValue, pluginCharacteristicsValue, pluginAUExportPrefixValue, pluginAAXIdentifierValue,
pluginAUMainTypeValue, pluginAUSandboxSafeValue, pluginRTASCategoryValue, pluginVSTCategoryValue, pluginVST3CategoryValue, pluginAAXCategoryValue,
compilerFlagSchemesValue;
pluginVSTNumMidiInputsValue, pluginVSTNumMidiOutputsValue;
//==============================================================================
std::unique_ptr<CompileEngineSettings> compileEngineSettings;


+ 2
- 0
extras/Projucer/Source/ProjectSaving/jucer_ProjectSaver.cpp View File

@@ -123,6 +123,8 @@ void ProjectSaver::writePluginCharacteristicsFile()
flags.set ("JucePlugin_IAAType", toCharLiteral (project.getIAATypeCode()));
flags.set ("JucePlugin_IAASubType", "JucePlugin_PluginCode");
flags.set ("JucePlugin_IAAName", project.getIAAPluginName().quoted());
flags.set ("JucePlugin_VSTNumMidiInputs", project.getVSTNumMIDIInputsString());
flags.set ("JucePlugin_VSTNumMidiOutputs", project.getVSTNumMIDIOutputsString());
{
String plugInChannelConfig = project.getPluginChannelConfigsString();


+ 2
- 0
extras/Projucer/Source/Utility/Helpers/jucer_PresetIDs.h View File

@@ -337,6 +337,8 @@ namespace Ids
DECLARE_ID (pluginAAXCategory);
DECLARE_ID (pluginAAXDisableBypass);
DECLARE_ID (pluginAAXDisableMultiMono);
DECLARE_ID (pluginVSTNumMidiInputs);
DECLARE_ID (pluginVSTNumMidiOutputs);
DECLARE_ID (exporters);
DECLARE_ID (website);
DECLARE_ID (mainClass);


+ 40
- 2
extras/Projucer/Source/Utility/UI/PropertyComponents/jucer_PropertyComponentsWithEnablement.h View File

@@ -69,7 +69,23 @@ public:
value (valueToListenTo.getPropertyAsValue())
{
value.addListener (this);
setEnabled (valueWithDefault.get());
valueChanged (value);
}
ChoicePropertyComponentWithEnablement (ValueWithDefault& valueToControl,
ValueWithDefault valueToListenTo,
const Identifier& multiChoiceID,
const String& propertyName,
const StringArray& choices,
const Array<var>& correspondingValues)
: ChoicePropertyComponentWithEnablement (valueToControl, valueToListenTo, propertyName, choices, correspondingValues)
{
jassert (valueToListenTo.get().getArray() != nullptr);
isMultiChoice = true;
idToCheck = multiChoiceID;
valueChanged (value);
}
~ChoicePropertyComponentWithEnablement() override { value.removeListener (this); }
@@ -78,5 +94,27 @@ private:
ValueWithDefault valueWithDefault;
Value value;
void valueChanged (Value&) override { setEnabled (valueWithDefault.get()); }
bool isMultiChoice = false;
Identifier idToCheck;
bool checkMultiChoiceVar() const
{
jassert (isMultiChoice);
auto v = valueWithDefault.get();
if (auto* varArray = v.getArray())
return varArray->contains (idToCheck.toString());
jassertfalse;
return false;
}
void valueChanged (Value&) override
{
if (isMultiChoice)
setEnabled (checkMultiChoiceVar());
else
setEnabled (valueWithDefault.get());
}
};

+ 10
- 2
modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp View File

@@ -2230,7 +2230,11 @@ private:
pointer_sized_int handleGetNumMidiInputChannels()
{
#if JucePlugin_WantsMidiInput || JucePlugin_IsMidiEffect
return 16;
#ifdef JucePlugin_VSTNumMidiInputs
return JucePlugin_VSTNumMidiInputs;
#else
return 16;
#endif
#else
return 0;
#endif
@@ -2239,7 +2243,11 @@ private:
pointer_sized_int handleGetNumMidiOutputChannels()
{
#if JucePlugin_ProducesMidiOutput || JucePlugin_IsMidiEffect
return 16;
#ifdef JucePlugin_VSTNumMidiOutputs
return JucePlugin_VSTNumMidiOutputs;
#else
return 16;
#endif
#else
return 0;
#endif


+ 12
- 0
modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp View File

@@ -2047,7 +2047,13 @@ public:
{
info.mediaType = Vst::kEvent;
info.direction = dir;
#ifdef JucePlugin_VSTNumMidiInputs
info.channelCount = JucePlugin_VSTNumMidiInputs;
#else
info.channelCount = 16;
#endif
toString128 (info.name, TRANS("MIDI Input"));
info.busType = Vst::kMain;
return kResultTrue;
@@ -2059,7 +2065,13 @@ public:
{
info.mediaType = Vst::kEvent;
info.direction = dir;
#ifdef JucePlugin_VSTNumMidiOutputs
info.channelCount = JucePlugin_VSTNumMidiOutputs;
#else
info.channelCount = 16;
#endif
toString128 (info.name, TRANS("MIDI Output"));
info.busType = Vst::kMain;
return kResultTrue;


Loading…
Cancel
Save