+ Glib::Threads::Mutex::Lock lm (midi_source(0)->mutex(), Glib::Threads::TRY_LOCK);
+ if (lm.locked()) {
+ /* TODO: This is too aggressive, we need more fine-grained invalidation. */
+ midi_source(0)->invalidate (lm);
+ }
+}
+
+/** This is called when a trim drag has resulted in a -ve _start time for this region.
+ * Fix it up by adding some empty space to the source.
+ */
+void
+MidiRegion::fix_negative_start ()
+{
+ BeatsFramesConverter c (_session.tempo_map(), _position);
+
+ model()->insert_silence_at_start (c.from (-_start));
+ _start = 0;
+ _start_beats = Evoral::Beats();
+}
+
+/** Transpose the notes in this region by a given number of semitones */
+void
+MidiRegion::transpose (int semitones)
+{
+ BeatsFramesConverter c (_session.tempo_map(), _start);
+ model()->transpose (c.from (_start), c.from (_start + _length), semitones);
+}
+
+void
+MidiRegion::set_start_internal (framecnt_t s)
+{
+ Region::set_start_internal (s);
+ set_start_beats_from_start_frames ();