# Why aren't the NormalisableRange conversions functions public?

**URL:** <https://forum.juce.com/t/why-arent-the-normalisablerange-conversions-functions-public/29973>\
**Category:** General JUCE discussion\
**Created:** [October 22, 2018, 1:07pm UTC](https://forum.juce.com/t/why-arent-the-normalisablerange-conversions-functions-public/29973 "2018-10-22T13:07:42Z")\
**Posts on this page:** 6\
**Page:** 1

<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:** [October 22, 2018, 1:07pm UTC](https://forum.juce.com/t/why-arent-the-normalisablerange-conversions-functions-public/29973/1 "2018-10-22T13:07:42Z")

</div>

Hi,

I need to convert a `NormalisableRange <float>` to a `NormalisableRange <double>`.  
I thought to just make a new `NormalisableRange <double>` object where I pass all variables from the float one to the new one with float to double conversions.  
Unfortunately, the lambda’s `convertFrom0To1Function`, `convertTo0To1Function` and `snapToLegalValueFunction` are not public, so I cannot get them from the float version.

If there is another solution, please let me know, but I prefer to have these functions public.

Thanks  
Jelle

---

<div class="post-metadata">

**Author:** ![Achder](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/achder/32/5897_2.png) [@Achder](https://forum.juce.com/u/Achder)\
**Post date:** [October 22, 2018, 2:13pm UTC](https://forum.juce.com/t/why-arent-the-normalisablerange-conversions-functions-public/29973/2 "2018-10-22T14:13:51Z")

</div>

I don’t think you can use the same lambdas. They have the wrong signature since they are using floats and not doubles as parameter and return types.

---

<div class="post-metadata">

**Author:** ![alassandro](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/alassandro/32/4297_2.png) [@alassandro](https://forum.juce.com/u/alassandro)\
**Post date:** [October 22, 2018, 4:41pm UTC](https://forum.juce.com/t/why-arent-the-normalisablerange-conversions-functions-public/29973/3 "2018-10-22T16:41:03Z")

</div>

Essentially what @Achder said, you’d have to set the conversion lambdas for the `double` by just wrapping calls to the original, `float` range. `SliderAttachment` does something like that… inversed, of course 🙂

> <https://github.com/WeAreROLI/JUCE/blob/master/modules/juce_audio_processors/utilities/juce_AudioProcessorValueTreeState.cpp#L464>

---

<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:** [October 22, 2018, 4:59pm UTC](https://forum.juce.com/t/why-arent-the-normalisablerange-conversions-functions-public/29973/4 "2018-10-22T16:59:34Z")

</div>

Thank you. I was indeed thinking about that the parameter system uses float while the slider uses doubles. There is no chance that the slider will use floats in the future?

---

<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:** [October 22, 2018, 6:34pm UTC](https://forum.juce.com/t/why-arent-the-normalisablerange-conversions-functions-public/29973/5 "2018-10-22T18:34:46Z")

</div>

I think it would rather be the opposite way, since floats are a subset of doubles. But the AudioParameters using float comes from the various plugin APIs. If that will change, we can only guess. On the other hand it makes sense to use float parameters, when the audio processing runs in float as well. Sure there is double precision processing…

---

<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:** [October 24, 2018, 1:22pm UTC](https://forum.juce.com/t/why-arent-the-normalisablerange-conversions-functions-public/29973/6 "2018-10-24T13:22:07Z")

</div>

Yes, I see. Double audio would then be better.  
Because, I also found out that the NormalisableRange loses the double functionality if it is constructed from the conversion system in AudioProcessorValueTreeState that [TonyAtHarrison](https://forum.juce.com/u/TonyAtHarrison) mentioned.  
For example, Slider::getValue() will sometimes return values like -0.0999994 because the NormalisableRange::snapToLegalValue is not so precise anymore.
