Update MidiRegion::_start_beats on trimming the front of a MIDI region; reset _start_beats with _start on MidiRegion::fix_negative_start(). May help with #4736.
git-svn-id: svn://localhost/ardour2/branches/3.0@11984 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
@@ -132,6 +132,7 @@ class MidiRegion : public Region
|
||||
|
||||
void set_position_internal (framepos_t pos, bool allow_bbt_recompute);
|
||||
void set_length_internal (framecnt_t len);
|
||||
void set_start_internal (framecnt_t);
|
||||
void update_length_beats ();
|
||||
|
||||
void model_changed ();
|
||||
|
||||
@@ -325,6 +325,7 @@ class Region
|
||||
void post_set (const PBD::PropertyChange&);
|
||||
virtual void set_position_internal (framepos_t pos, bool allow_bbt_recompute);
|
||||
virtual void set_length_internal (framecnt_t);
|
||||
virtual void set_start_internal (framecnt_t);
|
||||
|
||||
DataType _type;
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@ 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)) {
|
||||
@@ -424,6 +424,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 */
|
||||
@@ -433,3 +434,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 ();
|
||||
}
|
||||
|
||||
@@ -686,7 +686,7 @@ Region::set_start (framepos_t pos)
|
||||
return;
|
||||
}
|
||||
|
||||
_start = pos;
|
||||
set_start_internal (pos);
|
||||
_whole_file = false;
|
||||
first_edit ();
|
||||
invalidate_transients ();
|
||||
@@ -701,6 +701,7 @@ Region::trim_start (framepos_t new_position)
|
||||
if (locked() || position_locked()) {
|
||||
return;
|
||||
}
|
||||
|
||||
framepos_t new_start;
|
||||
frameoffset_t const start_shift = new_position - _position;
|
||||
|
||||
@@ -732,7 +733,7 @@ Region::trim_start (framepos_t new_position)
|
||||
return;
|
||||
}
|
||||
|
||||
_start = new_start;
|
||||
set_start_internal (new_start);
|
||||
_whole_file = false;
|
||||
first_edit ();
|
||||
|
||||
@@ -888,7 +889,7 @@ Region::trim_to_internal (framepos_t position, framecnt_t length)
|
||||
PropertyChange what_changed;
|
||||
|
||||
if (_start != new_start) {
|
||||
_start = new_start;
|
||||
set_start_internal (new_start);
|
||||
what_changed.add (Properties::start);
|
||||
}
|
||||
|
||||
@@ -1648,3 +1649,8 @@ Region::post_set (const PropertyChange& pc)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Region::set_start_internal (framecnt_t s)
|
||||
{
|
||||
_start = s;
|
||||
}
|
||||
|
||||
@@ -1889,7 +1889,7 @@ TempoMap::framepos_plus_beats (framepos_t pos, Evoral::MusicalTime beats) const
|
||||
return pos;
|
||||
}
|
||||
|
||||
/** Subtract some (fractional) beats to a frame position, and return the result in frames */
|
||||
/** Subtract some (fractional) beats from a frame position, and return the result in frames */
|
||||
framepos_t
|
||||
TempoMap::framepos_minus_beats (framepos_t pos, Evoral::MusicalTime beats) const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user