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

Modified Files:
        Effect.cpp Effect.h Generator.cpp Repeat.cpp 
Log Message:
fixed bugs with track groups and paste (e.g. Effect->Repeat and Generate 
Silence reported by Martyn Shaw)

Index: Repeat.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/effects/Repeat.cpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- Repeat.cpp  18 Jun 2009 00:40:05 -0000      1.31
+++ Repeat.cpp  19 Jun 2009 15:26:28 -0000      1.32
@@ -108,13 +108,14 @@
 
 bool EffectRepeat::Process()
 {
-   this->CopyInputTracks(); // Set up mOutputTracks.
+   // Set up mOutputTracks. This effect needs Track::All because it uses Paste 
that needs to have label tracks.
+   this->CopyInputTracks(Track::All);
 
    int nTrack = 0;
    bool bGoodResult = true;
        double maxDestLen = 0.0; // used to change selection to generated bit
 
-   TrackListIterator iter(mOutputTracks);
+   TrackListOfKindIterator iter(Track::Wave, mOutputTracks);
    WaveTrack *track = (WaveTrack *)iter.First();
    for (; track && bGoodResult; track = (WaveTrack *)iter.Next(), nTrack++) {
       double trackStart = track->GetStartTime();
@@ -138,7 +139,7 @@
       track->Copy(t0, t1, &dest);
       for(int j=0; j<repeatCount; j++)
       {
-         if (!track->Paste(tc, dest) || 
+         if (!track->Paste(tc, dest, mOutputTracks) || 
                TrackProgress(nTrack, j / repeatCount)) // TrackProgress 
returns true on Cancel.
          {
             bGoodResult = false;

Index: Effect.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/effects/Effect.cpp,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -d -r1.76 -r1.77
--- Effect.cpp  18 Jun 2009 09:56:16 -0000      1.76
+++ Effect.cpp  19 Jun 2009 15:26:28 -0000      1.77
@@ -328,53 +328,6 @@
    }
 }
 
-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;
-   }
-}
-
 bool Effect::HandleGroupChangeSpeed(double m_PercentChange, double mCurT0, 
double mCurT1)
 {
    AudacityProject *p = (AudacityProject*)mParent;   

Index: Effect.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/effects/Effect.h,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- Effect.h    18 Jun 2009 00:40:05 -0000      1.45
+++ Effect.h    19 Jun 2009 15:26:28 -0000      1.46
@@ -138,7 +138,6 @@
    // 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.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- Generator.cpp       18 Jun 2009 00:40:05 -0000      1.3
+++ Generator.cpp       19 Jun 2009 15:26:28 -0000      1.4
@@ -23,13 +23,14 @@
 
    BeforeGenerate();
 
-   // Set up mOutputTracks
-   this->CopyInputTracks();
+   // Set up mOutputTracks. This effect needs Track::All because it uses 
ClearAndPaste
+   // that need to have label tracks.
+   this->CopyInputTracks(Track::All);
 
    // Iterate over the tracks
    bool bGoodResult = true;
    int ntrack = 0;
-   TrackListIterator iter(mOutputTracks);
+   TrackListOfKindIterator iter(Track::Wave, mOutputTracks);
    WaveTrack *track = (WaveTrack *)iter.First();
    while (track) {
       if (mDuration > 0.0)
@@ -45,7 +46,7 @@
 
          // Transfer the data from the temporary track to the actual one
          tmp->Flush();
-         track->ClearAndPaste(mT0, mT1, tmp);
+         track->ClearAndPaste(mT0, mT1, tmp, true, true, mOutputTracks);
          delete tmp;
 
          if (!bGoodResult) {
@@ -68,7 +69,6 @@
    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