This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
overview [2017/08/30 16:18] shane [The SynthSound object and class juce::SynthesiserSound] |
overview [2017/08/30 16:43] (current) shane [The SynthSound object and class juce::SynthesiserSound] |
||
---|---|---|---|
Line 12: | Line 12: | ||
The processor needs to be able to notify the GUI editor when it changes one or more synth parameters (e.g. when a new preset is selected), so it can update the GUI display. This can be done in any number of ways, but I chose to have the // | The processor needs to be able to notify the GUI editor when it changes one or more synth parameters (e.g. when a new preset is selected), so it can update the GUI display. This can be done in any number of ways, but I chose to have the // | ||
+ | |||
+ | To understand how parameter changes are propagated in the reverse direction---from GUI to synthesizer---we need the following overview some of the objects which make up the DSP aspect of VanillaJuce. | ||
===== The " | ===== The " | ||
Line 112: | Line 114: | ||
void parameterChanged(); | void parameterChanged(); | ||
}; | }; | ||
+ | </ | ||
+ | Member variable //synth// object is a reference to the //Synth// object (which never changes). | ||
+ | //pParams// is a pointer to the currently-selected preset. I've made //pParams// public so the // | ||
+ | All the //Gui...// class constructors take a // | ||
+ | <code cpp> | ||
+ | void SynthSound:: | ||
+ | { | ||
+ | synth.soundParameterChanged(); | ||
+ | } | ||
+ | </ | ||
+ | // | ||
+ | <code cpp> | ||
+ | void Synth:: | ||
+ | { | ||
+ | // Some sound parameter has been changed. Notify all active voices. | ||
+ | const ScopedLock sl(lock); | ||
+ | |||
+ | for (int i = 0; i < voices.size(); | ||
+ | { | ||
+ | SynthVoice* const voice = dynamic_cast< | ||
+ | if (voice-> | ||
+ | voice-> | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | The code for // | ||