Multiple startNote calls in SynthesizerVoice?

Is there any reason why I would see multiple calls to startNote/stopNote when playing one key?

I added a voiceIndex to each of my SynthVoices to see what was playing and this is the console out when I played one note:

                               <--------- pressed key
voice: 6, startNote: 62
voice: 6, stopNote
voice: 7, startNote: 62
voice: 7, stopNote
voice: 6, stopNote
voice: 0, startNote: 62
                                <--------- released key
voice: 0, stopNote
voice: 7, stopNote 
voice: 6, stopNote

What would cause this?

My synth is barely modified from the Juce Demo Plugin, running in the Plugin Host.


Where's the midi coming from? Is your external keyboard maybe a bit jittery? We're not aware of anything broken in the synth class, so you might want to use a midi tool to look at the incoming midi data before assuming it's something weird that the synth is doing.

The MIDI is coming from the Plugin Host keyboard.

I stripped some stuff out and now it's still calling startNote() 3 times, but all the same voice instead of different voices.


I figured it out.

I was calling addSound() in Processor in my initSynth() method which was in the Processor's prepareToPlay() method. 

And for whatever reason,  prepareToPlay() was getting called 3 times during startup, and therefore, creating 3 sounds, which in Synthesizer::noteOn, loops through the number of sounds.

Hopefully that will help anyone else that gets snagged on that.

And Jules, having the souce for the framework definitely made it much easier to debug. Thank you.