Copy/Paste to te::MidiList

Pasting to a te::MidiList is what I am really looking for.

const auto midiEvents = te::Clipboard::getInstance()->getContentWithType<te::Clipboard::MIDIEvents>()

This allows us to have midiEvents->notes which is a std::vector of the notes.

I expected there to be a method that pulls in the midiEvents->notes and creates the te::MidiList, but I have not found it.

We can, of course loop through vector and add the notes, but I hope I have overlooked a simpler method.

You want to call Clipboard::MIDIEvents::pasteIntoClip

In Waveform we override the UIBehaviour::paste to be:

    bool paste (const Clipboard& clipboard) override
    {
        if (UIBehaviour::paste (clipboard))
            return true;

        if (auto content = clipboard.getContent())
            if (auto sm = getCurrentlyFocusedSelectionManager())
                if (auto ev = getEditViewState (sm->editViewID))
                    if (content->pasteIntoEdit (ev->edit, ev->insertPoint, sm))
                        return true;

        if (auto me = MidiEditorBase::getActiveMidiEditor())
            return me->pasteFromClipboard();

        return false;
    }

Our pasteFromClipboard calls pasteIntoClip

Thank you. Good information to know. I use similar code to past into a clip.

But in my use case I specifically need to populate a te::MidiList from the clipboard. I was hoping there already exists a method to pull the ValueTree data into the te::MidiList. I can, of course, loop through the std::vector and add the data note by note.

Thank you!