Midi Controller Event Editing

I was expecting to find a similar mechanism for editing midi controller events as for automation curves. But I am only finding—

te::MidiList& midiList{ midiClip->getSequence() };

midiList.addControllerEvent(0.0, 64, 0, &undoManager);
midiList.setControllerValueAt(64, 0.0, 0, &undoManager);
// etc.

This seems tedious, and we need a function like automationCurve.movePoint(selectedPoint, mouseTime, mouseValue, false);.

I feel like I am not fiinding the right approach here. What is the correct way to access controller events for editing?

You can use SelectedMidiEvents::moveControllerData. It’s actually designed for moving controller data along with notes. Example:

            for (int i = 0; i < numSelectedNotes; ++i)
                auto op = originalPositions.getUnchecked (i);
                jassert (op != nullptr);

                auto note = selected.getUnchecked (i);

                note->setStartAndLength (op->start + deltaBeats, op->length, undoManager);
                note->setNoteNumber (shiftNote (op->noteNumber, deltaRow), undoManager);

                startTime = std::min (startTime, selectedClips[i]->getTimeOfContentBeat (op->start));
                endTime   = std::max (endTime, selectedClips[i]->getTimeOfContentBeat (op->start + op->length));

                SelectedMidiEvents::moveControllerData (uniqueSelectedClips, nullptr, deltaBeats, startTime, endTime, originalNoteDragBehaviour == Copying);

My use case is for specifically editing the controller events, like the sustain pedal (64) data, for example. For this I do not need to move the notes. I will investigate to see if this works for that.