# Cannot initialize a parameter of type 'double' with an lvalue of type 'float \*'

**URL:** <https://forum.juce.com/t/cannot-initialize-a-parameter-of-type-double-with-an-lvalue-of-type-float/35487>\
**Category:** Audio Plugins\
**Created:** [September 30, 2019, 9:11pm UTC](https://forum.juce.com/t/cannot-initialize-a-parameter-of-type-double-with-an-lvalue-of-type-float/35487 "2019-09-30T21:11:28Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [September 30, 2019, 9:27pm UTC](https://forum.juce.com/t/cannot-initialize-a-parameter-of-type-double-with-an-lvalue-of-type-float/35487/2 "2019-09-30T21:27:59Z")

</div>

Ah right, sorry for not answering in the previous thread…

If you add a member to a class, it needs to be constructed. But AudioProcessorValueTreeState has no default constructor (that’s what it says). A default constructor is one without arguments. The AudioProcessorValueTreeState is one of the classes, that can’t work without some arguments, so you must supply them. There are two ways:

a) default arguments in the declaration:

```auto
class EqAudioProcessor : public AudioProcessor
{
// ...
    AudioProcessorValueTreeState tree { *this, nullptr, "PARAMETERS", {} };
// ...

```

This means in the last {} you have to initialise a ParameterLayout() instance. A more common approach is to do that in the cpp file

b) calling the members constructors in a list

```auto
EqAudioProcessor::EqAudioProcessor() 
    : AudioProcessor (BusesProperties() // calls the base class constructor with a BusesProperties as agrument
                     #if ! JucePlugin_IsMidiEffect
                      #if ! JucePlugin_IsSynth
                       .withInput ("Input", AudioChannelSet::stereo(), true)
                      #endif
                       .withOutput ("Output", AudioChannelSet::stereo(), true)
                     #endif
                       ),
       tree (*this, nullptr, "PARAMETERS", {}) // call the tree member's constructor
{
    // constructor's body
}

```

Again, instead of the last {} put anything, that returns a ParameterLayout()…

In this thread you find several good examples, how to create a ParameterLayout:

> [@AudioProcessorValueTreeState Improvements](https://forum.juce.com/t/audioprocessorvaluetreestate-improvements/29872):
>
> Hello JUCErs We’ve made some changes to the AudioProcessorValueTreeState class: The highlights are: It’s now possible to have an APVTS manage a wide range of different parameter types, including JUCE’s built-in AudioParameterBool, AudioParameterChoice, AudioParameterFloat and AudioParameterInt classes. You can avoid the cumbersome two-stage initialisation process, where you first add parameters and then assign the ValueTree state, with a new constructor that does both operations. To make …

Hope that helps

---

_[View the full topic](https://forum.juce.com/t/cannot-initialize-a-parameter-of-type-double-with-an-lvalue-of-type-float/35487)._
