PianoRoll / MidiEditor and midinote drawing approach

What is the best approach to drawing notes in a midi editor?
Create a note component for each midinote and add them to a parent component
using component draggers to drag them around and updating the data that the note component refers to?
This method seems it would have a lot of overhead as all the note components would have to be listeners to the valuetree.

Or do all the painting in the parent component of the editor for the midinote data?
Here I would use a struct to represent the actual note data and in my paint method, paint notes based on the data.

How does Waveform do it?

We just paint the notes directly in a piano roll using the MidiList::getNotes() array.
If you just repaint the piano roll when the list changes all the notes should be up to date.

1 Like