explicit checks for all components of the LV2 stack
[ardour.git] / libs / ardour / midi_region.cc
index 3dd0e1e203d1d7ba11c655c9bc7e4dc3b0522cf5..d52d661c1a5972b897f05e4ccd179cb6dded6611 100644 (file)
 
 #include <glibmm/thread.h>
 
-#include "pbd/basename.h"
 #include "pbd/xml++.h"
-#include "pbd/enumwriter.h"
 
 #include "ardour/automation_control.h"
-#include "ardour/dB.h"
-#include "ardour/gain.h"
 #include "ardour/midi_model.h"
 #include "ardour/midi_region.h"
 #include "ardour/midi_ring_buffer.h"
 #include "ardour/midi_source.h"
-#include "ardour/playlist.h"
 #include "ardour/region_factory.h"
 #include "ardour/session.h"
 #include "ardour/tempo.h"
@@ -129,13 +124,13 @@ MidiRegion::~MidiRegion ()
 /** Create a new MidiRegion that has its own version of some/all of the Source used by another.
  */
 boost::shared_ptr<MidiRegion>
-MidiRegion::clone () const
+MidiRegion::clone (string path) const
 {
        BeatsFramesConverter bfc (_session.tempo_map(), _position);
        Evoral::MusicalTime const bbegin = bfc.from (_start);
        Evoral::MusicalTime const bend = bfc.from (_start + _length);
 
-       boost::shared_ptr<MidiSource> ms = midi_source(0)->clone (bbegin, bend);
+       boost::shared_ptr<MidiSource> ms = midi_source(0)->clone (path, bbegin, bend);
 
        PropertyList plist;
 
@@ -153,6 +148,8 @@ MidiRegion::clone () const
 void
 MidiRegion::post_set (const PropertyChange& pc)
 {
+       Region::post_set (pc);
+
        if (pc.contains (Properties::length) && !pc.contains (Properties::length_beats)) {
                update_length_beats ();
        } else if (pc.contains (Properties::start) && !pc.contains (Properties::start_beats)) {
@@ -256,7 +253,7 @@ MidiRegion::_read_at (const SourceList& /*srcs*/, Evoral::EventSink<framepos_t>&
        src->set_note_mode(mode);
 
        /*
-         cerr << "MR read @ " << position << " * " << to_read
+         cerr << "MR " << name () << " read @ " << position << " * " << to_read
          << " _position = " << _position
          << " _start = " << _start
          << " intoffset = " << internal_offset
@@ -348,12 +345,6 @@ MidiRegion::model() const
        return midi_source()->model();
 }
 
-int
-MidiRegion::exportme (ARDOUR::Session&, ARDOUR::ExportSpecification&)
-{
-       return -1;
-}
-
 boost::shared_ptr<MidiSource>
 MidiRegion::midi_source (uint32_t n) const
 {
@@ -429,6 +420,7 @@ MidiRegion::fix_negative_start ()
 
        model()->insert_silence_at_start (c.from (-_start));
        _start = 0;
+       _start_beats = 0;
 }
 
 /** Transpose the notes in this region by a given number of semitones */
@@ -438,3 +430,10 @@ 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 ();
+}