addParameter (....... not working


#1

Hi,

I made an Audio Plugin from the Introjucer then added a few lines to add one slider and an AudioProcessorParameter called delay.  

The strange thing is that when I add use addParameter in the constructor nothing is added.  Clearly the Juce Demo Plugin is doing something extra that allows adding parameters.  Perhaps I am not overiding a required method in Audio Processor?  I have shared the source (link at bottom) for the project if anybody can help me and tell me why addParameter fails, it would be great.

https://drive.google.com/file/d/0B3-JRETAp68mZTJkak9NOW5wQ0E/view?usp=sharing

K

 

 


#2

I could be wrong, but I thing getNumParameters() is supposed to be hard coded. Maybe to be used by the host or somewhere else in your program. If you look at the documentation, it says that function will be deprecated and to use AudioProcessorParameter to handle parameters. So I don't think that addParameter() isn't working. You should try to actually use it and see if it's working. 

By the way, what text editor/ IS A are you using here? It has a nice look to it. 


#3

Hi jordan

 

thanks for the answer but same logs in Juce demo show one member added to the array

 

also, I did try the control and an assertion fails due to managed parameters being empty, because addParameter doesn't work :-( 


#4

Xcode :-)


#5

Delete the getNumParameters implementation in your class! This  overrides the original implementation. (Btw  there should be mechanism that people should be warned when overriding this classes when using the new style parameter class)

 


#6

Thanks chkn 

I'll try later when I am at my machine but I doubt that will affect whether or not addParameter adds the Param to the managed array (which is empty) but I will try

 

cheers 

 


#7

If you do need the number of parameters, you could try using getParameters().size(). That seems like it would work for that. That'll also let you know if it's empty or not. I'll have to try addParameter() with the latest build in the morning to see if it works for me. 


#8

Thanks chkn

That worked.

 


#9

Following chkn's idea of a warning if overriding the original implementation, this can be done with a simple assertion (Jules?):

void AudioProcessor::addParameter (AudioProcessorParameter* p)
{
    p->processor = this;
    p->parameterIndex = managedParameters.size();
    managedParameters.add (p);
    
    jassert(getNumParameters() == AudioProcessor::getNumParameters()); // if asserting, that could be that the derivate class does reimplement that getNumParameters() function, which is deprecated.
}


#10

Good idea! Thanks will add something like that!


#11

Hi..how you managed to log via stadi::cout? I Was not able to get any log into xcode debugger... Must I activate some log or debug flag first?


#12

use DBG("kjhkj");