Update of /cvsroot/audacity/audacity-src/src
In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv25734/src

Modified Files:
        LabelTrack.cpp LabelTrack.h 
Log Message:
Adding label synchronisation for Change Speed, Change Tempo, and Time Scale
(SBSMS).

This will move the labels in any *selected* label track. This currently does
not respect track linking/groups, regardless of whether it is enabled. There is
also a certain amount of duplicated code because these effects could do with
some refactoring, but it's not worth disturbing things at the moment.

It might or might not be possible to make it behave slightly oddly in some
cases, thanks to the general linking state of confusion, but this should be
better than before as it's now at least possible to use these effects without
effectively losing the label timing information.




Index: LabelTrack.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/LabelTrack.cpp,v
retrieving revision 1.121
retrieving revision 1.122
diff -u -d -r1.121 -r1.122
--- LabelTrack.cpp      3 Nov 2009 18:56:24 -0000       1.121
+++ LabelTrack.cpp      18 Dec 2009 18:29:27 -0000      1.122
@@ -58,6 +58,7 @@
 #include "commands/CommandManager.h"
 
 #include "CaptureEvents.h"
+#include "effects/TimeWarper.h"
 
 wxFont LabelTrack::msFont;
 
@@ -237,6 +238,16 @@
    }
 }
 
+// Move the labels in the track according to the given TimeWarper.
+// (If necessary this could be optimised by ignoring labels that occur before a
+// specified time, as in most cases they don't need to move.)
+void LabelTrack::WarpLabels(const TimeWarper &warper) {
+   for (int i = 0; i < mLabels.GetCount(); ++i) {
+      double &labelT0 = mLabels[i]->t; labelT0 = warper.Warp(labelT0);
+      double &labelT1 = mLabels[i]->t1; labelT1 = warper.Warp(labelT1);
+   }
+}
+
 void LabelTrack::ResetFlags()
 {
    mMouseXPos = -1;

Index: LabelTrack.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/LabelTrack.h,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- LabelTrack.h        31 Oct 2009 15:24:21 -0000      1.53
+++ LabelTrack.h        18 Dec 2009 18:29:28 -0000      1.54
@@ -34,6 +34,7 @@
 
 class AudacityProject;
 class DirManager;
+class TimeWarper;
 
 
 class LabelStruct 
@@ -174,6 +175,7 @@
    void ChangeLabelsOnReverse(double b, double e);
    void ScaleLabels(double b, double e, double change);
    double AdjustTimeStampOnScale(double t, double b, double e, double change);
+   void WarpLabels(const TimeWarper &warper);
    
    // Returns tab-separated text of all labels completely within given region
    wxString GetTextOfLabels(double t0, double t1);


------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Audacity-cvs mailing list
Audacity-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to