# \[AAX\]\[PULL REQUEST\] Force Protools to do chunk calls in message thread option

**URL:** https://forum.juce.com/t/aax-pull-request-force-protools-to-do-chunk-calls-in-message-thread-option/40175
**Category:** Audio Plugins
**Created:** [June 17, 2020, 2:11pm UTC](https://forum.juce.com/t/aax-pull-request-force-protools-to-do-chunk-calls-in-message-thread-option/40175 "2020-06-17T14:11:33Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![bastienc](https://avatars.discourse-cdn.com/v4/letter/b/edb3f5/32.png) [@bastienc](https://forum.juce.com/u/bastienc)
#### Post date: [June 17, 2020, 2:11pm UTC](https://forum.juce.com/t/aax-pull-request-force-protools-to-do-chunk-calls-in-message-thread-option/40175/1 "2020-06-17T14:11:33Z")

</div>

Forces Protools to do chunk calls in message thread if JucePlugin\_AAXRequiresChunkCallsOnMainThread=1 is defined.

It prevents unexpected behaviors and potential crashes.

> <https://github.com/juce-framework/JUCE/pull/740>
>
> Add option "JucePlugin\_AAXRequiresChunkCallsOnMainThread"
> 
> Prevents crashes wh…ile loading sessions in Protools.
> It explicitly asks Protools to use message thread for chunk calls which improves code safety.

Please let me know your thoughts,  
Bastien

---

<div class="post-metadata">

### Author: ![otristan](https://avatars.discourse-cdn.com/v4/letter/o/f0a364/32.png) [@otristan](https://forum.juce.com/u/otristan)
#### Post date: [August 11, 2020, 9:50am UTC](https://forum.juce.com/t/aax-pull-request-force-protools-to-do-chunk-calls-in-message-thread-option/40175/2 "2020-08-11T09:50:27Z")

</div>

Could indeed be useful.

Guys ?

---

<div class="post-metadata">

### Author: ![otristan](https://avatars.discourse-cdn.com/v4/letter/o/f0a364/32.png) [@otristan](https://forum.juce.com/u/otristan)
#### Post date: [September 11, 2020, 2:10pm UTC](https://forum.juce.com/t/aax-pull-request-force-protools-to-do-chunk-calls-in-message-thread-option/40175/4 "2020-09-11T14:10:37Z")

</div>

AAX says this behaviour is deprecated and you have to deal with this but this is handy sometime 🙂

---

<div class="post-metadata">

### Author: ![otristan](https://avatars.discourse-cdn.com/v4/letter/o/f0a364/32.png) [@otristan](https://forum.juce.com/u/otristan)
#### Post date: [September 11, 2020, 2:13pm UTC](https://forum.juce.com/t/aax-pull-request-force-protools-to-do-chunk-calls-in-message-thread-option/40175/6 "2020-09-11T14:13:28Z")

</div>

Well this code does work and does what it does.  
Not sure this is what you needed in your default value issue though.

---

<div class="post-metadata">

### Author: ![otristan](https://avatars.discourse-cdn.com/v4/letter/o/f0a364/32.png) [@otristan](https://forum.juce.com/u/otristan)
#### Post date: [September 25, 2020, 2:05pm UTC](https://forum.juce.com/t/aax-pull-request-force-protools-to-do-chunk-calls-in-message-thread-option/40175/8 "2020-09-25T14:05:46Z")

</div>

bumpity bump

---

<div class="post-metadata">

### Author: ![otristan](https://avatars.discourse-cdn.com/v4/letter/o/f0a364/32.png) [@otristan](https://forum.juce.com/u/otristan)
#### Post date: [November 20, 2020, 10:27am UTC](https://forum.juce.com/t/aax-pull-request-force-protools-to-do-chunk-calls-in-message-thread-option/40175/9 "2020-11-20T10:27:18Z")

</div>

post ADC bump 🙂

---

<div class="post-metadata">

### Author: ![bastienc](https://avatars.discourse-cdn.com/v4/letter/b/edb3f5/32.png) [@bastienc](https://forum.juce.com/u/bastienc)
#### Post date: [December 10, 2020, 10:49am UTC](https://forum.juce.com/t/aax-pull-request-force-protools-to-do-chunk-calls-in-message-thread-option/40175/10 "2020-12-10T10:49:14Z")

</div>

Please someone witness our effort to reach out.  
Oh spirit of juce forum! if you are here with us knok 3 times!

---

<div class="post-metadata">

### Author: ![otristan](https://avatars.discourse-cdn.com/v4/letter/o/f0a364/32.png) [@otristan](https://forum.juce.com/u/otristan)
#### Post date: [January 4, 2021, 9:17am UTC](https://forum.juce.com/t/aax-pull-request-force-protools-to-do-chunk-calls-in-message-thread-option/40175/11 "2021-01-04T09:17:04Z")

</div>

new year bump

---

<div class="post-metadata">

### Author: ![otristan](https://avatars.discourse-cdn.com/v4/letter/o/f0a364/32.png) [@otristan](https://forum.juce.com/u/otristan)
#### Post date: [January 28, 2021, 1:53pm UTC](https://forum.juce.com/t/aax-pull-request-force-protools-to-do-chunk-calls-in-message-thread-option/40175/12 "2021-01-28T13:53:44Z")

</div>

Could be useful for legacy plugin when migrated to Juce and/or wrapped plugin

Thanks !

---

<div class="post-metadata">

### Author: ![bastienc](https://avatars.discourse-cdn.com/v4/letter/b/edb3f5/32.png) [@bastienc](https://forum.juce.com/u/bastienc)
#### Post date: [February 8, 2021, 3:11pm UTC](https://forum.juce.com/t/aax-pull-request-force-protools-to-do-chunk-calls-in-message-thread-option/40175/13 "2021-02-08T15:11:48Z")

</div>

Please let us know the reason if you do not intent to merge this pull request. Thanks

---

<div class="post-metadata">

### Author: ![pflugshaupt](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/pflugshaupt/32/13206_2.png) [@pflugshaupt](https://forum.juce.com/u/pflugshaupt)
#### Post date: [February 8, 2021, 3:24pm UTC](https://forum.juce.com/t/aax-pull-request-force-protools-to-do-chunk-calls-in-message-thread-option/40175/14 "2021-02-08T15:24:49Z")

</div>

Let me join the bumpety bumpy bump train.

---

<div class="post-metadata">

### Author: ![reuk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/reuk/32/21494_2.png) [@reuk](https://forum.juce.com/u/reuk)
#### Post date: [February 9, 2021, 11:53am UTC](https://forum.juce.com/t/aax-pull-request-force-protools-to-do-chunk-calls-in-message-thread-option/40175/15 "2021-02-09T11:53:51Z")

</div>

I’m not convinced it’s a good idea to add this feature. The docs for this feature flag say that it is supported “for now”, which implies that this might change in the future. Also, other plugin formats do not make guarantees about which threads may call the get/set state functions. A plugin that requires this feature will likely be broken when exported as an AU/VST3/etc, even if the issue is masked in the AAX version of the plugin. Ensuring your state functions are threadsafe will ensure that your plugin will work, even if the `AAX_eProperty_RequiresChunkCallsOnMainThread` feature is removed, or the plugin is exported in other formats.

---

<div class="post-metadata">

### Author: ![otristan](https://avatars.discourse-cdn.com/v4/letter/o/f0a364/32.png) [@otristan](https://forum.juce.com/u/otristan)
#### Post date: [February 9, 2021, 1:14pm UTC](https://forum.juce.com/t/aax-pull-request-force-protools-to-do-chunk-calls-in-message-thread-option/40175/16 "2021-02-09T13:14:14Z")

</div>

Besides AUv3, I don’t know any other format calling get/set chunk in non message thread.

---

<div class="post-metadata">

### Author: ![jellebakker](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/jellebakker/32/17053_2.png) [@jellebakker](https://forum.juce.com/u/jellebakker)
#### Post date: [February 9, 2021, 1:55pm UTC](https://forum.juce.com/t/aax-pull-request-force-protools-to-do-chunk-calls-in-message-thread-option/40175/17 "2021-02-09T13:55:19Z")

</div>

Now I wonder what the best practice is for dealing with this.  
If I use the AudioProcessorValueTreeState, as recommended, can I interact with this underlying state, a ValueTree, from get/set State or do I need to lock the state?  
If so… there is no such thing as a ValueTreeLock, so perhaps locking the message thread is the solution?

---

<div class="post-metadata">

### Author: ![chkn](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/chkn/32/3862_2.png) [@chkn](https://forum.juce.com/u/chkn)
#### Post date: [February 9, 2021, 4:11pm UTC](https://forum.juce.com/t/aax-pull-request-force-protools-to-do-chunk-calls-in-message-thread-option/40175/18 "2021-02-09T16:11:09Z")

</div>

I would not lock the message thread as a plugin, because as a plugin you are not fully aware what the host or other plugins do with the message thread, which will might easily cause a deadlock.

> If so… there is no such thing as a ValueTreeLock, so perhaps locking the message thread is the solution?

I guess this is a weakness of the current APVTS implementation, there is a valueTreeChanging-CriticalSection, but its private, while the current valueTree is public and “You can replace this with your own ValueTree object” says the documentation, so if you deal with it from the messageThread you might get problems if another thread replaces the tree.

In this thread i discussed a similar problem.

> [@Very specific question about ValueTree thread safety](https://forum.juce.com/t/very-specific-question-about-valuetree-thread-safety/42245/11):
>
> I don’t use APVTS, but from what regarding @reuk says, it has the same basic problem, when manipulating the ValueTree directly from messageThread. So I guess deferring setState for these properties to the message thread is a possible solution. But copyState() has the same problem when not called from the messageThread. But getStateInformation requires immediately a result, and no asynchrony mechanism can be used. I choose a different approach where the access to the underlying ValueTree Structu…

---

<div class="post-metadata">

### Author: ![otristan](https://avatars.discourse-cdn.com/v4/letter/o/f0a364/32.png) [@otristan](https://forum.juce.com/u/otristan)
#### Post date: [March 8, 2021, 2:19pm UTC](https://forum.juce.com/t/aax-pull-request-force-protools-to-do-chunk-calls-in-message-thread-option/40175/19 "2021-03-08T14:19:19Z")

</div>

For what it worth while you can call on message thread and block in get chunk like waitForExecutionOnMainThread done in AUv3.  
In Set chunk waiting for the message thread to process the block will spin, so you need to use MessageManager::callAsync but don’t wait for completion.

---

<div class="post-metadata">

### Author: ![eyalamir](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/eyalamir/32/2978_2.png) [@eyalamir](https://forum.juce.com/u/eyalamir)
#### Post date: [April 29, 2025, 4:26pm UTC](https://forum.juce.com/t/aax-pull-request-force-protools-to-do-chunk-calls-in-message-thread-option/40175/20 "2025-04-29T16:26:17Z")

</div>

Bump, are there any plans to get this implemented?

---

<div class="post-metadata">

### Author: ![railjonrogut](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/railjonrogut/32/505_2.png) [@railjonrogut](https://forum.juce.com/u/railjonrogut)
#### Post date: [April 29, 2025, 7:54pm UTC](https://forum.juce.com/t/aax-pull-request-force-protools-to-do-chunk-calls-in-message-thread-option/40175/21 "2025-04-29T19:54:37Z")

</div>

My contact at Avid doubts it’ll ever be removed if that helps (since some plugins rely on it).

Rail
