Juce synthesiser legato mode and preset handling?



I'm looking into the possibility of porting my VSTi (VSTSDK 2.4 with VSTGUI) to JUCE. I'm new here and i've just began taking a closer look into the API. I really like what i've seen so far! Simply the fact that the introjucer and the example projects have all built without troubles is something that i've sort of forgot is even possible. I'm really looking forward into getting into JUCE but i already have a million questions in my head. Let me ask you a couple that bother me the most.

The synthesiser API looks very attractive, but the way you implement mono legato doesn't appear perfectly clear to me. I suppose i could manage to implement it with the use of findFreeVoice and adding some flags to the sound or voice object. I would like to know if there's a more elegant way to do this? Something that i've missed?

Does JUCE have some kind of scheme for preset handling? Does it make any assumptions about how user vs. factory presets are handled? Does it support preset handling in a cross platform manner?

Thanks for all help!



You can set a flag in

Synthesiser::noteOn (const int midiChannel, const int midiNoteNumber, const float velocity)

if a voice is playing (voice->isPlayingChannel (midiChannel))

and if so, you skip the attack or whatever you don't want in your legato in

SynthesizerVoice::startNote (const int midiNoteNumber, const float velocity, SynthesiserSound* sound, const int currentPitchWheelPosition)




Thanks a lot for your reply! I guess there's no way to accomplish this without subclassing Synthesiser, but that's not a problem. There's still the problem of keeping track of all pressed keys and especially their order, so that when the last (current) key is released the legato can move to the key last pressed and still held down. I looked into MidiKeyboardState but that doesn't seem to provide sufficient information. So i believe that i need to maintain an explicit stack of active keys somewhere?

About the program handling. My plugin implements programs so that current program is merely an index to the array of programs which are user editable. Initially the program array/bank contains factory presets. When the user edits a program and switches to another program, his edits are still there when he switches back to the edited program. This, to my opinion, works beautifully in VST-land, but causes total confusion in the AU-world i.e. Logic. I have yet to figure out how exactly an AU-plugin should present the user/factory programs so that Logic's compare and other such functionality will work. Maybe i should take this question to some other forum, but just in case there's an answer in JUCE i'll ask this here for now. Do you have an extra program slot for the current and editable program that simply duplicates parameter values in the preset bank? Or how do you do it?


Can't you just add counter to synthesiser, increment it for each note pressed and store the value in the voice. Then you loop through them to find the oldest one?

My only experience with monophonic legato is hammond organ percussion, and there you're only interested in whether any other key is already pressed when pressing a key. You don't care about the release.

Don't know anything about plugin preset handling, but I have a feeling there's a lot of plugin makers in this forum, and I wouldn't be surprised if some of them have preset handling as their favourite pastime!


The pressed keys are easy to store in a list. I hope someone can help me with my preset confusion. Big thanks for your help!


Ok, i checked a few AUs from the bigger sellers and it seems that rather than supporting Logic's special functionality they've taken more defensive approach to not exposing any of the plugins presets to the host. They simply implement their own preset handling. This complicates matters significantly. :( What a bullshit.