/** This version finds any canvas note matching the supplied note. */
NoteBase*
-MidiRegionView::find_canvas_note (NoteType note)
+MidiRegionView::find_canvas_note (Evoral::event_id_t id)
{
Events::iterator it;
for (it = _events.begin(); it != _events.end(); ++it) {
- if (*((*it)->note()) == note) {
+ if ((*it)->note()->id() == id) {
return *it;
}
}
cne = add_note (note, visible);
}
- set<boost::shared_ptr<NoteType> >::iterator it;
+ set<Evoral::event_id_t>::iterator it;
for (it = _pending_note_selection.begin(); it != _pending_note_selection.end(); ++it) {
- if (*(*it) == *note) {
+ if ((*it) == note->id()) {
add_to_selection (cne);
}
}
The requested notes most likely won't exist in the view until the next model redisplay.
*/
void
-MidiRegionView::select_notes (list<boost::shared_ptr<NoteType> > notes)
+MidiRegionView::select_notes (list<Evoral::event_id_t> notes)
{
NoteBase* cne;
- list<boost::shared_ptr<NoteType> >::iterator n;
+ list<Evoral::event_id_t>::iterator n;
for (n = notes.begin(); n != notes.end(); ++n) {
- if ((cne = find_canvas_note(*(*n))) != 0) {
+ if ((cne = find_canvas_note(*n)) != 0) {
add_to_selection (cne);
} else {
_pending_note_selection.insert(*n);
void move_selection(double dx, double dy, double cumulative_dy);
void note_dropped (NoteBase* ev, ARDOUR::frameoffset_t, int8_t d_note);
- void select_notes (std::list<boost::shared_ptr<NoteType> >);
+ void select_notes (std::list<Evoral::event_id_t>);
void select_matching_notes (uint8_t notenum, uint16_t channel_mask, bool add, bool extend);
void toggle_matching_notes (uint8_t notenum, uint16_t channel_mask);
std::set< boost::shared_ptr<NoteType> > _marked_for_selection;
/** Notes that should be selected when the model is redisplayed. */
- std::set< boost::shared_ptr<NoteType> > _pending_note_selection;
+ std::set<Evoral::event_id_t> _pending_note_selection;
/** New notes (created in the current command) which should have visible velocity
* when they appear after the command is applied. */
PBD::ScopedConnection content_connection;
NoteBase* find_canvas_note (boost::shared_ptr<NoteType>);
- NoteBase* find_canvas_note (NoteType);
+ NoteBase* find_canvas_note (Evoral::event_id_t id);
Events::iterator _optimization_iterator;
void update_note (NoteBase*, bool update_ghost_regions = true);
for (std::set<boost::shared_ptr<Evoral::Note<Evoral::Beats> > >::iterator i = (*rn_it).second.begin(); i != (*rn_it).second.end(); ++i) {
XMLNode* nc = n->add_child(X_("note"));
- snprintf(buf, sizeof(buf), "%d", (*i)->channel());
- nc->add_property(X_("channel"), string(buf));
- snprintf(buf, sizeof(buf), "%f", (*i)->time().to_double());
- nc->add_property(X_("time"), string(buf));
-
- snprintf(buf, sizeof(buf), "%d", (*i)->note());
- nc->add_property(X_("note"), string(buf));
-
- snprintf(buf, sizeof(buf), "%f", (*i)->length().to_double());
- nc->add_property(X_("length"), string(buf));
-
- snprintf(buf, sizeof(buf), "%d", (*i)->velocity());
- nc->add_property(X_("velocity"), string(buf));
-
- snprintf(buf, sizeof(buf), "%d", (*i)->off_velocity());
- nc->add_property(X_("off-velocity"), string(buf));
+ snprintf(buf, sizeof(buf), "%d", (*i)->id());
+ nc->add_property(X_("id"), string(buf));
}
}
editor->get_regionviews_by_id (id, rs); // there could be more than one
- std::list<boost::shared_ptr<Evoral::Note<Evoral::Beats> > > notes;
+ std::list<Evoral::event_id_t> notes;
XMLNodeList children = (*i)->children ();
for (XMLNodeList::const_iterator ci = children.begin(); ci != children.end(); ++ci) {
- XMLProperty const * prop_channel = (*ci)->property (X_("channel"));
- XMLProperty const * prop_time = (*ci)->property (X_("time"));
- XMLProperty const * prop_note = (*ci)->property (X_("note"));
- XMLProperty const * prop_length = (*ci)->property (X_("length"));
- XMLProperty const * prop_velocity = (*ci)->property (X_("velocity"));
- XMLProperty const * prop_off_velocity = (*ci)->property (X_("off-velocity"));
-
- assert (prop_channel);
- assert (prop_time);
- assert (prop_note);
- assert (prop_length);
- assert (prop_velocity);
- assert (prop_off_velocity);
-
- uint8_t channel = atoi(prop_channel->value());
- Evoral::Beats time (atof(prop_time->value()));
- Evoral::Beats length (atof(prop_length->value()));
- uint8_t note = atoi(prop_note->value());
- uint8_t velocity = atoi(prop_velocity->value());
- uint8_t off_velocity = atoi(prop_off_velocity->value());
- boost::shared_ptr<Evoral::Note<Evoral::Beats> > the_note
- (new Evoral::Note<Evoral::Beats> (channel, time, length, note, velocity));
- the_note->set_off_velocity (off_velocity);
-
- notes.push_back (the_note);
+ XMLProperty const * prop_id = (*ci)->property (X_("id"));
+ Evoral::event_id_t id = atoi(prop_id->value());
+
+ notes.push_back (id);
}
for (RegionSelection::iterator rsi = rs.begin(); rsi != rs.end(); ++rsi) {