[haiku-commits] r38660 - haiku/trunk/src/apps/mediaplayer/interface

  • From: superstippi@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 15 Sep 2010 19:37:41 +0200 (CEST)

Author: stippi
Date: 2010-09-15 19:37:41 +0200 (Wed, 15 Sep 2010)
New Revision: 38660
Changeset: http://dev.haiku-os.org/changeset/38660

Modified:
   haiku/trunk/src/apps/mediaplayer/interface/PeakView.cpp
   haiku/trunk/src/apps/mediaplayer/interface/PeakView.h
Log:
Pulse() may run twice before receiving the next
data, so we should prevent showing a current
peak of 0. Fixes the periodic 0 peaks.


Modified: haiku/trunk/src/apps/mediaplayer/interface/PeakView.cpp
===================================================================
--- haiku/trunk/src/apps/mediaplayer/interface/PeakView.cpp     2010-09-15 
16:32:44 UTC (rev 38659)
+++ haiku/trunk/src/apps/mediaplayer/interface/PeakView.cpp     2010-09-15 
17:37:41 UTC (rev 38660)
@@ -44,6 +44,7 @@
 
        fChannelInfos(NULL),
        fChannelCount(0),
+       fGotData(true),
 
        fBackBitmap(NULL),
        fPeakNotificationWhat(0)
@@ -72,6 +73,7 @@
                float max;
                for (int32 i = 0; message->FindFloat("max", i, &max) == B_OK; 
i++)
                        SetMax(max, i);
+               fGotData = true;
                return;
        }
 
@@ -193,6 +195,9 @@
 void
 PeakView::Pulse()
 {
+       if (!fGotData)
+               return;
+
        if (fBackBitmap == NULL)
                return;
 
@@ -207,6 +212,7 @@
 
        for (uint32 i = 0; i < fChannelCount; i++)
                fChannelInfos[i].current_max = 0.0f;
+       fGotData = false;
 
        _DrawBitmap();
        Flush();
@@ -327,6 +333,7 @@
                return;
        }
        memset(fBackBitmap->Bits(), 0, fBackBitmap->BitsLength());
+       fGotData = true;
 }
 
 

Modified: haiku/trunk/src/apps/mediaplayer/interface/PeakView.h
===================================================================
--- haiku/trunk/src/apps/mediaplayer/interface/PeakView.h       2010-09-15 
16:32:44 UTC (rev 38659)
+++ haiku/trunk/src/apps/mediaplayer/interface/PeakView.h       2010-09-15 
17:37:41 UTC (rev 38660)
@@ -85,6 +85,7 @@
 
                        ChannelInfo*            fChannelInfos;
                        uint32                          fChannelCount;
+                       bool                            fGotData;
 
                        BBitmap*                        fBackBitmap;
                        font_height                     fFontHeight;


Other related posts:

  • » [haiku-commits] r38660 - haiku/trunk/src/apps/mediaplayer/interface - superstippi