Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

- #1403

Closed
wants to merge 2 commits into from
Closed

- #1403

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,9 @@ static void addIfNotNull (OwnedArray<AudioIODeviceType>& list, AudioIODeviceType
void AudioDeviceManager::createAudioDeviceTypes (OwnedArray<AudioIODeviceType>& list)
{
addIfNotNull (list, AudioIODeviceType::createAudioIODeviceType_WASAPI (WASAPIDeviceMode::shared));
addIfNotNull (list, AudioIODeviceType::createAudioIODeviceType_WASAPI (WASAPIDeviceMode::exclusive));
addIfNotNull (list, AudioIODeviceType::createAudioIODeviceType_WASAPI (WASAPIDeviceMode::sharedLowLatency));
// Acon Digital modification - no need for special WASAPI modes
//addIfNotNull (list, AudioIODeviceType::createAudioIODeviceType_WASAPI (WASAPIDeviceMode::exclusive));
//addIfNotNull (list, AudioIODeviceType::createAudioIODeviceType_WASAPI (WASAPIDeviceMode::sharedLowLatency));
addIfNotNull (list, AudioIODeviceType::createAudioIODeviceType_DirectSound());
addIfNotNull (list, AudioIODeviceType::createAudioIODeviceType_ASIO());
addIfNotNull (list, AudioIODeviceType::createAudioIODeviceType_CoreAudio());
Expand Down
61 changes: 61 additions & 0 deletions modules/juce_audio_plugin_client/juce_audio_plugin_client_AAX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ static_assert (AAX_SDK_CURRENT_REVISION >= AAX_SDK_2p4p0_REVISION, "JUCE require
#include <AAX_Assert.h>
#include <AAX_TransportTypes.h>

#if JucePlugin_Enable_ARA
#include <ARAAAX.h>
#include <AAX_VARABinding.h>
#endif

JUCE_END_IGNORE_WARNINGS_MSVC
JUCE_END_IGNORE_WARNINGS_GCC_LIKE

Expand Down Expand Up @@ -723,6 +728,12 @@ namespace AAXClasses
void mouseUp (const MouseEvent& e) override { callMouseMethod (e, &AAX_IViewContainer::HandleParameterMouseUp); }
void mouseDrag (const MouseEvent& e) override { callMouseMethod (e, &AAX_IViewContainer::HandleParameterMouseDrag); }

void resized() override
{
if (pluginEditor != nullptr)
pluginEditor->setBounds (getLocalBounds());
}

void parentSizeChanged() override
{
resizeHostWindow();
Expand Down Expand Up @@ -847,6 +858,14 @@ namespace AAXClasses
return new JuceAAX_Processor();
}

#if JucePlugin_Enable_ARA
AAX_Result Initialize (IACFUnknown* iController) override
{
aaxaraBinding.reset (new ARA::AAX_VARABinding (iController));
return AAX_CEffectParameters::Initialize (iController);
}
#endif

AAX_Result Uninitialize() override
{
cancelPendingUpdate();
Expand All @@ -866,6 +885,36 @@ namespace AAXClasses
AAX_Result EffectInit() override
{
cancelPendingUpdate();

#if JucePlugin_Enable_ARA
ARA::ARAPlugInInstanceRoleFlags knownRoles = 0;
auto result = aaxaraBinding->GetInstanceRoleFlags (&knownRoles, &assignedRoles);

// If no ARA roles provided - work as a regular AAX plug-in
if (result == AAX_SUCCESS)
{
assignedRoles &= (ARA::kARAPlaybackRendererRole | ARA::kARAEditorRendererRole | ARA::kARAEditorViewRole);
if (assignedRoles)
{
result = aaxaraBinding->GetDocumentController (&documentControllerRef);
if (result != AAX_SUCCESS)
return result;

auto araPluginExtension = dynamic_cast<AudioProcessorARAExtension*> (pluginInstance.get());
if (!araPluginExtension)
return AAX_ERROR_NULL_OBJECT;

auto* const plugInEnxtensionInstance = araPluginExtension->bindToARA (documentControllerRef, knownRoles, assignedRoles);
if (!plugInEnxtensionInstance)
return AAX_ERROR_NULL_OBJECT;

result = aaxaraBinding->SetPlugInExtensionInstance (plugInEnxtensionInstance);
if (result != AAX_SUCCESS)
return result;
}
}
#endif

check (Controller()->GetSampleRate (&sampleRate));
processingSidechainChange = false;
auto err = preparePlugin();
Expand Down Expand Up @@ -2290,6 +2339,12 @@ namespace AAXClasses
std::atomic<int> state { 0 };
};

#if JucePlugin_Enable_ARA
std::unique_ptr<ARA::AAX_VARABinding> aaxaraBinding;
ARA::ARADocumentControllerRef documentControllerRef;
ARA::ARAPlugInInstanceRoleFlags assignedRoles;
#endif

RecordingState recordingState;

std::atomic<bool> processingSidechainChange, sidechainDesired;
Expand Down Expand Up @@ -2557,6 +2612,12 @@ namespace AAXClasses
}
}

#if JucePlugin_Enable_ARA
properties->AddProperty (AAX_eProperty_UsesTransport, true);
properties->AddProperty (AAX_eProperty_Constraint_Topology, AAX_eConstraintTopology_Monolithic);
properties->AddPointerProperty (ARA::AAX_eProperty_ARAFactoryPointer, createARAFactory());
#endif

check (desc.AddProcessProc_Native (algorithmProcessCallback, properties));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,18 @@ class JuceVSTWrapper final : public AudioProcessorListener,
void getEditorBounds (Vst2::ERect& bounds)
{
auto editorBounds = getSizeToContainChild();
bounds = convertToHostBounds ({ 0, 0, (int16) editorBounds.getHeight(), (int16) editorBounds.getWidth() });

// Acon Digital modification - circumvention of VST hosting error in EDIUS when runnng high-DPI mode
String hostPath = File::getSpecialLocation (File::hostApplicationPath).getFileNameWithoutExtension();
if (hostPath.containsIgnoreCase ("edius")) {
auto mainDisplay = Desktop::getInstance().getDisplays().getPrimaryDisplay();
float desktopScale = mainDisplay != nullptr ? mainDisplay->dpi / 96.f : 1.f;
float ediusCorrectionScale = 1.f + (desktopScale - 1.f) / desktopScale;
bounds = { 0, 0, (int16) roundToInt (editorBounds.getHeight() * ediusCorrectionScale),
(int16) roundToInt (editorBounds.getWidth() * ediusCorrectionScale) };
}
else
bounds = convertToHostBounds ({ 0, 0, (int16) editorBounds.getHeight(), (int16) editorBounds.getWidth() });
}

void attachToHost (VstOpCodeArguments args)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,21 @@ class JUCE_API AudioUnitPluginFormat : public AudioPluginFormat
bool canScanForPlugins() const override { return true; }
bool isTrivialToScan() const override { return false; }

//==============================================================================
/** Attempts to reload an AU plugin's state from some preset file data.

@see VSTPluginFormat::loadFromFXBFile
*/
static bool setStateFromAUPresetFile (AudioPluginInstance*, const MemoryBlock&);

//==============================================================================
/** Attempts to save an AU plugin's state to some preset file data.

@see VSTPluginFormat::saveToFXBFile
*/
static bool saveStateToAUPresetFile (AudioPluginInstance*, MemoryBlock&);

//==============================================================================
void findAllTypesForFile (OwnedArray<PluginDescription>&, const String& fileOrIdentifier) override;
bool fileMightContainThisPluginType (const String& fileOrIdentifier) override;
String getNameOfPluginFromIdentifier (const String& fileOrIdentifier) override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2796,6 +2796,72 @@ void messageCallback() override
{
}

bool AudioUnitPluginFormat::setStateFromAUPresetFile (AudioPluginInstance* api, const MemoryBlock& rawData)
{
AudioUnit audioUnit = (AudioUnit) api->getPlatformSpecificData();
jassert (audioUnit != nullptr);

CFReadStreamRef stream = CFReadStreamCreateWithBytesNoCopy (kCFAllocatorDefault, (const UInt8*) rawData.getData(),
rawData.getSize(), kCFAllocatorNull);
CFReadStreamOpen (stream);

CFPropertyListFormat format = kCFPropertyListBinaryFormat_v1_0;
CFPropertyListRef propertyList = CFPropertyListCreateFromStream (kCFAllocatorDefault, stream, 0,
kCFPropertyListImmutable, &format, 0);
CFRelease (stream);

if (propertyList != 0)
{
AudioUnitSetProperty (audioUnit, kAudioUnitProperty_ClassInfo, kAudioUnitScope_Global,
0, &propertyList, sizeof (propertyList));

AudioUnitParameter param;
param.mAudioUnit = audioUnit;
param.mParameterID = kAUParameterListener_AnyParameter;

AUParameterListenerNotify (nullptr, nullptr, &param);

CFRelease (propertyList);
return true;
}
else
return false;
}

bool AudioUnitPluginFormat::saveStateToAUPresetFile (AudioPluginInstance* api, MemoryBlock& rawData)
{
AudioUnit audioUnit = (AudioUnit) api->getPlatformSpecificData();
jassert (audioUnit != nullptr);

CFPropertyListRef propertyList = 0;
UInt32 sz = sizeof (CFPropertyListRef);

if (AudioUnitGetProperty (audioUnit,
kAudioUnitProperty_ClassInfo,
kAudioUnitScope_Global,
0, &propertyList, &sz) == noErr)
{
CFWriteStreamRef stream = CFWriteStreamCreateWithAllocatedBuffers (kCFAllocatorDefault, kCFAllocatorDefault);
CFWriteStreamOpen (stream);

CFIndex bytesWritten = CFPropertyListWriteToStream (propertyList, stream, kCFPropertyListBinaryFormat_v1_0, 0);
CFWriteStreamClose (stream);

CFDataRef data = (CFDataRef) CFWriteStreamCopyProperty (stream, kCFStreamPropertyDataWritten);

rawData.setSize ((size_t) bytesWritten);
rawData.copyFrom (CFDataGetBytePtr (data), 0, bytesWritten);
CFRelease (data);

CFRelease (stream);
CFRelease (propertyList);

return true;
}
else
return false;
}

void AudioUnitPluginFormat::findAllTypesForFile (OwnedArray<PluginDescription>& results,
const String& fileOrIdentifier)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1884,14 +1884,15 @@ struct VSTPluginInstance final : public AudioPluginInstance,
auto totalLen = sizeof (fxProgramSet) + chunk.getSize() - 8;
dest.setSize (totalLen, true);

// Acon Digital modification - fixed errors in FXB format
auto set = (fxProgramSet*) dest.getData();
set->chunkMagic = fxbName ("CcnK");
set->byteSize = 0;
set->byteSize = fxbSwap ((int) totalLen - 8);
set->fxMagic = fxbName ("FPCh");
set->version = fxbSwap (fxbVersionNum);
set->fxID = fxbSwap (getUID());
set->fxVersion = fxbSwap (getVersionNumber());
set->numPrograms = fxbSwap (numPrograms);
set->numPrograms = fxbSwap (getNumParameters());
set->chunkSize = fxbSwap ((int32) chunk.getSize());

getCurrentProgramName().copyToUTF8 (set->name, sizeof (set->name) - 1);
Expand Down
10 changes: 9 additions & 1 deletion modules/juce_gui_basics/buttons/juce_Button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -509,8 +509,10 @@ bool Button::isMouseSourceOver (const MouseEvent& e)
return isMouseOver();
}

void Button::focusGained (FocusChangeType)
void Button::focusGained (FocusChangeType cause)
{
// Acon Digital modification - keep track of focus change cause
lastFocusChangeCause = cause;
updateState();
repaint();
}
Expand Down Expand Up @@ -664,6 +666,12 @@ bool Button::keyPressed (const KeyPress& key)
return false;
}

// Acon Digital modification - keep track of focus change cause
Component::FocusChangeType Button::getLastFocusChangeCause()
{
return lastFocusChangeCause;
}

//==============================================================================
void Button::setRepeatSpeed (int initialDelayMillisecs,
int repeatMillisecs,
Expand Down
6 changes: 6 additions & 0 deletions modules/juce_gui_basics/buttons/juce_Button.h
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,10 @@ class JUCE_API Button : public Component,
/** Returns the button's current over/down/up state. */
ButtonState getState() const noexcept { return buttonState; }


/** Acon Digital modification - keep track of focus change cause */
FocusChangeType getLastFocusChangeCause();

//==============================================================================
/** This abstract base class is implemented by LookAndFeel classes to provide
button-drawing functionality.
Expand Down Expand Up @@ -524,6 +528,8 @@ class JUCE_API Button : public Component,
bool triggerOnMouseDown = false;
bool generateTooltip = false;

/** Acon Digital modification - keep track of focus change cause */
FocusChangeType lastFocusChangeCause = focusChangedDirectly;
void checkToggleableState (bool wasToggleable);

void repeatTimerCallback();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,13 @@ void ApplicationCommandManager::registerCommand (const ApplicationCommandInfo& n
// Trying to re-register the same command ID with different parameters can often indicate a typo.
// This assertion is here because I've found it useful catching some mistakes, but it may also cause
// false alarms if you're deliberately updating some flags for a command.
jassert (newCommand.shortName == getCommandForID (newCommand.commandID)->shortName
&& newCommand.categoryName == getCommandForID (newCommand.commandID)->categoryName
&& newCommand.defaultKeypresses == getCommandForID (newCommand.commandID)->defaultKeypresses
&& (newCommand.flags & (ApplicationCommandInfo::wantsKeyUpDownCallbacks | ApplicationCommandInfo::hiddenFromKeyEditor | ApplicationCommandInfo::readOnlyInKeyEditor))
== (getCommandForID (newCommand.commandID)->flags & (ApplicationCommandInfo::wantsKeyUpDownCallbacks | ApplicationCommandInfo::hiddenFromKeyEditor | ApplicationCommandInfo::readOnlyInKeyEditor)));

/** Acon Digital modification - disable unnecessary assert */
//jassert (newCommand.shortName == getCommandForID (newCommand.commandID)->shortName
// && newCommand.categoryName == getCommandForID (newCommand.commandID)->categoryName
// && newCommand.defaultKeypresses == getCommandForID (newCommand.commandID)->defaultKeypresses
// && (newCommand.flags & (ApplicationCommandInfo::wantsKeyUpDownCallbacks | ApplicationCommandInfo::hiddenFromKeyEditor | ApplicationCommandInfo::readOnlyInKeyEditor))
// == (getCommandForID (newCommand.commandID)->flags & (ApplicationCommandInfo::wantsKeyUpDownCallbacks | ApplicationCommandInfo::hiddenFromKeyEditor | ApplicationCommandInfo::readOnlyInKeyEditor)));

*command = newCommand;
}
Expand Down
4 changes: 3 additions & 1 deletion modules/juce_gui_basics/drawables/juce_SVGParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,9 @@ class SVGState

FillType type (gradient);

auto gradientTransform = parseTransform (fillXml->getStringAttribute ("gradientTransform"));
/** Acon Digital modification - fixed error in SVG parsing */
auto gradientTransform = parseTransform (fillXml->getStringAttribute ("gradientTransform"))
.followedBy (transform);

if (gradient.isRadial)
{
Expand Down
14 changes: 8 additions & 6 deletions modules/juce_gui_basics/keyboard/juce_KeyPress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ KeyPress KeyPress::createFromDescription (const String& desc)
int modifiers = 0;

for (int i = 0; i < numElementsInArray (KeyPressHelpers::modifierNames); ++i)
if (desc.containsWholeWordIgnoreCase (KeyPressHelpers::modifierNames[i].name))
/** Acon Digital modification - translate modifier names */
if (desc.containsWholeWordIgnoreCase (TRANS (KeyPressHelpers::modifierNames[i].name)))
modifiers |= KeyPressHelpers::modifierNames[i].flag;

int key = 0;
Expand Down Expand Up @@ -237,14 +238,15 @@ String KeyPress::getTextDescription() const
if (textCharacter == '/' && keyCode != numberPadDivide)
return "/";

if (mods.isCtrlDown()) desc << "ctrl + ";
if (mods.isShiftDown()) desc << "shift + ";
/** Acon Digital modification - translate modifier names */
if (mods.isCtrlDown()) desc << TRANS ("ctrl") + " + ";
if (mods.isShiftDown()) desc << TRANS ("shift") + " + ";

#if JUCE_MAC || JUCE_IOS
if (mods.isAltDown()) desc << "option + ";
if (mods.isCommandDown()) desc << "command + ";
if (mods.isAltDown()) desc << TRANS ("option") + " + ";
if (mods.isCommandDown()) desc << TRANS ("command") + " + ";
#else
if (mods.isAltDown()) desc << "alt + ";
if (mods.isAltDown()) desc << TRANS ("alt") + " + ";
#endif

for (int i = 0; i < numElementsInArray (KeyPressHelpers::translations); ++i)
Expand Down
2 changes: 2 additions & 0 deletions modules/juce_gui_basics/native/juce_Windowing_windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2085,6 +2085,8 @@ class HWNDComponentPeer final : public ComponentPeer,
void repaint (const Rectangle<int>& area) override
{
deferredRepaints.add ((area.toDouble() * getPlatformScaleFactor()).getSmallestIntegerContainer());
/** Acon Digital modification - fix issues with freezed UI */
dispatchDeferredRepaints();
}

void dispatchDeferredRepaints()
Expand Down
14 changes: 13 additions & 1 deletion modules/juce_gui_basics/widgets/juce_ComboBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,19 @@ void ComboBox::showPopup()
ModalCallbackFunction::forComponent (comboBoxPopupMenuFinishedCallback, this));
}

//==============================================================================
/** Acon Digital modification - allow for visual mouse over indications */
void ComboBox::mouseEnter (const MouseEvent& e)
{
Component::mouseEnter (e);
repaint();
}

void ComboBox::mouseExit (const MouseEvent& e)
{
Component::mouseExit (e);
repaint();
}

void ComboBox::mouseDown (const MouseEvent& e)
{
beginDragAutoRepeat (300);
Expand Down
5 changes: 5 additions & 0 deletions modules/juce_gui_basics/widgets/juce_ComboBox.h
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,11 @@ class JUCE_API ComboBox : public Component,
void handleAsyncUpdate() override;
/** @internal */
String getTooltip() override { return label->getTooltip(); }
/** Acon Digital modification - allow for visual mouse over indications */
/** @internal */
void mouseEnter (const MouseEvent&) override;
/** @internal */
void mouseExit (const MouseEvent&) override;
/** @internal */
void mouseDown (const MouseEvent&) override;
/** @internal */
Expand Down
Loading
Loading