Creating a general MIDI note picker
Captain's Log: Stardate 77680.8
The next feature I really want to get done is to add retriggering for LFOs (based on a MIDI note being pressed). However, this requires that the user can pick which MIDI note is assigned to retrigger each LFO, and I don't have a generalized widget for this yet. Plus, the components I have for picking the MIDI note for exciters have always been fairly provisional.
So I started working on a general MIDI note picker. I want it to work in two ways: (1) it should pop up a visual piano keyboard, which will show which actual MIDI notes are being pressed in real time, and then will let you click on the one you want, and (2) a "learn" button that you click, and then press a MIDI key and it's now assigned. Ideally in the first mode where the visual piano keyboard is shown, it will also show which keys are in use by other entities, etc. I think with these features, it will be much less annoying to map MIDI keys to entities.
Today I implemented the SPSC queue and listener mechanisms to get the MIDI data from the audio thread to the GUI thread without blocking/allocating. This was pretty simple, except making sure it works with potentially multiple GUI editors (which is an insane thing that VST supports but I've never actually seen).
Of course as usual, weird complexities have already come up. The main open question is: what will the note picker do when the user has selected N entities with different MIDI notes? Right now I'm thinking that clicking a note will assign them all to the same note, but that dragging the note will transpose them all up/down together with their relative pitches kept the same.