JUCE Synthesiser and Sostenuto Pedal - Please add this


#1

If a player adds some notes under sostenuto pedal, then additionally uses the sustain pedal for some other notes and releases the sustain pedal, the notes under the sostenuto pedal shouldn’t be stopped.

@JUCE Team
Could you add here:

void Synthesiser::handleSustainPedal (int midiChannel, bool isDown)

this little if-addition:

if (! (voice->isKeyDown() || voice->sostenutoPedalDown))
                    stopVoice (voice, 1.0f, true);

instead of before:

if (! voice->isKeyDown())
                    stopVoice (voice, 1.0f, true);

Then it works like expected.


#2

Yep, sounds sensible, I’ll take a look at that. Thanks!


#3

One addition:
In

void Synthesiser::handleSostenutoPedal (int midiChannel, bool isDown)

it would avoid problems, if you’d only set sostenutoPedalDown = true for voices, whose key is down - e.g. some voices could already be in release or they haven’t been started on noteOn()

if (isDown) {
     if (voice->isKeyDown ())
         voice->sostenutoPedalDown = true;
     }
} 
else if...

I aske because once more

voice->sostenutoPedalDown

is a private member of voice and can’t be accessed from Synthesiser::

virtual void handleSostenutoPedal (int midiChannel, bool isDown) 

It would be handy to get another setter here (like the setKeyDown() you just added).
The same is true for

voice->sustainPedalDown

For the latter we would also need a setter for the private BigInteger Synthesiser::sustainPedalsDown…


#4

FYI I’ve added some setter methods for this. Should be on develop soon.

Not sure about providing access to the BigInteger though, that’s really intended as more of a mirror for the actual midi stream state.


#5

Thank you for this, too. I understand, that the BigInteger is an edge case. I would allow it nevertheless, because it’s not possible to get rid of Synthesiser::handleSustainPedal () - which contains a lock - without having access.


#6

No, I really don’t want to open up internals like that, it’s just not something that should be public. Can you think of any other ways to get the result you need?


#7

Yes, at the moment it’s ok for me to call Synthesiser::handleSustainPedal (int midiChannel, bool isDown) from my virtual one.