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

Modified Files:
        LadspaEffect.cpp LadspaEffect.h 
Log Message:
Added length field to dialog

Index: LadspaEffect.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/effects/ladspa/LadspaEffect.cpp,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- LadspaEffect.cpp    27 Sep 2006 04:51:17 -0000      1.35
+++ LadspaEffect.cpp    1 Oct 2006 09:36:39 -0000       1.36
@@ -53,6 +53,7 @@
    inputs = 0;
    outputs = 0;
    numInputControls = 0;
+   mLength = 0;
 
    unsigned long p;
 
@@ -189,14 +190,17 @@
 bool LadspaEffect::PromptUser()
 {
    if (numInputControls > 0) {
-      LadspaEffectDialog dlog(this, mParent, mData, inputControls, mainRate);
+      double length = mT1 > mT0 ? mT1 - mT0 : sDefaultGenerateLen;
+
+      LadspaEffectDialog dlog(this, mParent, mData, inputControls, mainRate, 
length);
       dlog.CentreOnParent();
       dlog.ShowModal();
       
       if (!dlog.GetReturnCode())
          return false;
-   }
 
+      mLength = dlog.GetLength();
+   }
    return true;
 }
 
@@ -208,7 +212,14 @@
    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);
       longSampleCount end = track->TimeToLongSamples(t1);
@@ -483,6 +494,7 @@
 END_EVENT_TABLE()
 
 const int LADSPA_PREVIEW_ID = 13100;
+const int LADSPA_SECONDS_ID = 13101;
 
 BEGIN_EVENT_TABLE(LadspaEffectDialog, wxDialog)
     EVT_BUTTON(wxID_OK, LadspaEffectDialog::OnOK)
@@ -499,12 +511,14 @@
                                        wxWindow * parent,
                                        const LADSPA_Descriptor *data,
                                        float *inputControls,
-                                       int sampleRate)
+                                       int sampleRate,
+                                       double length)
    :wxDialog(parent, -1, LAT1CTOWX(data->Name),
              wxDefaultPosition, wxDefaultSize,
              wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER),
     effect(eff)
 {
+   mLength = length;
    numParams = 0;
    this->mData = data;
    this->inputControls = inputControls;
@@ -674,6 +688,19 @@
       }
    }
 
+
+   // Now add the length control
+   if (effect->GetEffectFlags() & INSERT_EFFECT) {
+      item = new wxStaticText(w, 0, _("Length (seconds)"));
+      gridSizer->Add(item, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
+      mSeconds = new wxTextCtrl(w, LADSPA_SECONDS_ID, 
Internat::ToDisplayString(length));
+      gridSizer->Add(mSeconds, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
+      gridSizer->Add(1, 1, 0);
+      gridSizer->Add(1, 1, 0);
+      gridSizer->Add(1, 1, 0);
+      ConnectFocus(mSeconds);
+   }
+
    // Set all of the sliders based on the value in the
    // text fields
        inSlider = false; // Now we're ready for HandleText to actually do 
something.
@@ -857,6 +884,11 @@
    p->Scroll(-1, y);
 };
 
+double LadspaEffectDialog::GetLength()
+{
+   return Internat::CompatibleToDouble(mSeconds->GetValue());
+}
+
 // Indentation settings for Vim and Emacs and unique identifier for Arch, a
 // version control system. Please do not modify past this point.
 //

Index: LadspaEffect.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/effects/ladspa/LadspaEffect.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- LadspaEffect.h      25 Aug 2006 05:04:58 -0000      1.15
+++ LadspaEffect.h      1 Oct 2006 09:36:39 -0000       1.16
@@ -67,6 +67,7 @@
    float *inputControls;
    float *outputControls;
    int mainRate;
+   double mLength;
 };
 
 class LadspaEffectDialog:public wxDialog {
@@ -77,7 +78,8 @@
                       wxWindow * parent,
                       const LADSPA_Descriptor *data,
                       float *inputControls,
-                      int sampleRate);
+                      int sampleRate,
+                      double length);
 
    ~LadspaEffectDialog();
 
@@ -89,6 +91,8 @@
    void OnPreview(wxCommandEvent & event);
    void ControlSetFocus(wxFocusEvent & event);
 
+   double GetLength();
+
    DECLARE_EVENT_TABLE()
 
  private:
@@ -97,7 +101,8 @@
    void DisconnectFocus(wxControl *c);
    bool inSlider;
    bool inText;
-      
+
+   double mLength;
    int sampleRate;
    const LADSPA_Descriptor *mData;
    wxSlider **sliders;
@@ -108,6 +113,7 @@
    unsigned long numParams;
    float *inputControls;
    LadspaEffect *effect;
+   wxTextCtrl *mSeconds;
 };
 
 // Indentation settings for Vim and Emacs and unique identifier for Arch, a


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