# setLatencySamples - patch to fix bug where automation is disabled

**URL:** <https://forum.juce.com/t/setlatencysamples-patch-to-fix-bug-where-automation-is-disabled/36110>\
**Category:** General JUCE discussion\
**Created:** [November 12, 2019, 9:04am UTC](https://forum.juce.com/t/setlatencysamples-patch-to-fix-bug-where-automation-is-disabled/36110 "2019-11-12T09:04:41Z")\
**Posts on this page:** 4\
**Page:** 1

<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:** [November 12, 2019, 9:04am UTC](https://forum.juce.com/t/setlatencysamples-patch-to-fix-bug-where-automation-is-disabled/36110/1 "2019-11-12T09:04:42Z")

</div>

[latency.patch](https://forum.juce.com/uploads/short-url/wW13W60iPAomTK09B9Wh3eIluxF.patch) (9.1 KB)

This is a patch for 5.4.4 which stops JUCE disabling automation when changing the reported latency with setLatencySamples().

I think it probably ought to use a separate call for latencyChanged notfiication or an enum on audioProcessorChanged - I’ve done it with a bool for now but it’s not very tidy as a result.

Fixes:

> [@AudioProcessor::setLatencySamples() disables automation in Ableton (vst & au)](https://forum.juce.com/t/audioprocessor-setlatencysamples-disables-automation-in-ableton-vst-au/24057/7):
>
> I think we would have been calling it from the message thread…! (sure looks like it!)

---

<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:** [July 31, 2020, 5:50pm UTC](https://forum.juce.com/t/setlatencysamples-patch-to-fix-bug-where-automation-is-disabled/36110/2 "2020-07-31T17:50:36Z")

</div>

Thanks for this patch! Has it fixed the Ableton-automation-disabled issue for you?

Has anyone at JUCE taken a look at it? We (and I’m sure all JUCE users) would love to have this fix in mainline JUCE; this has been a nagging issue for us over the years.

---

<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 3, 2020, 2:53pm UTC](https://forum.juce.com/t/setlatencysamples-patch-to-fix-bug-where-automation-is-disabled/36110/3 "2020-08-03T14:53:28Z")

</div>

I’m pretty sure it worked.

---

<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:** [February 22, 2021, 6:20pm UTC](https://forum.juce.com/t/setlatencysamples-patch-to-fix-bug-where-automation-is-disabled/36110/4 "2021-02-22T18:20:45Z")

</div>

For anyone who reads this later, I believe this was fixed in JUCE here: [AudioProcessor::setLatencySamples() disables automation in Ableton (vst & au) - #27 by reuk](https://forum.juce.com/t/audioprocessor-setlatencysamples-disables-automation-in-ableton-vst-au/24057/27)
