# Externally notifying AudioProcessorValueTreeState of a parameter change

**URL:** <https://forum.juce.com/t/externally-notifying-audioprocessorvaluetreestate-of-a-parameter-change/50799>\
**Category:** General JUCE discussion\
**Created:** [March 30, 2022, 3:48am UTC](https://forum.juce.com/t/externally-notifying-audioprocessorvaluetreestate-of-a-parameter-change/50799 "2022-03-30T03:48:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![officialnsa](https://avatars.discourse-cdn.com/v4/letter/o/ecb155/32.png) [@officialnsa](https://forum.juce.com/u/officialnsa)\
**Post date:** [March 30, 2022, 3:48am UTC](https://forum.juce.com/t/externally-notifying-audioprocessorvaluetreestate-of-a-parameter-change/50799/1 "2022-03-30T03:48:16Z")

</div>

Hi there!

I’m working on a plugin whose core algorithm is mainly implemented in C, and I’ve run into an issue when the C code changes a value in the algorithm, thereby bypassing my AudioProcessorValueTreeState which results in no GUI update. This is because the C algorithm doesn’t read the JUCE values directly, instead JUCE is responsible for keeping the items in the C code updated.

I’m wondering if there’s any functionality that would allow me to notify the ValueTreeState object directly when a value has changed? I’ve been digging through the source code to try and find out how I’d do this, but it seems like most of that functionality is private. I’m not really sure how to go about this without some kind of circular dependance, because the ValueTreeState also updates the C parameters whenever it detects an update.

Ideally, I’m looking to create a method to modify a value in an AudioProcessorValueTreeState, have the ValueTreeState update its Attachments/Listeners but ignore one specific Listener. I know this is a silly ask, but given my predicament with the C code I’m curious about what the best way to go about it would be. I’m happy to expound on the specifics of my code, but at current I feel like it’d only complicate my question.

Thank you!

**\*EDIT\*** : Just after posting this I realized that the internal ValueTree of an AudioProcessorValueTreeState is a public member. Would ValueTree::setPropertyExcludingListener() be the proper way to go about this?

---

<div class="post-metadata">

**Author:** ![t0m](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/t0m/32/16413_2.png) [@t0m](https://forum.juce.com/u/t0m)\
**Post date:** [March 31, 2022, 9:03am UTC](https://forum.juce.com/t/externally-notifying-audioprocessorvaluetreestate-of-a-parameter-change/50799/2 "2022-03-31T09:03:51Z")

</div>

> I’m looking to create a method to modify a value in an AudioProcessorValueTreeState, have the ValueTreeState update its Attachments/Listeners but ignore one specific Listener

> Would ValueTree::setPropertyExcludingListener() be the proper way to go about this?

From how you’ve described the problem, yes.

---

<div class="post-metadata">

**Author:** ![officialnsa](https://avatars.discourse-cdn.com/v4/letter/o/ecb155/32.png) [@officialnsa](https://forum.juce.com/u/officialnsa)\
**Post date:** [April 4, 2022, 1:09am UTC](https://forum.juce.com/t/externally-notifying-audioprocessorvaluetreestate-of-a-parameter-change/50799/3 "2022-04-04T01:09:31Z")

</div>

Thank you! I do have one question though—from what I can tell, it’s the job of the AudioProcessorValueTreeState::ParameterAdapter private subclass to notify SliderAttachments. Wouldn’t that mean that ValueTree::setPropertyExcludingListener() wouldn’t apply to the SliderAttachments? From what I can discern, the only listener of the internal ValueTree is the AudioProcessorValueTreeState, but I could easily be misinterpreting the source.

---

<div class="post-metadata">

**Author:** ![t0m](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/t0m/32/16413_2.png) [@t0m](https://forum.juce.com/u/t0m)\
**Post date:** [April 4, 2022, 8:49am UTC](https://forum.juce.com/t/externally-notifying-audioprocessorvaluetreestate-of-a-parameter-change/50799/4 "2022-04-04T08:49:35Z")

</div>

`AudioProcessorValueTreeState` is a listener of the `ValueTree` and updates the attachments in response to changes in the `ValueTree`.

> I’m not really sure how to go about this without some kind of circular dependance, because the ValueTreeState also updates the C parameters whenever it detects an update.

Rather than trying to exclude listeners can you instead call `setValueNotifyingHost` on the corresponding parameter, but only when the value has actually changed?
