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

Modified Files:
        TruncSilence.cpp TruncSilence.h 
Log Message:
- Improved Mute/Solo behaviour
- Prevent TruncSilence with 0 or below for duration.

Index: TruncSilence.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/effects/TruncSilence.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- TruncSilence.h      29 Jul 2007 11:02:35 -0000      1.5
+++ TruncSilence.h      23 Sep 2007 19:49:07 -0000      1.6
@@ -68,9 +68,11 @@
 
    void PopulateOrExchange(ShuttleGui & S);
    void OnPreview(wxCommandEvent & event);
+   void OnDurationChange(wxCommandEvent & event);
 
 private:
    EffectTruncSilence *mEffect;
+   wxStaticText * pWarning;
 
 private:
    DECLARE_EVENT_TABLE()

Index: TruncSilence.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/effects/TruncSilence.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- TruncSilence.cpp    18 Sep 2007 14:20:49 -0000      1.14
+++ TruncSilence.cpp    23 Sep 2007 19:49:07 -0000      1.15
@@ -147,7 +147,7 @@
    // We have a lower bound on the amount of silence we chop out at a time
    // to avoid chopping up low frequency sounds.  We're good down to 10Hz
    // if we use 100ms.
-   const float minTruncMs = 100.0f;
+   const float minTruncMs = 1.0f;
    double truncDbSilenceThreshold = Enums::Db2Signal[mTruncDbChoiceIndex];
    int truncLongestAllowedSilentSamples = 
       int((wxMax( mTruncLongestAllowedSilentMs, minTruncMs) * rate) / 1000.0);
@@ -310,6 +310,7 @@
 
 BEGIN_EVENT_TABLE(TruncSilenceDialog, EffectDialog)
     EVT_BUTTON(ID_EFFECT_PREVIEW, TruncSilenceDialog::OnPreview)
+    EVT_TEXT( ID_LONGEST_SILENCE_TEXT, TruncSilenceDialog::OnDurationChange )
 END_EVENT_TABLE()
 
 TruncSilenceDialog::TruncSilenceDialog(EffectTruncSilence * effect,
@@ -338,7 +339,7 @@
    {
       wxArrayString choices(Enums::NumDbChoices, Enums::GetDbChoices());
 
-      S.TieTextBox(_("Max silence duration:"),
+      S.Id( ID_LONGEST_SILENCE_TEXT ).TieTextBox(_("Max silence duration:"),
                    mEffect->mTruncLongestAllowedSilentMs,
                    10);
       S.AddUnits( _("milliseconds") );
@@ -348,6 +349,7 @@
                   &choices);
    }
    S.EndTwoColumn();
+   pWarning = S.AddVariableText( wxT("") );
 }
 
 void TruncSilenceDialog::OnPreview(wxCommandEvent & event)
@@ -356,3 +358,22 @@
    mEffect->Preview();
 }
 
+void TruncSilenceDialog::OnDurationChange(wxCommandEvent & event)
+{
+   // We may even get called during the constructor.
+   // This test saves us from calling unsafe functions.
+   if( !IsShown() )
+      return;
+   TransferDataFromWindow();
+   bool bOk =  mEffect->mTruncLongestAllowedSilentMs > 0.9f ;
+   pWarning->SetLabel( bOk ? 
+      wxT("") : 
+      _("   Duration must be at least 1 millisecond")
+         );
+   wxWindow *pWnd;
+   pWnd = FindWindowById( wxID_OK, this );
+   pWnd->Enable( bOk );
+   pWnd = FindWindowById( ID_EFFECT_PREVIEW, this );
+   pWnd->Enable( bOk );
+
+}


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to