upgrade to JUCE 5.4.3. Remove (probably) unused JUCE modules. Remove VST2 target (it's been end-of-life'd by Steinberg and by JUCE)
This commit is contained in:
@ -130,7 +130,6 @@ public:
|
||||
MusicDeviceBase (component,
|
||||
(UInt32) AudioUnitHelpers::getBusCount (juceFilter.get(), true),
|
||||
(UInt32) AudioUnitHelpers::getBusCount (juceFilter.get(), false)),
|
||||
isBypassed (false),
|
||||
mapper (*juceFilter)
|
||||
{
|
||||
inParameterChangedCallback = false;
|
||||
@ -474,6 +473,31 @@ public:
|
||||
{
|
||||
switch (inID)
|
||||
{
|
||||
case kAudioUnitProperty_ParameterClumpName:
|
||||
|
||||
if (auto* clumpNameInfo = (AudioUnitParameterNameInfo*) outData)
|
||||
{
|
||||
if (juceFilter != nullptr)
|
||||
{
|
||||
auto clumpIndex = clumpNameInfo->inID - 1;
|
||||
const auto* group = parameterGroups[(int) clumpIndex];
|
||||
auto name = group->getName();
|
||||
|
||||
while (group->getParent() != &juceFilter->getParameterTree())
|
||||
{
|
||||
group = group->getParent();
|
||||
name = group->getName() + group->getSeparator() + name;
|
||||
}
|
||||
|
||||
clumpNameInfo->outName = name.toCFString();
|
||||
return noErr;
|
||||
}
|
||||
}
|
||||
|
||||
// Failed to find a group corresponding to the clump ID.
|
||||
jassertfalse;
|
||||
break;
|
||||
|
||||
case juceFilterObjectPropertyID:
|
||||
((void**) outData)[0] = (void*) static_cast<AudioProcessor*> (juceFilter.get());
|
||||
((void**) outData)[1] = (void*) this;
|
||||
@ -879,6 +903,14 @@ public:
|
||||
if (param->isMetaParameter())
|
||||
outParameterInfo.flags |= kAudioUnitParameterFlag_IsGlobalMeta;
|
||||
|
||||
auto parameterGroupHierarchy = juceFilter->getParameterTree().getGroupsForParameter (param);
|
||||
|
||||
if (! parameterGroupHierarchy.isEmpty())
|
||||
{
|
||||
outParameterInfo.flags |= kAudioUnitParameterFlag_HasClump;
|
||||
outParameterInfo.clumpID = (UInt32) parameterGroups.indexOf (parameterGroupHierarchy.getLast()) + 1;
|
||||
}
|
||||
|
||||
// Is this a meter?
|
||||
if (((param->getCategory() & 0xffff0000) >> 16) == 2)
|
||||
{
|
||||
@ -1429,7 +1461,6 @@ public:
|
||||
public:
|
||||
EditorCompHolder (AudioProcessorEditor* const editor)
|
||||
{
|
||||
setSize (editor->getWidth(), editor->getHeight());
|
||||
addAndMakeVisible (editor);
|
||||
|
||||
#if ! JucePlugin_EditorRequiresKeyboardFocus
|
||||
@ -1439,6 +1470,7 @@ public:
|
||||
#endif
|
||||
|
||||
ignoreUnused (fakeMouseGenerator);
|
||||
setBounds (getSizeToContainChild());
|
||||
}
|
||||
|
||||
~EditorCompHolder()
|
||||
@ -1447,13 +1479,21 @@ public:
|
||||
// have been transferred to another parent which takes over ownership.
|
||||
}
|
||||
|
||||
Rectangle<int> getSizeToContainChild()
|
||||
{
|
||||
if (auto* editor = getChildComponent (0))
|
||||
return getLocalArea (editor, editor->getLocalBounds());
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
static NSView* createViewFor (AudioProcessor* filter, JuceAU* au, AudioProcessorEditor* const editor)
|
||||
{
|
||||
EditorCompHolder* editorCompHolder = new EditorCompHolder (editor);
|
||||
NSRect r = makeNSRect (editorCompHolder->getLocalBounds());
|
||||
auto* editorCompHolder = new EditorCompHolder (editor);
|
||||
auto r = makeNSRect (editorCompHolder->getSizeToContainChild());
|
||||
|
||||
static JuceUIViewClass cls;
|
||||
NSView* view = [[cls.createInstance() initWithFrame: r] autorelease];
|
||||
auto* view = [[cls.createInstance() initWithFrame: r] autorelease];
|
||||
|
||||
JuceUIViewClass::setFilter (view, filter);
|
||||
JuceUIViewClass::setAU (view, au);
|
||||
@ -1470,29 +1510,33 @@ public:
|
||||
|
||||
editorCompHolder->addToDesktop (0, (void*) view);
|
||||
editorCompHolder->setVisible (view);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
void childBoundsChanged (Component*) override
|
||||
{
|
||||
if (Component* editor = getChildComponent(0))
|
||||
auto b = getSizeToContainChild();
|
||||
|
||||
if (lastBounds != b)
|
||||
{
|
||||
const int w = jmax (32, editor->getWidth());
|
||||
const int h = jmax (32, editor->getHeight());
|
||||
lastBounds = b;
|
||||
|
||||
if (getWidth() != w || getHeight() != h)
|
||||
setSize (w, h);
|
||||
auto w = jmax (32, b.getWidth());
|
||||
auto h = jmax (32, b.getHeight());
|
||||
|
||||
NSView* view = (NSView*) getWindowHandle();
|
||||
NSRect r = [[view superview] frame];
|
||||
r.size.width = editor->getWidth();
|
||||
r.size.height = editor->getHeight();
|
||||
setSize (w, h);
|
||||
|
||||
auto* view = (NSView*) getWindowHandle();
|
||||
auto r = [[view superview] frame];
|
||||
r.size.width = w;
|
||||
r.size.height = h;
|
||||
|
||||
[CATransaction begin];
|
||||
[CATransaction setValue:(id)kCFBooleanTrue forKey:kCATransactionDisableActions];
|
||||
[CATransaction setValue:(id) kCFBooleanTrue forKey:kCATransactionDisableActions];
|
||||
|
||||
[[view superview] setFrame: r];
|
||||
[view setFrame: makeNSRect (editor->getLocalBounds())];
|
||||
[view setFrame: makeNSRect (b)];
|
||||
[CATransaction commit];
|
||||
|
||||
[view setNeedsDisplay: YES];
|
||||
@ -1525,6 +1569,7 @@ public:
|
||||
|
||||
private:
|
||||
FakeMouseMoveGenerator fakeMouseGenerator;
|
||||
Rectangle<int> lastBounds;
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE (EditorCompHolder)
|
||||
};
|
||||
@ -1674,7 +1719,7 @@ private:
|
||||
//==============================================================================
|
||||
AudioUnitHelpers::CoreAudioBufferList audioBuffer;
|
||||
MidiBuffer midiEvents, incomingEvents;
|
||||
bool prepared, isBypassed;
|
||||
bool prepared = false, isBypassed = false;
|
||||
|
||||
//==============================================================================
|
||||
#if JUCE_FORCE_USE_LEGACY_PARAM_IDS
|
||||
@ -1687,6 +1732,7 @@ private:
|
||||
LegacyAudioParametersWrapper juceParameters;
|
||||
HashMap<int32, AudioProcessorParameter*> paramMap;
|
||||
Array<AudioUnitParameterID> auParamIDs;
|
||||
Array<const AudioProcessorParameterGroup*> parameterGroups;
|
||||
|
||||
//==============================================================================
|
||||
AudioUnitEvent auEvent;
|
||||
@ -1839,6 +1885,8 @@ private:
|
||||
//==============================================================================
|
||||
void addParameters()
|
||||
{
|
||||
parameterGroups = juceFilter->getParameterTree().getSubgroups (true);
|
||||
|
||||
juceParameters.update (*juceFilter, forceUseLegacyParamIDs);
|
||||
const int numParams = juceParameters.getNumParameters();
|
||||
|
||||
@ -1877,6 +1925,7 @@ private:
|
||||
OwnedArray<const __CFString>* stringValues = nullptr;
|
||||
|
||||
auto initialValue = param->getValue();
|
||||
bool paramIsLegacy = dynamic_cast<LegacyAudioParameter*> (param) != nullptr;
|
||||
|
||||
if (param->isDiscrete() && (! forceUseLegacyParamIDs))
|
||||
{
|
||||
@ -1886,17 +1935,26 @@ private:
|
||||
|
||||
const auto maxValue = getMaximumParameterValue (param);
|
||||
|
||||
auto getTextValue = [param, paramIsLegacy] (float value)
|
||||
{
|
||||
if (paramIsLegacy)
|
||||
{
|
||||
param->setValue (value);
|
||||
return param->getCurrentValueAsText();
|
||||
}
|
||||
|
||||
return param->getText (value, 256);
|
||||
};
|
||||
|
||||
for (int i = 0; i < numSteps; ++i)
|
||||
{
|
||||
auto value = (float) i / maxValue;
|
||||
|
||||
// Once legacy parameters are deprecated this can be replaced by getText
|
||||
param->setValue (value);
|
||||
stringValues->add (CFStringCreateCopy (nullptr, (param->getCurrentValueAsText().toCFString())));
|
||||
stringValues->add (CFStringCreateCopy (nullptr, (getTextValue (value).toCFString())));
|
||||
}
|
||||
}
|
||||
|
||||
param->setValue (initialValue);
|
||||
if (paramIsLegacy)
|
||||
param->setValue (initialValue);
|
||||
|
||||
parameterValueStringArrays.add (stringValues);
|
||||
}
|
||||
@ -1928,7 +1986,9 @@ private:
|
||||
|
||||
AudioProcessorParameter* getParameterForAUParameterID (AudioUnitParameterID address) const noexcept
|
||||
{
|
||||
return paramMap[static_cast<int32> (address)];
|
||||
auto index = static_cast<int32> (address);
|
||||
return forceUseLegacyParamIDs ? juceParameters.getParamForIndex (index)
|
||||
: paramMap[index];
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
Reference in New Issue
Block a user