- def update(self, state) :
- if state :
- self.image = self.stateOn
- self.rect = self.rectOn
- else :
- 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)
-
\ No newline at end of file
+ def displayNext(self) :
+ if self.currentColumn:
+ self.currentColumn.update(False)
+ note, verseIndex = self.noteIterator.next()
+ syllabus = note.lyrics[verseIndex].syllabus(encoding="iso-8859-1")
+ column = self.columns[note.midi]
+ column.update(True, syllabus)
+ self.currentColumn = column
+
+ @event_handler(events.KEYDOWN)
+ def handleKeyDown(self, event) :
+ col = event.column
+ if col == self.currentColumn:
+ self.synth.noteon(0, col.tone.midi, DEFAULT_MIDI_VELOCITY)
+
+ @event_handler(events.KEYUP)
+ def handleKeyUp(self, event) :
+ self.synth.noteoff(0, self.currentColumn.tone.midi)
+ self.displayNext()
+
\ No newline at end of file