Using getName on parameter

Hi, I want to grab the display name of a parameter:
I’m doing this

	AudioProcessorParameterWithID* par = paraTree.getParameter(nameID);
	jassert(par != nullptr);
	return par->name;

Which is fine. But I can’t use ‘getName’ because it’s marked as private!
Which is a bit odd to be honest. Anyone know why?

1 Like

I wondered the same thing. Seems backwards for the member to be accessible but its getter is private. I usually do it the other way around.

Bump. Can someone tell me why this isn’t dumb?

Edit: because processor.getParameterName(id) exists, apparently. Derp.

1 Like

Just ran up against this myself.

And AudioProcessor::getParameterName(id) is now deprecated.

So, could any JUCE admins explain why getName is private?

Assuming you’re talking about AudioProcessorParameter::getName() then It isn’t private!

Following @DaveH’s example from above, I was talking about AudioProcessorParameterWithID.

Although, when I had written up something similar, I had used auto, like so:
auto param = paraTree.getParameter("devFloat1");

Which I believe returns the parameter as a RangedAudioParameter. getName is still private in that case.

So then, following up on your post, I tried this:

AudioProcessorParameter* param = paraTree.getParameter("devFloat1");

And now getName is at last accessible.

Looks like it’s over-riden as private in AudioProcessorParameterWithID

1 Like

Ah… hmm, it’s odd that the subclass is overriding it like that - looks like a mistake to me. We’ll have to have a look, thanks! (But yes, just casting it to the base class is a quick fix)

Haven’t updated to JUCE 5.4.5 yet, but looks like those 3 getter methods have now been moved to north of the private line in AudioProcessorParameterWithID.

1 Like