I think this might be due to my insufficient knowledge in DSP, but I’ve built a simple oscillator (with sine, saw, or square waves) and I successfully added an adjustable gain parameter using the AudioProcessorValueTreeState. I define the state as follows in my constructor:
, state (*this, nullptr, "STATE", {
std::make_unique<juce::AudioParameterFloat> (juce::ParameterID("gainAdj", 1), "Gain", 0.0f, 1.0f, 0.5f) ,
std::make_unique<juce::AudioParameterFloat> (juce::ParameterID("freqAdj", 1) , "Frequency", 30.0f, 4000.0f, 220.0f)
})
and then in processBlock i perform the following:
osc.setFrequency(state.getParameter ("freqAdj")->getValue());
osc.process(juce::dsp::ProcessContextReplacing<float>(audioBlock));
I do this same thing with my gain and it works just fine, but how come it doesn’t work when I try it with frequency? I am building a simple stand alone plugin with juce’s generic layout to handle the UI of the parameters. To give more information, all I hear when running the program is a low frequency click when first built, and then when I adjust the gain slider I’ll also hear clicks. Note that the build is successful. Thanks.
