Hi !
How do one should approach the selection of notes through te::SelectedMidiEvents
when using a looped sequence of notes ? I can loop clips in my app, and while using getSequenceLooped()
works fine to draw repeated events, the drawing of selected notes is a bit more complex…
I use a juce::LassoComponent
to find the notes. I can’t use the looped sequence of notes to search for matching notes, since, when added to the selection through te::SelectedMidiEvents::setSelected
, the call to clipForEvent
will assert since it iterates on the regular sequence and not the looped sequence :
//==============================================================================
MidiClip* SelectedMidiEvents::clipForEvent (MidiNote* note) const
{
for (auto* c : clips)
if (c->getSequence().getNotes().contains (note))
return c;
// SelectedMidiEvents must never have events without the parent clip
jassertfalse;
return {};
}
In my note drawing function, if I use the looped sequence, then the te::MidiNote
’s won’t match as their state is different (as te::SelectedMidiEvents::isSelected()
will never match since I added note from the non-looped sequence…).
Should I simply only rely on getSequence()
to represent the selected notes ?
Or, is there another approach for this ?
Thanks in advance,
Best,
E.