#include <glibmm/thread.h>
-#include "pbd/basename.h"
#include "pbd/xml++.h"
-#include "pbd/enumwriter.h"
+#include "pbd/basename.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"
/** 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;
- plist.add (Properties::name, ms->name());
+ plist.add (Properties::name, PBD::basename_nosuffix (ms->name()));
plist.add (Properties::whole_file, true);
plist.add (Properties::start, _start);
plist.add (Properties::start_beats, _start_beats);
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)) {
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 */
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 ();
+}