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

Modified Files:
        LV2Effect.cpp LV2Effect.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: LV2Effect.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/effects/lv2/LV2Effect.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- LV2Effect.h 15 Aug 2008 06:21:34 -0000      1.4
+++ LV2Effect.h 20 May 2009 06:22:49 -0000      1.5
@@ -71,11 +71,6 @@
    /** Get the action string. */
    virtual wxString GetEffectAction();
    
-   /** Get the flags that describe the type of the effect. */
-   virtual int GetEffectFlags() {
-      return flags;
-   }
-   
    virtual bool Init();
 
    virtual bool PromptUser();
@@ -106,20 +101,14 @@
                       sampleCount lstart, sampleCount rstart,
                       sampleCount len);
 
-   void GetSamples(WaveTrack *track,
-                   sampleCount *start,
-                   sampleCount *len);
- 
    bool mValid;
    wxString pluginName;
-   int flags;
 
    SLV2Plugin mData;
    sampleCount mBlockSize;
    float **fInBuffer;
    float **fOutBuffer;
    int mainRate;
-   double mLength;
 
    std::set<wxString> mCategories;
    

Index: LV2Effect.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/effects/lv2/LV2Effect.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- LV2Effect.cpp       23 Mar 2009 00:32:54 -0000      1.8
+++ LV2Effect.cpp       20 May 2009 06:22:49 -0000      1.9
@@ -143,14 +143,15 @@
    // Determine whether the plugin is a generator, effect or analyser 
    // depending on the number of ports of each type (not completely accurate,
    // but works most of the time)
-   flags = PLUGIN_EFFECT;
+   int flags = PLUGIN_EFFECT;
    if (mAudioInputs.size() == 0)
       flags |= INSERT_EFFECT;
    else if (mAudioOutputs.size() == 0)
       flags |= ANALYZE_EFFECT;
    else
       flags |= PROCESS_EFFECT;
-   
+
+   SetEffectFlags(flags);
 }
 
 LV2Effect::~LV2Effect()
@@ -247,33 +248,6 @@
    return true;
 }
 
-void LV2Effect::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 LV2Effect::Process()
 {
    this->CopyInputWaveTracks(); // Set up mOutputWaveTracks.


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