Update of /cvsroot/audacity/audacity-src/src/effects
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv17406/effects

Modified Files:
        Effect.cpp Effect.h Generator.cpp 
Log Message:
problably some undesirable results when working with generators, selections, 
labeltracks and >1 wavetrack.
putting back the old HandleLinkedTracksOnGenerate function but commented its 
call.

Index: Effect.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/effects/Effect.cpp,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -d -r1.77 -r1.78
--- Effect.cpp  19 Jun 2009 15:26:28 -0000      1.77
+++ Effect.cpp  19 Jun 2009 16:50:20 -0000      1.78
@@ -233,6 +233,53 @@
    }
 }
 
+void Effect::HandleLinkedTracksOnGenerate(double length, double t0)
+{
+   AudacityProject *p = (AudacityProject*)mParent;
+   if ( !p || !(p->IsSticky())) return;
+
+   TrackListIterator iter(p->GetTracks());
+
+   int editGroup = 0;
+   bool handleGroup = false;
+   Track *t=iter.First();
+   Track *n=t;
+
+   while (t){//find edit group number
+      n=iter.Next();
+      if (t->GetSelected()) handleGroup = true;
+      if ( (n && n->GetKind()==Track::Wave && t->GetKind()==Track::Label)
+            || (!n) ) {
+         if (handleGroup){
+            t=iter.First();
+            for (int i=0; i<editGroup; i++){//go to first in edit group
+               while (t && t->GetKind()==Track::Wave) t=iter.Next();
+               while (t && t->GetKind()==Track::Label) t=iter.Next();
+            }
+            while (t && t->GetKind()==Track::Wave){
+               if ( !(t->GetSelected()) ){
+                  //printf("t(w)(gen): %x\n", t);
+                  TrackFactory *factory = p->GetTrackFactory();
+                  WaveTrack *tmp = factory->NewWaveTrack( 
((WaveTrack*)t)->GetSampleFormat(), ((WaveTrack*)t)->GetRate());
+                  tmp->InsertSilence(0.0, length);
+                  tmp->Flush();
+                  ((WaveTrack *)t)->HandlePaste(t0, tmp);
+               }
+               t=iter.Next();
+            }
+            while (t && t->GetKind()==Track::Label){
+               //printf("t(l)(gen): %x\n", t);
+               ((LabelTrack *)t)->ShiftLabelsOnInsert(length, t0);
+               t=iter.Next();
+            }
+         }
+         editGroup++;
+         handleGroup = false;
+      }
+      t=n;
+   }
+}
+
 // If bGoodResult, replace mTracks tracks with successfully processed 
mOutputTracks copies.
 // Else clear and delete mOutputTracks copies.
 void Effect::ReplaceProcessedTracks(const bool bGoodResult)

Index: Effect.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/effects/Effect.h,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- Effect.h    19 Jun 2009 15:26:28 -0000      1.46
+++ Effect.h    19 Jun 2009 16:50:20 -0000      1.47
@@ -138,6 +138,7 @@
    // important for sorting.
    static wxString StripAmpersand(const wxString& str);
 
+   void HandleLinkedTracksOnGenerate(double length, double t0);
    bool HandleGroupChangeSpeed(double m_PercentChange, double mCurT0, double 
mCurT1);
  //
  // protected virtual methods

Index: Generator.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/effects/Generator.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- Generator.cpp       19 Jun 2009 15:26:28 -0000      1.4
+++ Generator.cpp       19 Jun 2009 16:50:20 -0000      1.5
@@ -33,32 +33,34 @@
    TrackListOfKindIterator iter(Track::Wave, mOutputTracks);
    WaveTrack *track = (WaveTrack *)iter.First();
    while (track) {
-      if (mDuration > 0.0)
-      {
-         // Create a temporary track
-         WaveTrack *tmp = mFactory->NewWaveTrack(track->GetSampleFormat(),
-                                                 track->GetRate());
-         BeforeTrack(*track);
+      if (track->GetSelected()) {
+         if (mDuration > 0.0)
+         {
+            // Create a temporary track
+            WaveTrack *tmp = mFactory->NewWaveTrack(track->GetSampleFormat(),
+                                                    track->GetRate());
+            BeforeTrack(*track);
 
-         // Fill it with data
-         if (!GenerateTrack(tmp, *track, ntrack))
-            bGoodResult = false;
+            // Fill it with data
+            if (!GenerateTrack(tmp, *track, ntrack))
+               bGoodResult = false;
 
-         // Transfer the data from the temporary track to the actual one
-         tmp->Flush();
-         track->ClearAndPaste(mT0, mT1, tmp, true, true, mOutputTracks);
-         delete tmp;
+            // Transfer the data from the temporary track to the actual one
+            tmp->Flush();
+            track->ClearAndPaste(mT0, mT1, tmp, true, true, mOutputTracks);
+            delete tmp;
 
-         if (!bGoodResult) {
-            Failure();
-            return false;
+            if (!bGoodResult) {
+               Failure();
+               return false;
+            }
+         }
+         else
+         {
+            // If the duration is zero, there's no need to actually
+            // generate anything
+            track->Clear(mT0, mT1);
          }
-      }
-      else
-      {
-         // If the duration is zero, there's no need to actually
-         // generate anything
-         track->Clear(mT0, mT1);
       }
 
       // Move on to the next track
@@ -69,6 +71,7 @@
    Success();
 
    this->ReplaceProcessedTracks(bGoodResult);
+   //HandleLinkedTracksOnGenerate(mDuration, mT0);
 
    mT1 = mT0 + mDuration; // Update selection.
 


------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to