- @event_handler(pygame.MOUSEBUTTONDOWN)
- def onMouseDown(self, event) :
- if self.rect.collidepoint(*event.pos) :
- self.update(True)
+ def handleColumnOver(self, event) :
+ col = event.column
+ if col.state and not self.currentNotePlayed :
+ self.synth.noteon(0, col.tone.midi, DEFAULT_MIDI_VELOCITY)
+ SongPlayingScreen.setNoteTimeout(
+ int(self.currentNote.duration * \
+ self.quarterNoteDuration)
+ )
+ self.currentNotePlayed = True
+
+ @event_handler(events.NOTEEND)
+ def clearTimeOutAndDisplayNext(self, evt) :
+ pygame.time.set_timer(evt.type, 0)
+ self.synth.noteoff(0, self.currentNote.midi)
+ self.displayNext()
+
+ @staticmethod
+ def setNoteTimeout(delay) :
+ pygame.time.set_timer(events.NOTEEND, delay)
+
+ def stop(self) :
+ pygame.time.set_timer(events.NOTEEND, 0)
+ super(SongPlayingScreen, self).stop()