13
0

Calculate length_beats of split MIDI regions from 'parent' region.

This is probably less than ideal, since setting the properties later will
recompute from frames values.  It is, however, slightly more rightish :)

Seemingly correct cases (i.e. where length_beats is correct):
 * Recording a new MIDI region
 * Splitting said region

Broken:
 * Loading a region from XML

Untested:
 * Import


git-svn-id: svn://localhost/ardour2/branches/3.0@8324 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
David Robillard 2010-12-22 00:48:59 +00:00
parent 9e5550254c
commit 19fc040be1

View File

@ -82,7 +82,6 @@ MidiRegion::MidiRegion (const SourceList& srcs)
assert(_type == DataType::MIDI);
}
/** Create a new MidiRegion, that is part of an existing one */
MidiRegion::MidiRegion (boost::shared_ptr<const MidiRegion> other)
: Region (other)
, _length_beats (Properties::length_beats, (Evoral::MusicalTime) 0)
@ -100,7 +99,11 @@ MidiRegion::MidiRegion (boost::shared_ptr<const MidiRegion> other, frameoffset_t
: Region (other, offset)
, _length_beats (Properties::length_beats, (Evoral::MusicalTime) 0)
{
update_length_beats ();
BeatsFramesConverter bfc (_session.tempo_map(), _position);
Evoral::MusicalTime const offset_beats = bfc.from (offset);
_length_beats = other->_length_beats - offset_beats;
register_properties ();
assert(_name.val().find("/") == string::npos);