HELP Cannot initialize object parameter of type 'juce::AudioProcessor' with an expression of type 'BinauralPanner_mscAudioProcessor'

Hi I’m having problems with parameters. My IDEs (CLion or XCode) keep throwing up the error

Cannot initialize object parameter of type ‘juce::AudioProcessor’ with an expression of type ‘BinauralPanner_mscAudioProcessor’

when i try and add a parameter to my Processor constructor. Does anyone know what i might be missing?


#ifndef JucePlugin_PreferredChannelConfigurations
 : AudioProcessor (BusesProperties()
                 #if ! JucePlugin_IsMidiEffect
                  #if ! JucePlugin_IsSynth
                   .withInput  ("Input",  AudioChannelSet::stereo(), true)
                   .withOutput ("Output", AudioChannelSet::stereo(), true)

addParameter(ISEnable = new AudioParameterBool ("ISEnable","ImageSourceEnable",true,"image source enable"));
addParameter(FVEnable = new AudioParameterBool("FVEnable","AmbiFreeverbEnable",true,"freeverb enable"));
addParameter(numReflections = new AudioParameterInt("numRefs","numReflections",0,15,0,"num reflects"));
addParameter(Array = new AudioParameterChoice("Decode Array","decode array",decodes,0));

addParameter(Ang = new AudioParameterFloat("Angle","Angle",0,360,0));
addParameter(Elev = new AudioParameterFloat("Elev","Elev",-90,90,0));
addParameter(roomsize = new AudioParameterFloat("RoomSize","RoomSize",0,1,0.5));
addParameter(Damp = new AudioParameterFloat("Damp","Damp",0,1,0.5));
addParameter(Scatter = new AudioParameterFloat("Scatter","Scatter",0,1,0.5));
addParameter(Distance = new AudioParameterFloat("Distance","Distance",0,1,0));  

In Header

StringArray decodes;
AudioParameterBool* ISEnable;
AudioParameterBool* FVEnable;
AudioParameterInt* numReflections;
AudioParameterChoice* Array;

AudioParameterFloat* Ang;
AudioParameterFloat* Elev;
AudioParameterFloat* roomsize;
AudioParameterFloat* Damp;
AudioParameterFloat* Scatter;
AudioParameterFloat* Distance;

Thanks for any insight you can give

I guess that the variable named Array is a problem, since a type Array already exists in juce.
If you stick to current practice in C++ to use lower case variable names, these kind of collisions are less likely.

The forum even prints it in bold in the addParameter line :wink:

ok thanks, I’ve changed it but the original problem is still there

Ok, can you post the exact line where the error is occuring?
Could be that your BinauralPanner_mscAudioProcessor is not inheriting AudioProcessor, or you accidently inherited without public visibility.

class BinauralPanner_mscAudioProcessor : AudioProcessor
// should be
class BinauralPanner_mscAudioProcessor : public AudioProcessor

Anyway, without the location of the error it’s guessing

Its each of the addParameter lines in the constructor

The inheritance in the header file is set to public

Ok, I am not 100% certain without seeing the full file, but it seems when compiling that cpp file the compiler doesn’t know that BinauralPanner_mscAudioProcessor is derrived from AudioProcessor.

Maybe you are missing the include of your BinauralPanner_mscAudioProcessor?

Or there is another error in your header that prevents the BinauralPanner_mscAudioProcessor being recognised as a type at all?

It seems to be some kind of follow up error, that could be as simple as dropping a ; in an unlucky place.

Thanks so much for your help. Heres the processor files if you can look and find anything

I am sorry, I don’t see anything obvious. The only thing is, you are using some approaches, that are actually no longer state of the art.
Which version of JUCE are you using?
If you are using the juce6 branch, you need to prefix every juce class with juce::, e.g. juce::AudioProcessor and juce::AudioParameterFloat

But apart from that I am out of ideas, maybe somebody else did spot something and can chime in…

Good luck

ok thanks for your help