From 71986da212b641b53c4583d0dca02cc87c758291 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 21 Dec 2010 00:53:18 +0000 Subject: Only calculate length_beats from length (in frames) if length property (in frames) is given, but length_beats property is not. git-svn-id: svn://localhost/ardour2/branches/3.0@8319 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/ardour/midi_region.h | 15 ++++++++------- libs/ardour/midi_diskstream.cc | 1 + libs/ardour/midi_region.cc | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) (limited to 'libs') diff --git a/libs/ardour/ardour/midi_region.h b/libs/ardour/ardour/midi_region.h index f5886698d5..edd9ef31e4 100644 --- a/libs/ardour/ardour/midi_region.h +++ b/libs/ardour/ardour/midi_region.h @@ -36,13 +36,14 @@ class XMLNode; namespace ARDOUR { - namespace Properties { - /* this is pseudo-property: nothing has this as an actual - property, but it allows us to signal changes to the - MidiModel used by the MidiRegion - */ - extern PBD::PropertyDescriptor midi_data; - } + namespace Properties { + /* this is pseudo-property: nothing has this as an actual + property, but it allows us to signal changes to the + MidiModel used by the MidiRegion + */ + extern PBD::PropertyDescriptor midi_data; + extern PBD::PropertyDescriptor length_beats; + } } namespace ARDOUR { diff --git a/libs/ardour/midi_diskstream.cc b/libs/ardour/midi_diskstream.cc index c3f85438db..0ec17bc3aa 100644 --- a/libs/ardour/midi_diskstream.cc +++ b/libs/ardour/midi_diskstream.cc @@ -1042,6 +1042,7 @@ MidiDiskstream::transport_stopped_wallclock (struct tm& /*when*/, time_t /*twhen /* start of this region is the offset between the start of its capture and the start of the whole pass */ plist.add (Properties::start, (*ci)->start - initial_capture); plist.add (Properties::length, (*ci)->frames); + plist.add (Properties::length_beats, converter.from((*ci)->frames)); plist.add (Properties::name, region_name); boost::shared_ptr rx (RegionFactory::create (srcs, plist)); diff --git a/libs/ardour/midi_region.cc b/libs/ardour/midi_region.cc index 5cd08d98d5..4b65e44e22 100644 --- a/libs/ardour/midi_region.cc +++ b/libs/ardour/midi_region.cc @@ -125,7 +125,7 @@ MidiRegion::clone () void MidiRegion::post_set (const PropertyChange& pc) { - if (pc.contains (Properties::length) || pc.contains (Properties::position)) { + if (pc.contains (Properties::length) && !pc.contains (Properties::length_beats)) { update_length_beats (); } } -- cgit v1.2.3