diff options
author | Carl Hetherington <carl@carlh.net> | 2010-12-07 19:16:23 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2010-12-07 19:16:23 +0000 |
commit | f3fc6195bc6136a31b08ffe8c260a64efe77f9dc (patch) | |
tree | c9d98183fc9d14cd22ff7d076c593fef9bc9fa2f /libs/ardour/midi_region.cc | |
parent | f8e16276d9a598eb6425ae393dc0bd62cd2df05b (diff) |
Allow trim of midi regions to before the start of the source. Fixes #3156.
git-svn-id: svn://localhost/ardour2/branches/3.0@8212 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/midi_region.cc')
-rw-r--r-- | libs/ardour/midi_region.cc | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/libs/ardour/midi_region.cc b/libs/ardour/midi_region.cc index f9fb791bad..74276ff5b6 100644 --- a/libs/ardour/midi_region.cc +++ b/libs/ardour/midi_region.cc @@ -121,7 +121,7 @@ MidiRegion::set_position_internal (framepos_t pos, bool allow_bbt_recompute) BeatsFramesConverter old_converter(_session.tempo_map(), _position - _start); double length_beats = old_converter.from(_length); - Region::set_position_internal(pos, allow_bbt_recompute); + Region::set_position_internal (pos, allow_bbt_recompute); BeatsFramesConverter new_converter(_session.tempo_map(), pos - _start); @@ -306,9 +306,22 @@ MidiRegion::model_automation_state_changed (Evoral::Parameter const & p) } /* the source will have an iterator into the model, and that iterator will have been set up - for a given set of filtered_paramters, so now that we've changed that list we must invalidate + for a given set of filtered_parameters, so now that we've changed that list we must invalidate the iterator. */ Glib::Mutex::Lock lm (midi_source(0)->mutex()); midi_source(0)->invalidate (); } + +/** 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); + + MidiModel::WriteLock lock (model()->edit_lock ()); + model()->insert_silence_at_start (c.from (-_start)); + _start = 0; +} |