- self.image = self.stateOff
- self.rect = self.rectOff
-
-def hls_to_rgba_8bits(h, l, s) :
- #convert to rgb ranging from 0 to 255
- rgba = [floor(255 * i) for i in hls_to_rgb(h, l, s) + (1,)]
- return tuple(rgba)
+ vel = self.getVelocity(event.pos) * MIDI_VELOCITY_WRONG_NOTE_ATTN
+ vel = int(vel)
+ self.playnote(col, event.pos, vel=vel)
+ self.alternateColumn = col
+ self.currentNotePlayed = False
+
+ def handleColumnUp(self, event) :
+ if self.currentNotePlayed :
+ self.synth.noteoff(0, self.currentColumn.tone.midi)
+ self.displayNext()
+
+ def handleExpertColumnUp(self, event) :
+ if self.currentNotePlayed :
+ self.synth.noteoff(0, self.currentColumn.tone.midi)
+ self.displayNext()
+ else :
+ self.synth.noteoff(0, self.alternateColumn.tone.midi)
+
+ # --- End HID listeners ---
+
+
+ def displayNext(self, event=None) :
+ if self.currentColumn:
+ self.currentColumn.update(False)
+ note, verseIndex = self.noteIterator.next()
+ syllabus = note.lyrics[verseIndex].syllabus()
+ column = self.columns[note.midi]
+ column.update(True, syllabus)
+ self.currentColumn = column
+ self.currentNote = note
+ self.currentNotePlayed = False
+
+ @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()
+
+
\ No newline at end of file