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

Modified Files:
        LadspaEffect.cpp LadspaEffect.h 
Log Message:
Several effects defined their own GetSamples() method, but they
were all the same, so I moved it to the Effect class and removed
it from the others.

Many effects defined a GetEffectFlags() method, but rather than
incur the extra class overhead for it, I removed the method and
replaced it with a call to SetEffectFlags().  This also put the
handling of the Effect flags into one class (Effect).


Index: LadspaEffect.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/effects/ladspa/LadspaEffect.cpp,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- LadspaEffect.cpp    23 Mar 2009 00:32:54 -0000      1.51
+++ LadspaEffect.cpp    20 May 2009 06:22:49 -0000      1.52
@@ -126,13 +126,15 @@
       }
    }
 
-   flags = PLUGIN_EFFECT;
+   int flags = PLUGIN_EFFECT;
    if (inputs == 0)
       flags |= INSERT_EFFECT;
    else if (outputs == 0)
       flags |= ANALYZE_EFFECT;
    else
       flags |= PROCESS_EFFECT;   
+
+   SetEffectFlags(flags);
 }
 
 LadspaEffect::~LadspaEffect()
@@ -224,33 +226,6 @@
    return true;
 }
 
-void LadspaEffect::GetSamples(WaveTrack *track,
-                              sampleCount *start,
-                              sampleCount *len)
-{
-   double trackStart = track->GetStartTime();
-   double trackEnd = track->GetEndTime();
-   double t0 = mT0 < trackStart? trackStart: mT0;
-   double t1 = mT1 > trackEnd? trackEnd: mT1;
-
-   if (flags & INSERT_EFFECT) {
-      t1 = t0 + mLength;
-      if (mT0 == mT1) {
-         track->InsertSilence(t0, t1);
-      }
-   }
-
-   if (t1 > t0) {
-      *start = track->TimeToLongSamples(t0);
-      sampleCount end = track->TimeToLongSamples(t1);
-      *len = (sampleCount)(end - *start);
-   }
-   else {
-      *start = 0;
-      *len  = 0;
-   }
-}
-
 bool LadspaEffect::Process()
 {
    this->CopyInputWaveTracks(); // Set up mOutputWaveTracks.

Index: LadspaEffect.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/effects/ladspa/LadspaEffect.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- LadspaEffect.h      12 Jul 2008 15:25:48 -0000      1.20
+++ LadspaEffect.h      20 May 2009 06:22:49 -0000      1.21
@@ -36,10 +36,6 @@
    
    virtual wxString GetEffectAction();
 
-   virtual int GetEffectFlags() {
-      return flags;
-   }
- 
    virtual bool Init();
 
    virtual bool PromptUser();
@@ -53,12 +49,7 @@
                       sampleCount lstart, sampleCount rstart,
                       sampleCount len);
 
-   void GetSamples(WaveTrack *track,
-                   sampleCount *start,
-                   sampleCount *len);
- 
    wxString pluginName;
-   int flags;
 
    const LADSPA_Descriptor *mData;
    sampleCount mBlockSize;
@@ -72,7 +63,6 @@
    float *inputControls;
    float *outputControls;
    int mainRate;
-   double mLength;
 
    std::set<wxString> mCategories;
 };


------------------------------------------------------------------------------
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