Преглед на файлове

Fix signal rendering part

Graham Northup преди 6 години
родител
ревизия
5b8b177905
променени са 2 файла, в които са добавени 2 реда и са изтрити 1 реда
  1. 1 0
      client.py
  2. 1 1
      render.py

+ 1 - 0
client.py

@@ -254,6 +254,7 @@ def mapped():
         mapping[:fixfmtsz] = struct.pack(fixfmt, (DRIFT_FACTOR - 1.0) if QUEUED_PCM else 0.0)
         mapping[fixfmtsz:fixfmtsz+sigfmtsz] = struct.pack(sigfmt, *(float(LAST_SAMPLES[i])/MAX if i < len(LAST_SAMPLES) else 0.0 for i in xrange(ms)))
         mapping[fixfmtsz+sigfmtsz:] = struct.pack(strfmt, *unzip2((FREQS[i], float(AMPS[i])/MAX) for i in xrange(STREAMS)))
+        del LAST_SAMPLES[:]
         time.sleep(stm)
 
 # Generator functions--should be cyclic within [0, 2*math.pi) and return [-1, 1]

+ 1 - 1
render.py

@@ -117,7 +117,7 @@ while True:
     sampwin.fill((0, 0, 0), (0, 0, SAMP_WIDTH, HEIGHT))
     x = 0
     for i in LAST_SAMPLES:
-        sy = int(AMP * HALFH + HALFH)
+        sy = int(i * HALFH + HALFH)
         pygame.gfxdraw.line(sampwin, x - 1, lastsy, x, sy, (0, 255, 0))
         x += 1
         lastsy = sy