pasteNotesIntoClip

Hi,
In the method :

juce::Array<MidiNote*> pasteNotesIntoClip (MidiClip&, const juce::Array<MidiNote*>& selectedNotes,
                                                   TimePosition cursorPosition, const std::function<BeatPosition (BeatPosition)>& snapBeat) const;

of MIDIEvents i did not understand the snapBeat callback.
Can someone provides me an example of it ?
Thanks.

It’s just a function that you can use to snap beat position whilst pasting. For example if you want to snap all beats to the nearest beat you could call it like this:

pasteNotesIntoClip (clip, selectedNotes, cursorPos,
                    [] (auto beatPos) { return tracktion::roundToNearestBeat (beatPos); });