# Look-ahead vs DAW's latency compensation

**URL:** <https://forum.juce.com/t/look-ahead-vs-daws-latency-compensation/30384>\
**Category:** General JUCE discussion\
**Created:** [November 15, 2018, 1:36pm UTC](https://forum.juce.com/t/look-ahead-vs-daws-latency-compensation/30384 "2018-11-15T13:36:49Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![xenakios](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/xenakios/32/4047_2.png) [@xenakios](https://forum.juce.com/u/xenakios)\
**Post date:** [November 15, 2018, 1:40pm UTC](https://forum.juce.com/t/look-ahead-vs-daws-latency-compensation/30384/2 "2018-11-15T13:40:00Z")

</div>

```auto
void AudioProcessor::setLatencySamples (int newLatency )

Your processor subclass should call this to set the number of samples delay that it introduces.

The processor should call this as soon as it can during initialisation, and can call it later if the value changes.
```

Note that attempting the on-the-fly latency changes might not work in many hosts. You should play it safe and set the _maximum_ latency your plugin will ever produce. Then to compensate for that, you will need to do some internal buffering in the plugin if the internal latency is actually lower.

---

_[View the full topic](https://forum.juce.com/t/look-ahead-vs-daws-latency-compensation/30384)._
