Little mistake

dsp_module

#1

Hey community,

I write my first audio plugin, but when you insert the dsp filter an error message has appeared. Does anyone see the mistake or does someone have a solution ?

here the code stip:

#ifndef JucePlugin_PreferredChannelConfigurations
	: AudioProcessor(BusesProperties()
#if ! JucePlugin_IsMidiEffect
#if ! JucePlugin_IsSynth
		.withInput("Input", AudioChannelSet::stereo(), true)
#endif
		.withOutput("Output", AudioChannelSet::stereo(), true)
#endif
	), tree//(*this, nullptr)					//Ab den Komma -> AllPassFilter
#endif
{

	//===============================AllPassFilter===============================================
		NormalisableRange<float> cutoffRange (20.0f, 20000.0f);
		NormalisableRange<float> resRange (1.0f, 5.0f);
		NormalisableRange<float> filterMenuRange (0, 2);

		tree.createAndAddParameter("cutoff", "Cutoff", "cutoff", cutoffRange, 600.0f, nullptr, nullptr);
		tree.createAndAddParameter("resonance", "Resonance", "resonance", resRange, 1.0f, nullptr, nullptr);

		tree.createAndAddParameter("filterMenu", "FilterMenu", "filterMenu", filterMenuRange, 0, nullptr, nullptr);


//===========================================================================================


	//===============================Distortion===============================================
		state = new AudioProcessorValueTreeState(*this, nullptr);

		tree.createAndAddParameter("drive", "Drive", "Drive", NormalisableRange<float>(0.f, 1.f, 0.01), 1.0, nullptr, nullptr);
		tree.createAndAddParameter("range", "Range", "Range", NormalisableRange<float>(0.f, 3000.f, 0.01), 1.0, nullptr, nullptr);
		tree.createAndAddParameter("blend", "Blend", "Blend", NormalisableRange<float>(0.f, 1.f, 0.01), 1.0, nullptr, nullptr);
		

		tree.state = ValueTree("drive");
		tree.state = ValueTree("range");
		tree.state = ValueTree("blend");

}```

I hope for answers :slightly_smiling_face:

#2

Do you mind telling what the error message was? :wink:

Also to format your code, please add three back ticks ``` on a single line before and after your code block…

(alternatively indent with 4 spaces, that’s why some of your code appears formatted and some not)


#3

The error massage:

There is no default constructor for class “juce :: AudioProcessorValuetreeState”


#4

So yes, the default constructor would be called, when no arguments are supplied. But the AudioProcessorValueTreeState cannot be constructed without arguments.

Also it seems to me, you got confused when you added it twice, there is

AudioProcessorValueTreeState tree;
AudioProcessorValueTreeState* state;

This can’t work. Either is fine (in the latter be advised to use ScopedPointer or unique_ptr though), but you cannot have them both.

If you keep the tree, you have to put back in that commented bracket holding the arguments, that are needed to construct the instance.

Hope that helps

EDIT: have a look into your header file, how tree and state are defined. Get rid of one of these, and construct the other one with the needed arguments.