Hello, I’ve been working on the last exercise for the JUCE Midi Synthesizer Tutorial which entails adding sliders to control the TailOn and TailOff parameters. However I’m not sure how to go about accessing variables from SineWaveVoice from my MainComponentClass.
I tried having my sliders send midi CC messages via the SynthAudioSource’s midiCollector, and then using controllerMoved, but controllerMoved is only called when I press down on a key, which doesn’t make sense.
Looking at the SamplerSynth class in the documentation shows that it has the ADSR parameters in the SamplerSound class as opposed to the SamplerVoice, but then how would I access it from my MainComponent AND my SynthVoice?
void controllerMoved (int controllerNumber, int newControllerValue) override
{
DBG("CC: " << controllerNumber << "VAL: " << newControllerValue);
if (controllerNumber == 66)
{
//attackSlider.setRange(0.001, 0.9999);
float oldRange = (127.0 - 1.0);
float newRange = (0.9999 - 0.001);
float newValue = (((newControllerValue - 1.0) * newRange) / oldRange) + 0.001;
attackParam = newValue;
}
if (controllerNumber == 67)
{
//decaySlider.setRange(0.001, 0.9999);
float oldRange = (127.0 - 1.0);
float newRange = (0.9999 - 0.001);
float newValue = (((newControllerValue - 1.0) * newRange) / oldRange) + 0.001;
decayParam = newValue;
}
}
