1. Michael Ziegler
  2. failplay

Commits

Michael Ziegler  committed 0247d3d

if we don't have any data to operate on, do a sensible version of nothing

  • Participants
  • Parent commits c66a83e
  • Branches default

Comments (0)

Files changed (1)

File analyzer.py

View file
         painter = QtGui.QPainter(self)
         painter.fillRect(evt.rect(), self.palette().color(QtGui.QPalette.Window))
 
+        if len(self.points) == 0:
+            return
+
         top    = evt.rect().top()
         left   = evt.rect().left()
         width  = evt.rect().width()
             painter.drawLine( left + x, top + height, left + x, top + height - thing)
 
     def __call__(self, chunk):
+        if not chunk:
+            self.points = []
+            return
+
         # we only need data for self.columns * 2 for FFT * 2 channels * 2 bytes per sample
         mono = audioop.tomono(chunk[:self.columns * 2 * 2 * 2], 2, 0.5, 0.5)
         mono = numpy.frombuffer(mono, numpy.short)