Only calculate length_beats from length (in frames) if length property (in frames...
authorDavid Robillard <d@drobilla.net>
Tue, 21 Dec 2010 00:53:18 +0000 (00:53 +0000)
committerDavid Robillard <d@drobilla.net>
Tue, 21 Dec 2010 00:53:18 +0000 (00:53 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@8319 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/ardour/ardour/midi_region.h
libs/ardour/midi_diskstream.cc
libs/ardour/midi_region.cc

index f5886698d5b3f83e36447b654921effc09fc798f..edd9ef31e40cb1990c9ff6cab8a4a3aea8cd17a2 100644 (file)
 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<void*> 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<void*> midi_data;
+               extern PBD::PropertyDescriptor<Evoral::MusicalTime> length_beats;
+       }
 }
 
 namespace ARDOUR {
index c3f85438dbd84474e120e72c1780bef604a03c56..0ec17bc3aad0a2ccb7970b588dc563f9b1e946a5 100644 (file)
@@ -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<Region> rx (RegionFactory::create (srcs, plist));
index 5cd08d98d5724d183a523ae143a6b7352efcece1..4b65e44e220cdf8ce2ef674b4ddb0ce46ff5ab58 100644 (file)
@@ -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 ();
        }
 }