Hi there,
i’d like to know how to correctly override the Synthesizer::noteOff (which is virtual) in “MySynthesiser” inherited in which i use “MyVoice” inherited class. The fact that in the SynthesizerVoice class the parameter “keyIsDown” is a private bool it doesn’t let me use it from the inherited class “MyVoice”.
Here the noteOff code of Synthesizer :
void Synthesiser::noteOff (const int midiChannel,
const int midiNoteNumber,
const float velocity,
const bool allowTailOff)
{
const ScopedLock sl (lock);
for (int i = voices.size(); --i >= 0;)
{
SynthesiserVoice* const voice = voices.getUnchecked (i);
if (voice->getCurrentlyPlayingNote() == midiNoteNumber
&& voice->isPlayingChannel (midiChannel))
{
if (SynthesiserSound* const sound = voice->getCurrentlyPlayingSound())
{
if (sound->appliesToNote (midiNoteNumber)
&& sound->appliesToChannel (midiChannel))
{
jassert (! voice->keyIsDown || voice->sustainPedalDown == sustainPedalsDown [midiChannel]);
voice->keyIsDown = false;
if (! (voice->sustainPedalDown || voice->sostenutoPedalDown))
stopVoice (voice, velocity, allowTailOff);
}
}
}
}
}
Has someone encountered the same issue?
I add for information that “MySynthesizer” and “MyVoice” are in different files in order to get a better readability (as well as matching with cpp standard of getting a file per class)
Thank you for your help