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

Modified Files:
        TrackArtist.cpp Menus.cpp Menus.h AColor.h AColor.cpp 
Log Message:
Add "realtime" clipping display

Index: Menus.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/Menus.h,v
retrieving revision 1.106
retrieving revision 1.107
diff -u -d -r1.106 -r1.107
--- Menus.h     11 Jul 2007 06:18:43 -0000      1.106
+++ Menus.h     24 Jul 2007 07:15:01 -0000      1.107
@@ -194,6 +194,8 @@
 void OnExpandAllTracks();
 void OnCollapseAllTracks();
 
+void OnShowClipping();
+
 void OnSelectionFormat(int index);
 
 void OnPlotSpectrum();

Index: AColor.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/AColor.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- AColor.h    5 Jul 2007 11:55:34 -0000       1.13
+++ AColor.h    24 Jul 2007 07:15:01 -0000      1.14
@@ -69,6 +69,8 @@
    static wxBrush muteBrush[2];
    static wxBrush soloBrush;
 
+   static wxPen clippingPen;
+
    static wxPen envelopePen;
    static wxPen WideEnvelopePen;
    static wxBrush envelopeBrush;

Index: AColor.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/AColor.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- AColor.cpp  5 Jul 2007 11:55:34 -0000       1.24
+++ AColor.cpp  24 Jul 2007 07:15:01 -0000      1.25
@@ -43,6 +43,8 @@
 wxBrush AColor::muteBrush[2];
 wxBrush AColor::soloBrush;
 
+wxPen AColor::clippingPen;
+
 wxBrush AColor::envelopeBrush;
 wxPen AColor::envelopePen;
 wxPen AColor::WideEnvelopePen;
@@ -308,6 +310,8 @@
    wxColour dark =
        wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW);
 
+   clippingPen.SetColour(0xCC, 0x11, 0x00);
+
    theTheme.SetPenColour(   envelopePen,     clrEnvelope );
    theTheme.SetPenColour(   WideEnvelopePen, clrEnvelope );
    theTheme.SetBrushColour( envelopeBrush,   clrEnvelope );

Index: TrackArtist.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/TrackArtist.cpp,v
retrieving revision 1.97
retrieving revision 1.98
diff -u -d -r1.97 -r1.98
--- TrackArtist.cpp     5 Jul 2007 11:55:36 -0000       1.97
+++ TrackArtist.cpp     24 Jul 2007 07:15:00 -0000      1.98
@@ -1181,6 +1181,35 @@
       }
    }
 
+   // Draw clipping indicators if requested
+   bool showclipping = gPrefs->Read(wxT("/GUI/ShowClipping"), 0L);
+   if (showclipping) {
+      dc.SetPen(AColor::clippingPen);
+
+      sampleCount s0 = (sampleCount) (t0 * rate + 0.5);
+      sampleCount slen = (sampleCount) (r.width * rate / pps + 0.5);
+      sampleCount snSamples = clip->GetNumSamples(); 
+
+      if (s0 + slen > snSamples) {
+         slen = snSamples - s0;
+      }
+
+      float *buffer = new float[slen];
+      clip->GetSamples((samplePtr)buffer, floatSample, s0, slen);
+
+      for (sampleCount s = 0; s < slen; s++) {
+         float v = floor(buffer[s]);
+         if (buffer[s] <= -1.0) {
+            int x = (int)rint((s / rate + s0 / rate - t0) * pps);
+            dc.DrawLine(r.x + x, r.y + (r.height / 2), r.x + x, r.y + 
r.height);
+         }
+         else if (buffer[s] >= 1.0) {
+            int x = (int)rint((s / rate + s0 / rate - t0) * pps);
+            dc.DrawLine(r.x + x, r.y, r.x + x, r.y + (r.height / 2));
+         }
+      }
+      delete [] buffer;
+   }
 
    // Draw arrows on the left side if the track extends to the left of the
    // beginning of time.  :)

Index: Menus.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/Menus.cpp,v
retrieving revision 1.330
retrieving revision 1.331
diff -u -d -r1.330 -r1.331
--- Menus.cpp   11 Jul 2007 06:18:43 -0000      1.330
+++ Menus.cpp   24 Jul 2007 07:15:01 -0000      1.331
@@ -538,6 +538,10 @@
    c->AddItem(wxT("ExpandAllTracks"), _("E&xpand All Tracks\tCtrl+Shift+X"), 
FN(OnExpandAllTracks));
 
    c->AddSeparator();
+   c->AddItem(wxT("ShowClipping"), _("Show Clipping"), FN(OnShowClipping),
+              gPrefs->Read(wxT("/GUI/ShowClipping"), 0L));
+
+   c->AddSeparator();
 //   c->BeginSubMenu(_("Set Selection Format"));
 //   c->AddItemList(wxT("SelectionFormat"), GetSelectionFormats(), 
FN(OnSelectionFormat));
 //   c->EndSubMenu();
@@ -3307,6 +3311,14 @@
    TP_ScrollWindow(mViewInfo.sel0);
 }
 
+void AudacityProject::OnShowClipping()
+{
+   bool checked = !gPrefs->Read(wxT("/GUI/ShowClipping"), 0L);
+   gPrefs->Write(wxT("/GUI/ShowClipping"), checked);
+   mCommandManager.Check(wxT("ShowClipping"), checked);
+   mTrackPanel->Refresh(false);
+}
+
 void AudacityProject::OnPlotSpectrum()
 {
    int selcount = 0;


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to