Update of /cvsroot/audacity/audacity-src/src
In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv23018

Modified Files:
        WaveTrack.cpp WaveTrack.h 
Log Message:
Fixed creation of empty wave clips everytime a track was imported

Index: WaveTrack.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/WaveTrack.h,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- WaveTrack.h 23 Sep 2006 02:28:05 -0000      1.44
+++ WaveTrack.h 27 Sep 2006 20:21:55 -0000      1.45
@@ -352,6 +352,7 @@
 
    wxCriticalSection mFlushCriticalSection;
    wxCriticalSection mAppendCriticalSection;
+   double mLegacyProjectFileOffset;
 
 };
 

Index: WaveTrack.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/WaveTrack.cpp,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -d -r1.90 -r1.91
--- WaveTrack.cpp       23 Sep 2006 02:28:05 -0000      1.90
+++ WaveTrack.cpp       27 Sep 2006 20:21:55 -0000      1.91
@@ -62,6 +62,8 @@
 
    mDisplay = 0; // Move to GUIWaveTrack
 
+   mLegacyProjectFileOffset = 0;
+
    mFormat = format;
    mRate = (int) rate;
    mGain = 1.0;
@@ -80,6 +82,8 @@
 {
    mDisplay = 0; // Move to GUIWaveTrack
 
+   mLegacyProjectFileOffset = 0;
+
    Init(orig);
 
    for (WaveClipList::Node *node = orig.mClips.GetFirst(); node; node = 
node->GetNext())
@@ -906,9 +910,12 @@
          if (!wxStrcmp(attr, wxT("rate")))
             mRate = wxAtoi(value);
          else if (!wxStrcmp(attr, wxT("offset"))) {
+            // Offset is only relevant for legacy project files. The value
+            // is cached until the actual WaveClip containing the legacy
+            // track is created.
             double ofs = 0.0;
             Internat::CompatibleToDouble(wxString(value), &ofs);
-            GetLastOrCreateClip()->SetOffset(ofs);
+            mLegacyProjectFileOffset = ofs;
          }
          else if (!wxStrcmp(attr, wxT("gain"))) {
             double d;
@@ -947,10 +954,17 @@
    //
    // This is legacy code (1.2 and previous) and is not called for new 
projects!
    //
-   if (!wxStrcmp(tag, wxT("sequence")))
-      return GetLastOrCreateClip()->GetSequence();
-   else if (!wxStrcmp(tag, wxT("envelope")))
-      return GetLastOrCreateClip()->GetEnvelope();
+   if (!wxStrcmp(tag, wxT("sequence")) || !wxStrcmp(tag, wxT("envelope")))
+   {
+      // This is a legacy project, so set the cached offset
+      GetLastOrCreateClip()->SetOffset(mLegacyProjectFileOffset);
+ 
+      // Legacy project file tracks are imported as one single wave clip
+      if (!wxStrcmp(tag, wxT("sequence")))
+         return GetLastOrCreateClip()->GetSequence();
+      else if (!wxStrcmp(tag, wxT("envelope")))
+         return GetLastOrCreateClip()->GetEnvelope();
+   }
    
    //
    // This is for the new file format (post-1.2)


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to