# Breaking change AudioProcessorValueTreeState::getRawParameterValue now returns a std::atomic\<float\>\* instead of a float\*

**URL:** <https://forum.juce.com/t/breaking-change-audioprocessorvaluetreestate-getrawparametervalue-now-returns-a-std-atomic-float-instead-of-a-float/38492>\
**Category:** Development\
**Created:** [April 5, 2020, 10:10pm UTC](https://forum.juce.com/t/breaking-change-audioprocessorvaluetreestate-getrawparametervalue-now-returns-a-std-atomic-float-instead-of-a-float/38492 "2020-04-05T22:10:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![vastdynamics](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/vastdynamics/32/4254_2.png) [@vastdynamics](https://forum.juce.com/u/vastdynamics)\
**Post date:** [April 5, 2020, 10:10pm UTC](https://forum.juce.com/t/breaking-change-audioprocessorvaluetreestate-getrawparametervalue-now-returns-a-std-atomic-float-instead-of-a-float/38492/1 "2020-04-05T22:10:36Z")

</div>

Hello all,

I just came across the breaking change in Version 5.4.6 that getRawParameterValue now returns a std::atomic\* instead of a float\*.  
With good hopes I tried to adopt that change in my plugin. But after several hours I found that this bascially changes larger parts of my code, probably with unexpected side-effects all over the place. Am I the only one with this trouble caused by that change?

Best regards, Tobias 😪

# Version 5.4.6

## Change

AudioProcessorValueTreeState::getRawParameterValue now returns a  
std::atomic\* instead of a float\*.

## Possible Issues

Existing code which explicitly mentions the type of the returned value, or  
interacts with the dereferenced float in ways unsupported by the std::atomic  
wrapper, will fail to compile. Certain evaluation-reordering compiler  
optimisations may no longer be possible.

## Workaround

Update your code to deal with a std::atomic\* instead of a float\*.

## Rationale

Returning a std::atomic\* allows the JUCE framework to have much stronger  
guarantees about thread safety.

---

<div class="post-metadata">

**Author:** ![vastdynamics](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/vastdynamics/32/4254_2.png) [@vastdynamics](https://forum.juce.com/u/vastdynamics)\
**Post date:** [April 6, 2020, 7:39am UTC](https://forum.juce.com/t/breaking-change-audioprocessorvaluetreestate-getrawparametervalue-now-returns-a-std-atomic-float-instead-of-a-float/38492/2 "2020-04-06T07:39:58Z")

</div>

Never mind. I found a solution. All good.

---

<div class="post-metadata">

**Author:** ![jnicol](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/jnicol/32/1532_2.png) [@jnicol](https://forum.juce.com/u/jnicol)\
**Post date:** [April 6, 2020, 8:51pm UTC](https://forum.juce.com/t/breaking-change-audioprocessorvaluetreestate-getrawparametervalue-now-returns-a-std-atomic-float-instead-of-a-float/38492/3 "2020-04-06T20:51:58Z")

</div>

I am updating a pre-5.4.6 project, and this one bit me too.

For instance `Decibels::decibelsToGain(*myRawParam)` won’t work anymore.

My solution was to cast to a float, but I’m curious to know of other approaches.

```
Decibels::decibelsToGain((float)*myRawParam)
```

---

<div class="post-metadata">

**Author:** ![daniel](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/daniel/32/790_2.png) [@daniel](https://forum.juce.com/u/daniel)\
**Post date:** [April 6, 2020, 9:55pm UTC](https://forum.juce.com/t/breaking-change-audioprocessorvaluetreestate-getrawparametervalue-now-returns-a-std-atomic-float-instead-of-a-float/38492/4 "2020-04-06T21:55:36Z")

</div>

You can simply call load(), which will return the wrapped type:

```auto
auto gain = Decibels::decibelsToGain (myRawParam->load());

```

---

<div class="post-metadata">

**Author:** ![jnicol](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/jnicol/32/1532_2.png) [@jnicol](https://forum.juce.com/u/jnicol)\
**Post date:** [April 6, 2020, 10:21pm UTC](https://forum.juce.com/t/breaking-change-audioprocessorvaluetreestate-getrawparametervalue-now-returns-a-std-atomic-float-instead-of-a-float/38492/5 "2020-04-06T22:21:11Z")

</div>

I had actually tried `load()`, and it got my past the first type mismatch error thrown by the Decibels class, but another error was thrown further along (can’t remember exactly what). Probably an error on my part!

Edit: Tried again, works fine. So yep, operator error! 😆
