Br: auv3 doesn't send change gestures (+ a fix)

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:

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];
             }

Thanks for reporting. Something similar has been added on develop:

1 Like

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.

also i’m on arm - i’ll test the behavior on intel this weekend.

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:

1 Like

thanks @reuk , this behaves as expected.