thanks so much for making this video Josh!! I bugged Josh about this issue a couple times on Discord and Twitter and the fact that he made this video about such a specific issue really means a lot!!
Very cool to see my gain slider moving all by itself - well - inline with automation - but it's cool nonetheless. During this tutorial I've also been getting to grips with Juce 6 and have spotted a couple of "gotchas" that I thought might be cool to share: In the set up of the treestate AudioParameterFloat pointer, you can still use Normalisable range: treeState(*this, nullptr, "PARAMETER", { std::make_unique(GAIN_ID, GAIN_NAME, juce::NormalisableRange(-48.0f, 0.0f), -15.0f) }) In the processBlock() sample loop you need to define the decibels to gain type: for (int sample = 0; sample < buffer.getNumSamples(); ++sample) { channelData[sample] = buffer.getSample(channel, sample) * juce::Decibels::decibelsToGain(*sliderGainValue); } That said you can use built in functionality to apply gain to all channels, and do away with the channel and sample loop for this particular plugin in it's current state. This is very much a programming paradigm of doing what is required, not what we think it will require, thus saving on the processing cost. To do this - ditch both the channel loop and it's embedded sample loop and use the following code: auto sliderGainValue = treeState.getRawParameterValue(GAIN_ID); buffer.applyGain(juce::Decibels::decibelsToGain(*sliderGainValue)); My code for this tutorial is available on github: github.com/StuLast/juce-gain-slider-demo/tree/master/Source
So, the value tree replaces the slider listener we were using before? To answer my own question: yes it does but I need to investigate it further. Also, make sure you clean up any inheritance stuff from using a slider listener or it will break your build.
@@TheAudioProgrammer And it looks like there is no need for the float rawGainValue variable, correct? You use the parameter value directly instead? In other words, treestate.getRawParamterValue(GAIN_ID) takes the place of rawGainValue which used to be tied to the slider through the Slider::Listener.
Thanks for your tutorial! It helped A LOT!!! Btw I found the number length can't be set by gainSlider.setRange(-12, 12, 0.1), is there anyway to achieve this?
Great tutorials! I am having an issue compiling the GitHub code though - something to do with Decibels::decibelsToGain(*sliderGainValue); - "Call to implicitly-deleted copy constructor of 'std::__1::atomic'"
When you say: auto sliderGainValue = apvts.getRawParameterValue ("GAIN"); for this example, you mean: auto sliderGainValue = apvts.getRawParameterValue (GAIN_ID); ?? this solves the issue i think
@@azsumusic leave the sliderGainValue variable the way it is in the tutorial but change the decibels to gain argument Decibels::decibelsToGain (sliderGainValue->load());
And I'm little bit confused by the quick way to add automate-able parameters, on which part it does quicker? Does it automatically add all parameters to be automate-able if my plugin have 10 parameters?
I love you and your lecture!!! But Valuetree series(17,18,19,44) is too difficult for me. I am happy if you explain from scrach (Projucer). Project name changes (gainTutorial1(15,16)->gainTutorial3(44) or parameterTutorial1(16) or rowVolume changes gainVolume without explain...
thanks so much for making this video Josh!! I bugged Josh about this issue a couple times on Discord and Twitter and the fact that he made this video about such a specific issue really means a lot!!
Very cool to see my gain slider moving all by itself - well - inline with automation - but it's cool nonetheless. During this tutorial I've also been getting to grips with Juce 6 and have spotted a couple of "gotchas" that I thought might be cool to share:
In the set up of the treestate AudioParameterFloat pointer, you can still use Normalisable range:
treeState(*this, nullptr, "PARAMETER",
{
std::make_unique(GAIN_ID, GAIN_NAME, juce::NormalisableRange(-48.0f, 0.0f), -15.0f)
})
In the processBlock() sample loop you need to define the decibels to gain type:
for (int sample = 0; sample < buffer.getNumSamples(); ++sample)
{
channelData[sample] = buffer.getSample(channel, sample) * juce::Decibels::decibelsToGain(*sliderGainValue);
}
That said you can use built in functionality to apply gain to all channels, and do away with the channel and sample loop for this particular plugin in it's current state. This is very much a programming paradigm of doing what is required, not what we think it will require, thus saving on the processing cost. To do this - ditch both the channel loop and it's embedded sample loop and use the following code:
auto sliderGainValue = treeState.getRawParameterValue(GAIN_ID);
buffer.applyGain(juce::Decibels::decibelsToGain(*sliderGainValue));
My code for this tutorial is available on github:
github.com/StuLast/juce-gain-slider-demo/tree/master/Source
Thanks, It's good to use automation. is there any change in new Juce version ?
So, the value tree replaces the slider listener we were using before? To answer my own question: yes it does but I need to investigate it further. Also, make sure you clean up any inheritance stuff from using a slider listener or it will break your build.
@@TheAudioProgrammer And it looks like there is no need for the float rawGainValue variable, correct? You use the parameter value directly instead? In other words, treestate.getRawParamterValue(GAIN_ID) takes the place of rawGainValue which used to be tied to the slider through the Slider::Listener.
Thanks for your tutorial! It helped A LOT!!! Btw I found the number length can't be set by gainSlider.setRange(-12, 12, 0.1), is there anyway to achieve this?
What's the best way to utilise the get and set state information with the valuetree class?
Great tutorials! I am having an issue compiling the GitHub code though - something to do with Decibels::decibelsToGain(*sliderGainValue); - "Call to implicitly-deleted copy constructor of 'std::__1::atomic'"
UPDATE: and if I change it to:
(sliderValue->load());
when I load the plugin, Ableton crashes
When you say: auto sliderGainValue = apvts.getRawParameterValue ("GAIN");
for this example, you mean:
auto sliderGainValue = apvts.getRawParameterValue (GAIN_ID);
?? this solves the issue i think
@@alphestael4240 how i can resolve this problem?
@@azsumusic leave the sliderGainValue variable the way it is in the tutorial but change the decibels to gain argument Decibels::decibelsToGain (sliderGainValue->load());
THANK YOU VERY MUCH, SIR!
@@TheAudioProgrammer These are some great tutorials man! Any chance you are planning on doing a tutorial on Compressors ?
And I'm little bit confused by the quick way to add automate-able parameters, on which part it does quicker? Does it automatically add all parameters to be automate-able if my plugin have 10 parameters?
I love you and your lecture!!!
But Valuetree series(17,18,19,44) is too difficult for me.
I am happy if you explain from scrach (Projucer).
Project name changes (gainTutorial1(15,16)->gainTutorial3(44) or parameterTutorial1(16) or rowVolume changes gainVolume without explain...
@@TheAudioProgrammer Thanks! I join the group!!!
My big takeaway is that JUCE team has simplified the work needed to create parameter-enabled object by making a more useful constructor for TreeState?