I would like to display MIDI notes while they are being recorded. I understand that the Value Tree is a good way to separate concerns, but if I use Value Trees, would I need to serialise each MIDI message and then deserialise it? This seems like lot of processing for each repaint
ValueTree is not thread safe so it’s not the best option for DSP/GUI cross thread communication anyway. (The AudioProcessorValueTreeState has some extra thread safe handling for plugin parameters but that doesn’t extend to other data you might be storing in the same tree.)
You should look into using a thread safe FIFO to pass the messages between the audio and GUI threads.
ValueTree is still a good fit if you plan to have the recorded MIDI editable, because of it’s serialisation and undo capabilities.
You have to get the recorded MIDI out of the realtime domain anyway and into the GUI domain in order to draw it.
Record → FIFO → ValueTree → paint
ValueTree → FIFO → playback
I am not sure, but for playback the MIDIMessageSequence could be useful as FIFO
