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:
@ -48,7 +48,7 @@
|
||||
#include <CoreMIDI/CoreMIDI.h>
|
||||
#include "CAXException.h"
|
||||
|
||||
//temporaray location
|
||||
//temporary location
|
||||
enum
|
||||
{
|
||||
kMidiMessage_NoteOff = 0x80,
|
||||
|
@ -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];
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
@ -847,6 +847,9 @@ public:
|
||||
processor.setRateAndBufferSizeDetails (sampleRate, static_cast<int> (maxFrames));
|
||||
processor.prepareToPlay (sampleRate, static_cast<int> (maxFrames));
|
||||
|
||||
midiMessages.ensureSize (2048);
|
||||
midiMessages.clear();
|
||||
|
||||
zeromem (&lastAudioHead, sizeof (lastAudioHead));
|
||||
hostMusicalContextCallback = [getAudioUnit() musicalContextBlock];
|
||||
hostTransportStateCallback = [getAudioUnit() transportStateBlock];
|
||||
@ -887,7 +890,7 @@ public:
|
||||
|
||||
for (auto i = 0u; i < n; ++i)
|
||||
{
|
||||
if (auto* viewConfiguration = [configs objectAtIndex:i])
|
||||
if (auto viewConfiguration = [configs objectAtIndex: i])
|
||||
{
|
||||
if (editor->supportsHostMIDIControllerPresence ([viewConfiguration hostHasController] == YES))
|
||||
{
|
||||
@ -930,10 +933,12 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
if (isPositiveAndBelow (idx, juceParameters.getNumParameters()))
|
||||
if (auto* juceParam = juceParameters.getParamForIndex (idx))
|
||||
{
|
||||
if (AUParameter* param = [paramTree.get() parameterWithAddress: getAUParameterAddressForIndex (idx)])
|
||||
{
|
||||
newValue *= getMaximumParameterValue (juceParam);
|
||||
|
||||
if (editorObserverToken != nullptr)
|
||||
[param setValue: newValue originator: editorObserverToken];
|
||||
else
|
||||
@ -1152,107 +1157,175 @@ private:
|
||||
#endif
|
||||
}
|
||||
|
||||
std::unique_ptr<AUParameter, NSObjectDeleter> createParameter (AudioProcessorParameter* parameter)
|
||||
{
|
||||
const String name (parameter->getName (512));
|
||||
|
||||
AudioUnitParameterUnit unit = kAudioUnitParameterUnit_Generic;
|
||||
AudioUnitParameterOptions flags = (UInt32) (kAudioUnitParameterFlag_IsWritable
|
||||
| kAudioUnitParameterFlag_IsReadable
|
||||
| kAudioUnitParameterFlag_HasCFNameString
|
||||
| kAudioUnitParameterFlag_ValuesHaveStrings);
|
||||
|
||||
if (! forceLegacyParamIDs)
|
||||
flags |= (UInt32) kAudioUnitParameterFlag_IsHighResolution;
|
||||
|
||||
// Set whether the param is automatable (unnamed parameters aren't allowed to be automated).
|
||||
if (name.isEmpty() || ! parameter->isAutomatable())
|
||||
flags |= kAudioUnitParameterFlag_NonRealTime;
|
||||
|
||||
const bool isParameterDiscrete = parameter->isDiscrete();
|
||||
|
||||
if (! isParameterDiscrete)
|
||||
flags |= kAudioUnitParameterFlag_CanRamp;
|
||||
|
||||
if (parameter->isMetaParameter())
|
||||
flags |= kAudioUnitParameterFlag_IsGlobalMeta;
|
||||
|
||||
std::unique_ptr<NSMutableArray, NSObjectDeleter> valueStrings;
|
||||
|
||||
// Is this a meter?
|
||||
if (((parameter->getCategory() & 0xffff0000) >> 16) == 2)
|
||||
{
|
||||
flags &= ~kAudioUnitParameterFlag_IsWritable;
|
||||
flags |= kAudioUnitParameterFlag_MeterReadOnly | kAudioUnitParameterFlag_DisplayLogarithmic;
|
||||
unit = kAudioUnitParameterUnit_LinearGain;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! forceLegacyParamIDs)
|
||||
{
|
||||
if (parameter->isDiscrete())
|
||||
{
|
||||
unit = parameter->isBoolean() ? kAudioUnitParameterUnit_Boolean : kAudioUnitParameterUnit_Indexed;
|
||||
auto maxValue = getMaximumParameterValue (parameter);
|
||||
auto numSteps = parameter->getNumSteps();
|
||||
|
||||
// Some hosts can't handle the huge numbers of discrete parameter values created when
|
||||
// using the default number of steps.
|
||||
jassert (numSteps != AudioProcessor::getDefaultNumParameterSteps());
|
||||
|
||||
valueStrings.reset ([NSMutableArray new]);
|
||||
|
||||
for (int i = 0; i < numSteps; ++i)
|
||||
[valueStrings.get() addObject: juceStringToNS (parameter->getText ((float) i / maxValue, 0))];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AUParameterAddress address = generateAUParameterAddress (parameter);
|
||||
|
||||
#if ! JUCE_FORCE_USE_LEGACY_PARAM_IDS
|
||||
// If you hit this assertion then you have either put a parameter in two groups or you are
|
||||
// very unlucky and the hash codes of your parameter ids are not unique.
|
||||
jassert (! paramMap.contains (static_cast<int64> (address)));
|
||||
|
||||
paramAddresses.add (address);
|
||||
paramMap.set (static_cast<int64> (address), parameter->getParameterIndex());
|
||||
#endif
|
||||
|
||||
auto getParameterIdentifier = [parameter]
|
||||
{
|
||||
if (auto* paramWithID = dynamic_cast<AudioProcessorParameterWithID*> (parameter))
|
||||
return paramWithID->paramID;
|
||||
|
||||
// This could clash if any groups have been given integer IDs!
|
||||
return String (parameter->getParameterIndex());
|
||||
};
|
||||
|
||||
std::unique_ptr<AUParameter, NSObjectDeleter> param;
|
||||
|
||||
@try
|
||||
{
|
||||
// Create methods in AUParameterTree return unretained objects (!) -> see Apple header AUAudioUnitImplementation.h
|
||||
param.reset([[AUParameterTree createParameterWithIdentifier: juceStringToNS (getParameterIdentifier())
|
||||
name: juceStringToNS (name)
|
||||
address: address
|
||||
min: 0.0f
|
||||
max: getMaximumParameterValue (parameter)
|
||||
unit: unit
|
||||
unitName: nullptr
|
||||
flags: flags
|
||||
valueStrings: valueStrings.get()
|
||||
dependentParameters: nullptr]
|
||||
retain]);
|
||||
}
|
||||
|
||||
@catch (NSException* exception)
|
||||
{
|
||||
// Do you have duplicate identifiers in any of your groups or parameters,
|
||||
// or do your identifiers have unusual characters in them?
|
||||
jassertfalse;
|
||||
}
|
||||
|
||||
[param.get() setValue: parameter->getDefaultValue()];
|
||||
|
||||
[overviewParams.get() addObject: [NSNumber numberWithUnsignedLongLong: address]];
|
||||
|
||||
return param;
|
||||
}
|
||||
|
||||
std::unique_ptr<AUParameterGroup, NSObjectDeleter> createParameterGroup (AudioProcessorParameterGroup* group)
|
||||
{
|
||||
std::unique_ptr<NSMutableArray<AUParameterNode*>, NSObjectDeleter> children ([NSMutableArray<AUParameterNode*> new]);
|
||||
|
||||
for (auto* node : *group)
|
||||
{
|
||||
if (auto* childGroup = node->getGroup())
|
||||
[children.get() addObject: createParameterGroup (childGroup).get()];
|
||||
else
|
||||
[children.get() addObject: createParameter (node->getParameter()).get()];
|
||||
}
|
||||
|
||||
std::unique_ptr<AUParameterGroup, NSObjectDeleter> result;
|
||||
|
||||
@try
|
||||
{
|
||||
// Create methods in AUParameterTree return unretained objects (!) -> see Apple header AUAudioUnitImplementation.h
|
||||
result.reset ([[AUParameterTree createGroupWithIdentifier: juceStringToNS (group->getID())
|
||||
name: juceStringToNS (group->getName())
|
||||
children: children.get()]
|
||||
retain]);
|
||||
}
|
||||
|
||||
@catch (NSException* exception)
|
||||
{
|
||||
// Do you have duplicate identifiers in any of your groups or parameters,
|
||||
// or do your identifiers have unusual characters in them?
|
||||
jassertfalse;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void addParameters()
|
||||
{
|
||||
std::unique_ptr<NSMutableArray<AUParameterNode*>, NSObjectDeleter> params ([[NSMutableArray<AUParameterNode*> alloc] init]);
|
||||
|
||||
overviewParams.reset ([[NSMutableArray<NSNumber*> alloc] init]);
|
||||
|
||||
auto& processor = getAudioProcessor();
|
||||
juceParameters.update (processor, forceLegacyParamIDs);
|
||||
|
||||
const int n = juceParameters.getNumParameters();
|
||||
// This is updated when we build the tree.
|
||||
overviewParams.reset ([NSMutableArray<NSNumber*> new]);
|
||||
|
||||
for (int idx = 0; idx < n; ++idx)
|
||||
{
|
||||
auto* juceParam = juceParameters.getParamForIndex (idx);
|
||||
std::unique_ptr<NSMutableArray<AUParameterNode*>, NSObjectDeleter> topLevelNodes ([NSMutableArray<AUParameterNode*> new]);
|
||||
|
||||
const String identifier (idx);
|
||||
const String name = juceParam->getName (512);
|
||||
|
||||
AudioUnitParameterUnit unit = kAudioUnitParameterUnit_Generic;
|
||||
AudioUnitParameterOptions flags = (UInt32) (kAudioUnitParameterFlag_IsWritable
|
||||
| kAudioUnitParameterFlag_IsReadable
|
||||
| kAudioUnitParameterFlag_HasCFNameString
|
||||
| kAudioUnitParameterFlag_ValuesHaveStrings);
|
||||
|
||||
if (! forceLegacyParamIDs)
|
||||
flags |= (UInt32) kAudioUnitParameterFlag_IsHighResolution;
|
||||
|
||||
// set whether the param is automatable (unnamed parameters aren't allowed to be automated)
|
||||
if (name.isEmpty() || ! juceParam->isAutomatable())
|
||||
flags |= kAudioUnitParameterFlag_NonRealTime;
|
||||
|
||||
const bool isParameterDiscrete = juceParam->isDiscrete();
|
||||
|
||||
if (! isParameterDiscrete)
|
||||
flags |= kAudioUnitParameterFlag_CanRamp;
|
||||
|
||||
if (juceParam->isMetaParameter())
|
||||
flags |= kAudioUnitParameterFlag_IsGlobalMeta;
|
||||
|
||||
std::unique_ptr<NSMutableArray, NSObjectDeleter> valueStrings;
|
||||
|
||||
// is this a meter?
|
||||
if (((juceParam->getCategory() & 0xffff0000) >> 16) == 2)
|
||||
{
|
||||
flags &= ~kAudioUnitParameterFlag_IsWritable;
|
||||
flags |= kAudioUnitParameterFlag_MeterReadOnly | kAudioUnitParameterFlag_DisplayLogarithmic;
|
||||
unit = kAudioUnitParameterUnit_LinearGain;
|
||||
}
|
||||
for (auto* node : processor.getParameterTree())
|
||||
if (auto* childGroup = node->getGroup())
|
||||
[topLevelNodes.get() addObject: createParameterGroup (childGroup).get()];
|
||||
else
|
||||
{
|
||||
if (! forceLegacyParamIDs)
|
||||
{
|
||||
if (juceParam->isDiscrete())
|
||||
{
|
||||
unit = juceParam->isBoolean() ? kAudioUnitParameterUnit_Boolean : kAudioUnitParameterUnit_Indexed;
|
||||
auto maxValue = getMaximumParameterValue (juceParam);
|
||||
auto numSteps = juceParam->getNumSteps();
|
||||
[topLevelNodes.get() addObject: createParameter (node->getParameter()).get()];
|
||||
|
||||
// Some hosts can't handle the huge numbers of discrete parameter values created when
|
||||
// using the default number of steps.
|
||||
jassert (numSteps != AudioProcessor::getDefaultNumParameterSteps());
|
||||
|
||||
valueStrings.reset ([NSMutableArray new]);
|
||||
|
||||
for (int i = 0; i < numSteps; ++i)
|
||||
[valueStrings.get() addObject: juceStringToNS (juceParam->getText ((float) i / maxValue, 0))];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AUParameterAddress address = generateAUParameterAddress (juceParam);
|
||||
|
||||
#if ! JUCE_FORCE_LEGACY_PARAMETER_AUTOMATION_TYPE
|
||||
// Consider yourself very unlucky if you hit this assertion. The hash codes of your
|
||||
// parameter ids are not unique.
|
||||
jassert (! paramMap.contains (static_cast<int64> (address)));
|
||||
|
||||
paramAddresses.add (address);
|
||||
paramMap.set (static_cast<int64> (address), idx);
|
||||
#endif
|
||||
|
||||
// create methods in AUParameterTree return unretained objects (!) -> see Apple header AUAudioUnitImplementation.h
|
||||
std::unique_ptr<AUParameter, NSObjectDeleter> param ([[AUParameterTree createParameterWithIdentifier: juceStringToNS (identifier)
|
||||
name: juceStringToNS (name)
|
||||
address: address
|
||||
min: 0.0f
|
||||
max: getMaximumParameterValue (juceParam)
|
||||
unit: unit
|
||||
unitName: nullptr
|
||||
flags: flags
|
||||
valueStrings: valueStrings.get()
|
||||
dependentParameters: nullptr] retain]);
|
||||
|
||||
[param.get() setValue: juceParam->getDefaultValue()];
|
||||
|
||||
[params.get() addObject: param.get()];
|
||||
[overviewParams.get() addObject: [NSNumber numberWithUnsignedLongLong:address]];
|
||||
@try
|
||||
{
|
||||
// Create methods in AUParameterTree return unretained objects (!) -> see Apple header AUAudioUnitImplementation.h
|
||||
paramTree.reset ([[AUParameterTree createTreeWithChildren: topLevelNodes.get()] retain]);
|
||||
}
|
||||
|
||||
// create methods in AUParameterTree return unretained objects (!) -> see Apple header AUAudioUnitImplementation.h
|
||||
paramTree.reset ([[AUParameterTree createTreeWithChildren: params.get()] retain]);
|
||||
@catch (NSException* exception)
|
||||
{
|
||||
// Do you have duplicate identifiers in any of your groups or parameters,
|
||||
// or do your identifiers have unusual characters in them?
|
||||
jassertfalse;
|
||||
}
|
||||
|
||||
paramObserver = CreateObjCBlock (this, &JuceAudioUnitv3::valueChangedFromHost);
|
||||
paramProvider = CreateObjCBlock (this, &JuceAudioUnitv3::getValue);
|
||||
@ -1458,11 +1531,11 @@ private:
|
||||
#endif
|
||||
|
||||
midiMessages.clear();
|
||||
}
|
||||
|
||||
// copy back
|
||||
audioBuffer.pop (*outBusBuffers[(int) outputBusNumber]->get(),
|
||||
mapper.get (false, (int) outputBusNumber));
|
||||
// copy back
|
||||
audioBuffer.pop (*outBusBuffers[(int) outputBusNumber]->get(),
|
||||
mapper.get (false, (int) outputBusNumber));
|
||||
}
|
||||
|
||||
return noErr;
|
||||
}
|
||||
@ -1577,13 +1650,8 @@ private:
|
||||
{
|
||||
const String& juceParamID = LegacyAudioParameter::getParamID (param, forceLegacyParamIDs);
|
||||
|
||||
#if JUCE_FORCE_USE_LEGACY_PARAM_IDS
|
||||
auto result = juceParamID.getIntValue();
|
||||
#else
|
||||
auto result = juceParamID.hashCode64();
|
||||
#endif
|
||||
|
||||
return static_cast<AUParameterAddress> (result);
|
||||
return static_cast<AUParameterAddress> (forceLegacyParamIDs ? juceParamID.getIntValue()
|
||||
: juceParamID.hashCode64());
|
||||
}
|
||||
|
||||
AudioProcessorParameter* getJuceParameterForAUAddress (AUParameterAddress address) const noexcept
|
||||
@ -1654,6 +1722,17 @@ JuceAudioUnitv3Base* JuceAudioUnitv3Base::create (AUAudioUnit* audioUnit, AudioC
|
||||
return new JuceAudioUnitv3 (audioUnit, descr, options, error);
|
||||
}
|
||||
|
||||
#if JUCE_IOS
|
||||
namespace juce
|
||||
{
|
||||
struct UIViewPeerControllerReceiver
|
||||
{
|
||||
virtual ~UIViewPeerControllerReceiver();
|
||||
virtual void setViewController (UIViewController*) = 0;
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
||||
//==============================================================================
|
||||
class JuceAUViewController
|
||||
{
|
||||
@ -1661,15 +1740,13 @@ public:
|
||||
JuceAUViewController (AUViewController<AUAudioUnitFactory>* p)
|
||||
: myself (p)
|
||||
{
|
||||
jassert (MessageManager::getInstance()->isThisTheMessageThread());
|
||||
|
||||
PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_AudioUnitv3;
|
||||
initialiseJuce_GUI();
|
||||
}
|
||||
|
||||
~JuceAUViewController()
|
||||
{
|
||||
jassert (MessageManager::getInstance()->isThisTheMessageThread());
|
||||
JUCE_ASSERT_MESSAGE_THREAD
|
||||
|
||||
if (processorHolder != nullptr)
|
||||
JuceAudioUnitv3::removeEditor (getAudioProcessor());
|
||||
@ -1678,7 +1755,7 @@ public:
|
||||
//==============================================================================
|
||||
void loadView()
|
||||
{
|
||||
jassert (MessageManager::getInstance()->isThisTheMessageThread());
|
||||
JUCE_ASSERT_MESSAGE_THREAD
|
||||
|
||||
if (AudioProcessor* p = createPluginFilterOfType (AudioProcessor::wrapperType_AudioUnitv3))
|
||||
{
|
||||
@ -1705,6 +1782,9 @@ public:
|
||||
#if JUCE_IOS
|
||||
if (JUCE_IOS_MAC_VIEW* peerView = [[[myself view] subviews] objectAtIndex: 0])
|
||||
[peerView setContentMode: UIViewContentModeTop];
|
||||
|
||||
if (auto* peer = dynamic_cast<UIViewPeerControllerReceiver*> (editor->getPeer()))
|
||||
peer->setViewController (myself);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -1812,7 +1892,7 @@ private:
|
||||
//==============================================================================
|
||||
AUAudioUnit* createAudioUnitOnMessageThread (const AudioComponentDescription& descr, NSError** error)
|
||||
{
|
||||
jassert (MessageManager::getInstance()->isThisTheMessageThread());
|
||||
JUCE_ASSERT_MESSAGE_THREAD
|
||||
|
||||
[myself view]; // this will call [view load] and ensure that the AudioProcessor has been instantiated
|
||||
|
||||
|
Reference in New Issue
Block a user