moved speaker buffer playing into the Speaker class

This commit is contained in:
James Tauber 2011-08-15 02:30:28 -04:00
parent 96787a2667
commit b9033a459a

View File

@ -262,6 +262,12 @@ class Speaker:
self.buffer = []
self.polarity = False
def play(self):
sample_array = numpy.array(self.buffer)
sound = pygame.sndarray.make_sound(sample_array)
sound.play()
self.reset()
class ROM:
@ -371,10 +377,7 @@ class Memory:
def update(self, cycle):
if self.speaker.buffer and (cycle - self.speaker.last_toggle) > self.speaker.CHECK_INTERVAL:
sample_array = numpy.array(self.speaker.buffer)
sound = pygame.sndarray.make_sound(sample_array)
sound.play()
self.speaker.reset()
self.speaker.play()
class Disassemble: