Update of /cvsroot/audacity/audacity-src/src/widgets
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv18241/src/widgets

Modified Files:
        Meter.cpp 
Log Message:
Add the bodies of some more debugging methods, and some more comment cleanups


Index: Meter.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/widgets/Meter.cpp,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- Meter.cpp   29 Oct 2008 04:06:03 -0000      1.37
+++ Meter.cpp   10 Nov 2008 20:34:16 -0000      1.38
@@ -70,6 +70,35 @@
 #include "../AllThemeResources.h"
 #include "../Experimental.h"
 
+/* Updates to the meter are passed accross via meter updates, each contained in
+ * a MeterUpdateMsg object */
+wxString MeterUpdateMsg::toString()
+{
+wxString output;  // somewhere to build up a string in
+output = wxString::Format(wxT("Meter update msg: %i channels, %i samples\n"), \
+      kMaxMeterBars, numFrames);
+for (int i = 0; i<kMaxMeterBars; i++)
+   {  // for each channel of the meters
+   output += wxString::Format(wxT("%f peak, %f rms "), peak[i], rms[i]);
+   if (clipping[i])
+      output += wxString::Format(wxT("clipped "));
+   else
+      output += wxString::Format(wxT("no clip "));
+   output += wxString::Format(wxT("%i head, %i tail\n"), headPeakCount[i], 
tailPeakCount[i]);
+   }
+return output;
+}
+
+wxString MeterUpdateMsg::toStringIfClipped()
+{
+for (int i = 0; i<kMaxMeterBars; i++)
+   {
+   if (clipping[i] || (headPeakCount[i] > 0) || (tailPeakCount[i] > 0))
+      return toString();
+   }
+return wxT("");
+}
+
 //
 // The Meter passes itself messages via this queue so that it can
 // communicate between the audio thread and the GUI thread.
@@ -107,6 +136,8 @@
    if (len >= mBufferSize-1)
       return false;
 
+   //wxLogDebug(wxT("Put: %s"), msg.toString().c_str());
+
    mBuffer[mEnd] = msg;
    mEnd = (mEnd+1)%mBufferSize;
 
@@ -357,7 +388,7 @@
 
    #if WANT_METER_MENU
       if (evt.RightDown() ||
-          (evt.ButtonDown() && mMenuRect.Inside(evt.m_x, evt.m_y))) 
+          (evt.ButtonDown() && mMenuRect.Contains(evt.m_x, evt.m_y))) 
       {
          wxMenu *menu = new wxMenu();
          // Note: these should be kept in the same order as the enum
@@ -500,10 +531,8 @@
 
          // In addition to looking for mNumPeakSamplesToClip peaked
          // samples in a row, also send the number of peaked samples
-         // at the head and tail, in case there's a run of 
-         // Send the number of peaked samples at the head and tail,
-         // in case there's a run of peaked samples that crosses
-         // block boundaries
+         // at the head and tail, in case there's a run of peaked samples
+         // that crosses block boundaries
          if (fabs(sptr[j])>=MAX_AUDIO) {
             if (msg.headPeakCount[j]==i)
                msg.headPeakCount[j]++;
@@ -546,7 +575,8 @@
       
       if (mMeterDisabled)
          return;
-      
+      //wxLogDebug(wxT("Pop: %s"), msg.toString().c_str());
+
       mT += deltaT;
       for(j=0; j<mNumBars; j++) {
          if (mDecay) {


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to