# AudioProcessor::setLatencySamples() disables automation in Ableton (vst & au)

**URL:** <https://forum.juce.com/t/audioprocessor-setlatencysamples-disables-automation-in-ableton-vst-au/24057>\
**Category:** Audio Plugins\
**Created:** [September 5, 2017, 2:14pm UTC](https://forum.juce.com/t/audioprocessor-setlatencysamples-disables-automation-in-ableton-vst-au/24057 "2017-09-05T14:14:07Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![scopedaudio](https://avatars.discourse-cdn.com/v4/letter/s/258eb7/32.png) [@scopedaudio](https://forum.juce.com/u/scopedaudio)\
**Post date:** [September 5, 2017, 2:14pm UTC](https://forum.juce.com/t/audioprocessor-setlatencysamples-disables-automation-in-ableton-vst-au/24057/1 "2017-09-05T14:14:07Z")

</div>

Hi,  
When you manually set a plugin parameter in Ableton, the automation for that parameter disables. You have to press the button “Re-Enable Automation” to follow the automation again.  
If I call setLatencySamples() in my audio processor and the value is changed, the automation also gets disabled.

It happens for AU and VST on a mac 10.12.5. I’m using juce 5.1.1 .  
Is this a bug?

thanks!

---

<div class="post-metadata">

**Author:** ![goodhertz](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/goodhertz/32/74_2.png) [@goodhertz](https://forum.juce.com/u/goodhertz)\
**Post date:** [September 6, 2017, 1:19am UTC](https://forum.juce.com/t/audioprocessor-setlatencysamples-disables-automation-in-ableton-vst-au/24057/2 "2017-09-06T01:19:55Z")

</div>

We’re also seeing this bug in our plugins. After investigating a little, we narrowed it down to `AudioProcessor::updateHostDisplay()`, which calls `audioProcessorChanged()`.

In the AU wrapper, this then calls `PropertyChanged()` for a number of properties, even though latency is the only thing that changed. Commenting out line 1020 of `juce_AU_wrapper.mm` fixes this behavior: `PropertyChanged (kAudioUnitProperty_PresentPreset, kAudioUnitScope_Global, 0);`.

Ableton polls the values of all parameters and sets them internally when notified that a preset change may have occurred. This marks all parameters as “manually updated”, even though the value has not actually been set by the plugin, and therefore the automation is disabled because it is overridden by the “manual” setting.

In the VST wrapper, the specific cause isn’t as easy to see. Commenting out `hostCallback (&vstEffect, hostOpcodeUpdateView, 0, 0, 0, 0);` fixes the problem, but by doing this we also probably stop informing the host of the latency change. There must be a way around this, since we’ve tested other non-juce plugins in Ableton and they are able to change the latency without disabling automation.

---

<div class="post-metadata">

**Author:** ![goodhertz](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/goodhertz/32/74_2.png) [@goodhertz](https://forum.juce.com/u/goodhertz)\
**Post date:** [October 20, 2017, 5:35pm UTC](https://forum.juce.com/t/audioprocessor-setlatencysamples-disables-automation-in-ableton-vst-au/24057/3 "2017-10-20T17:35:36Z")

</div>

Any info on this? This has the potential to ruin customers’ bounces because it could silently disable automation for the bounce only.

---

<div class="post-metadata">

**Author:** ![lalala](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/lalala/32/8577_2.png) [@lalala](https://forum.juce.com/u/lalala)\
**Post date:** [October 20, 2017, 7:27pm UTC](https://forum.juce.com/t/audioprocessor-setlatencysamples-disables-automation-in-ableton-vst-au/24057/4 "2017-10-20T19:27:33Z")

</div>

so I guess the issue arises when you call `setLatencySamples()` (or `updateHostDisplay()`) from the _audio thread_ right?  
If you call it from the message thread it’s all fine?

---

<div class="post-metadata">

**Author:** ![jimc](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/jimc/32/16067_2.png) [@jimc](https://forum.juce.com/u/jimc)\
**Post date:** [August 21, 2018, 8:02am UTC](https://forum.juce.com/t/audioprocessor-setlatencysamples-disables-automation-in-ableton-vst-au/24057/5 "2018-08-21T08:02:51Z")

</div>

Anyone get anywhere with this? We also have a plugin which we called updateHostDisplay from and yep … on Windows and Mac Ableton seems to pop out of automation mode for no good reason …

---

<div class="post-metadata">

**Author:** ![lalala](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/lalala/32/8577_2.png) [@lalala](https://forum.juce.com/u/lalala)\
**Post date:** [August 21, 2018, 8:14am UTC](https://forum.juce.com/t/audioprocessor-setlatencysamples-disables-automation-in-ableton-vst-au/24057/6 "2018-08-21T08:14:14Z")

</div>

Do you call updateHostDisplay from the audio thread? I think that if you call it from the message thread you should be fine

---

<div class="post-metadata">

**Author:** ![jimc](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/jimc/32/16067_2.png) [@jimc](https://forum.juce.com/u/jimc)\
**Post date:** [August 21, 2018, 9:48am UTC](https://forum.juce.com/t/audioprocessor-setlatencysamples-disables-automation-in-ableton-vst-au/24057/7 "2018-08-21T09:48:59Z")

</div>

> [@hguthertz](#):
>
> hostOpcodeUpdateView

I think we would have been calling it from the message thread…!

(sure looks like  
it!)

---

<div class="post-metadata">

**Author:** ![domsmart](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/domsmart/32/5477_2.png) [@domsmart](https://forum.juce.com/u/domsmart)\
**Post date:** [June 9, 2019, 4:58pm UTC](https://forum.juce.com/t/audioprocessor-setlatencysamples-disables-automation-in-ableton-vst-au/24057/8 "2019-06-09T16:58:08Z")

</div>

Juce team - is there any chance of a fix for this please?

We have a pitch shifter plug-in where we need to call setLatencySamples() when the shift mode is changed. Yet in Ableton Live, this always causes Live to be thrown out of automation read, and for every parameter to be written as automation to the current track, if done when in record.

---

<div class="post-metadata">

**Author:** ![jimc](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/jimc/32/16067_2.png) [@jimc](https://forum.juce.com/u/jimc)\
**Post date:** [June 9, 2019, 5:23pm UTC](https://forum.juce.com/t/audioprocessor-setlatencysamples-disables-automation-in-ableton-vst-au/24057/9 "2019-06-09T17:23:04Z")

</div>

We think this function needs to get better information from the processor on what changed, and then make fewer property changed callbacks to the AU stuff:

```
void audioProcessorChanged (AudioProcessor*) override
{
    DBG("AU: sendAUEvent audioProcessorChanged");
    PropertyChanged (kAudioUnitProperty_Latency, kAudioUnitScope_Global, 0);
    PropertyChanged (kAudioUnitProperty_ParameterList, kAudioUnitScope_Global, 0);
    PropertyChanged (kAudioUnitProperty_ParameterInfo, kAudioUnitScope_Global, 0);
    PropertyChanged (kAudioUnitProperty_ClassInfo, kAudioUnitScope_Global, 0);

    refreshCurrentPreset();

    PropertyChanged (kAudioUnitProperty_PresentPreset, kAudioUnitScope_Global, 0);
}
```

---

<div class="post-metadata">

**Author:** ![jimc](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/jimc/32/16067_2.png) [@jimc](https://forum.juce.com/u/jimc)\
**Post date:** [August 28, 2019, 9:17am UTC](https://forum.juce.com/t/audioprocessor-setlatencysamples-disables-automation-in-ableton-vst-au/24057/10 "2019-08-28T09:17:26Z")

</div>

Hello … is there anyone from JUCE here? 🙂

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [August 28, 2019, 9:30am UTC](https://forum.juce.com/t/audioprocessor-setlatencysamples-disables-automation-in-ableton-vst-au/24057/11 "2019-08-28T09:30:13Z")

</div>

Tom is on holiday. Ed has 150 browser tabs open with forum posts to answer and he’s working his way through them…

---

<div class="post-metadata">

**Author:** ![dave96](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/dave96/32/8487_2.png) [@dave96](https://forum.juce.com/u/dave96)\
**Post date:** [August 28, 2019, 9:38am UTC](https://forum.juce.com/t/audioprocessor-setlatencysamples-disables-automation-in-ableton-vst-au/24057/12 "2019-08-28T09:38:19Z")

</div>

150… How much RAM is that using?

---

<div class="post-metadata">

**Author:** ![jimc](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/jimc/32/16067_2.png) [@jimc](https://forum.juce.com/u/jimc)\
**Post date:** [August 28, 2019, 12:33pm UTC](https://forum.juce.com/t/audioprocessor-setlatencysamples-disables-automation-in-ableton-vst-au/24057/13 "2019-08-28T12:33:13Z")

</div>

Cheers Jules!

My wife regularly has 150 tabs open in Chrome, she keeps everything she’s interested in open all the time … I have no idea how that works because each tab heading is about 5 pixels across … it’d drive me nuts!

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [August 28, 2019, 12:35pm UTC](https://forum.juce.com/t/audioprocessor-setlatencysamples-disables-automation-in-ableton-vst-au/24057/14 "2019-08-28T12:35:34Z")

</div>

I think I might have been exaggerating a bit there, but he does have a lot of tabs open…

---

<div class="post-metadata">

**Author:** ![jimc](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/jimc/32/16067_2.png) [@jimc](https://forum.juce.com/u/jimc)\
**Post date:** [August 28, 2019, 12:37pm UTC](https://forum.juce.com/t/audioprocessor-setlatencysamples-disables-automation-in-ableton-vst-au/24057/15 "2019-08-28T12:37:35Z")

</div>

Actually, I’m just writing some code to fix this at the moment. I don’t know whether you’ll like it … the choice is between a new method in AudioProcessorListener or a boolean flag like this:

void audioProcessorChanged (AudioProcessor\* processor, bool latencyChanged) override;

Or an even fancier more granular set of flags to audioProcessorChanged.

If you’ve got a preference I can send you a drop in patch if it works…

---

<div class="post-metadata">

**Author:** ![jimc](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/jimc/32/16067_2.png) [@jimc](https://forum.juce.com/u/jimc)\
**Post date:** [August 28, 2019, 12:43pm UTC](https://forum.juce.com/t/audioprocessor-setlatencysamples-disables-automation-in-ableton-vst-au/24057/16 "2019-08-28T12:43:21Z")

</div>

I think the right answer is probably `AudioProcessorListener::latencyChanged() = 0;`

---

<div class="post-metadata">

**Author:** ![ttg](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ttg/32/14456_2.png) [@ttg](https://forum.juce.com/u/ttg)\
**Post date:** [October 26, 2020, 2:15pm UTC](https://forum.juce.com/t/audioprocessor-setlatencysamples-disables-automation-in-ableton-vst-au/24057/17 "2020-10-26T14:15:15Z")

</div>

Anything new? since this 1year old and I’m in a bug-squashing hunt.  
Would be nice to know if I’m missing something or each developer implemented some workaround on their own codebase.

Thanks!

---

<div class="post-metadata">

**Author:** ![ttg](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ttg/32/14456_2.png) [@ttg](https://forum.juce.com/u/ttg)\
**Post date:** [October 26, 2020, 6:10pm UTC](https://forum.juce.com/t/audioprocessor-setlatencysamples-disables-automation-in-ableton-vst-au/24057/18 "2020-10-26T18:10:01Z")

</div>

> [@jimc](#):
>
> void audioProcessorChanged (AudioProcessor\* processor, bool latencyChanged) override;

Did you ever applied it? I have yet to think of a simple way setting latency without getting into:

> **[Re-enable Automation keeps lighting up](https://help.ableton.com/hc/en-us/articles/209069409--Re-enable-Automation-keeps-lighting-up)**
>
> Live Versions: All
> 
> Operating System: All
> 
> The Re-enable Automation button may unexpectedly light up as soon as Arrangement playback is started or when a set is opened.
> 
> The problem could be caused...

From the method above I thought about doing an `int` instead of `bool` that will indicate which events changed (latency/preset/etc) so it’ll only use relevant properties/callbacks.

---

<div class="post-metadata">

**Author:** ![jimc](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/jimc/32/16067_2.png) [@jimc](https://forum.juce.com/u/jimc)\
**Post date:** [October 27, 2020, 1:25pm UTC](https://forum.juce.com/t/audioprocessor-setlatencysamples-disables-automation-in-ableton-vst-au/24057/19 "2020-10-27T13:25:03Z")

</div>

Well, I think we patched it for one of our plugins but I don’t remember if it was ever fixed in JUCE.

---

<div class="post-metadata">

**Author:** ![jimc](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/jimc/32/16067_2.png) [@jimc](https://forum.juce.com/u/jimc)\
**Post date:** [October 27, 2020, 1:25pm UTC](https://forum.juce.com/t/audioprocessor-setlatencysamples-disables-automation-in-ableton-vst-au/24057/20 "2020-10-27T13:25:37Z")

</div>

Maybe Ed still has those browser tabs to work through 🙂

[Next page](https://forum.juce.com/t/audioprocessor-setlatencysamples-disables-automation-in-ableton-vst-au/24057.md?page=2)
