modosc
January 17, 2022, 2:10am
#1
i noticed that auv3 plugins don’t send gesture information (specifically, AudioPluginHost
hosting AUv3SynthPluginDemo
on macos). is there an auv3 equivalent to AUParameterAutomationEventType ?
update: it looks like it could be added here in setValue:originator:atHostTime:eventType:
modosc
January 20, 2022, 9:28pm
#2
i’ve got an (updated) patch that seems to be working:
diff --git a/modules/juce_audio_plugin_client/AU/juce_AUv3_Wrapper.mm b/modules/juce_audio_plugin_client/AU/juce_AUv3_Wrapper.mm
index 5b4b129ef..ca1b62d26 100644
--- a/modules/juce_audio_plugin_client/AU/juce_AUv3_Wrapper.mm
+++ b/modules/juce_audio_plugin_client/AU/juce_AUv3_Wrapper.mm
@@ -56,6 +56,12 @@
#import <AudioToolbox/AudioToolbox.h>
#import <AVFoundation/AVFoundation.h>
+#if JUCE_IOS
+#include <mach/mach_time.h>
+#else
+#include <CoreAudio/HostTime.h>
+#endif
+
#include <juce_graphics/native/juce_mac_CoreGraphicsHelpers.h>
#include <juce_audio_basics/native/juce_mac_CoreAudioLayouts.h>
#include <juce_audio_processors/format_types/juce_LegacyAudioParameter.cpp>
@@ -968,6 +974,41 @@ public:
}
}
+
+ UInt64 getTimeStamp() {
+ #if JUCE_IOS
+ return mach_absolute_time();
+ #else
+ return AudioGetCurrentHostTime();
+ #endif
+ }
+
+ void sendParameterChangeGesture(int idx, AUParameterAutomationEventType eventType) {
+ if (editorObserverToken == nullptr)
+ return;
+
+ if (auto* juceParam = juceParameters.getParamForIndex (idx))
+ {
+ if (AUParameter* param = [paramTree.get() parameterWithAddress: getAUParameterAddressForIndex (idx)])
+ {
+ auto value = getValue(param);
+
+ [param setValue: value originator: editorObserverToken atHostTime: getTimeStamp() eventType: eventType];
+ }
+ }
+ }
+
+
+ void audioProcessorParameterChangeGestureBegin (AudioProcessor*, int idx) override
+ {
+ sendParameterChangeGesture(idx, AUParameterAutomationEventTypeTouch);
+ }
+
+ void audioProcessorParameterChangeGestureEnd (AudioProcessor*, int idx) override
+ {
+ sendParameterChangeGesture(idx, AUParameterAutomationEventTypeRelease);
+ }
+
void audioProcessorParameterChanged (AudioProcessor*, int idx, float newValue) override
{
if (inParameterChangedCallback.get())
@@ -983,7 +1024,7 @@ public:
newValue *= getMaximumParameterValue (juceParam);
if (editorObserverToken != nullptr)
- [param setValue: newValue originator: editorObserverToken];
+ [param setValue: newValue originator: editorObserverToken atHostTime: getTimeStamp() eventType: AUParameterAutomationEventTypeValue];
else
[param setValue: newValue];
}
reuk
January 28, 2022, 6:58pm
#3
Thanks for reporting. Something similar has been added on develop:
committed 04:54PM - 17 Jan 22 UTC
Note that hosts using the AUv2 API (e.g. JUCE hosts) to host JUCE AUv3
plugins m… ay not receive begin/end gesture events, depending on the OS
version, and potentially the host architecture. I suspect this is
because older versions of the OS-provided AUv2/AUv3 translation layer
don't handle these events.
In testing, an Intel host on Catalina did not receive begin/end events,
but an Arm host on Monterey did receive these events.
1 Like
modosc
January 31, 2022, 2:03am
#4
hi @reuk - i just tested this and i don’t think it’s working 100%.
if you don’t set a timestamp on the setValue
call then the setValue
event occurs before the AUParameterAutomationEventTypeTouch
event. you can verify this in AudioPluginHost
with AUv3SynthPluginDemo
by enabling show debug log
.
modosc
February 2, 2022, 8:23pm
#5
also i’m on arm - i’ll test the behavior on intel this weekend.
reuk
February 8, 2022, 1:44pm
#6
Thanks for testing and reporting the issue. I’d attempted to make a minimal behavioural change, but the new behaviour was incorrect. I’ve attempted to rectify the problem here:
committed 12:14PM - 31 Jan 22 UTC
1 Like
modosc
February 9, 2022, 12:30am
#7
thanks @reuk , this behaves as expected.