X-Git-Url: https://svn.cri.ensmp.fr/git/minwii.git/blobdiff_plain/c1cf9353fbc403b2b446ba315e7bc84c4ac71ded..ccd80f6896303234addbb0f619335b6e59df7746:/src/app/widgets/playingscreen.py?ds=sidebyside diff --git a/src/app/widgets/playingscreen.py b/src/app/widgets/playingscreen.py index 8ded80d..9f84ee5 100755 --- a/src/app/widgets/playingscreen.py +++ b/src/app/widgets/playingscreen.py @@ -135,22 +135,27 @@ class SongPlayingScreen(_PlayingScreenBase) : def __init__(self, synth, song, mode=PLAYING_MODES['NORMAL']) : super(SongPlayingScreen, self).__init__(synth, song.distinctNotes) self.song = song + self.currentColumn = None self.noteIterator = self.song.iterNotes() - self.play() + self.displayNext() - def play(self) : + def displayNext(self) : + if self.currentColumn: + self.currentColumn.update(False) note, verseIndex = self.noteIterator.next() - syllabus = note.lyrics[verseIndex].syllabus() + 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.NOTEON) - def noteon(self, evt) : - tone = evt.tone - self.synth.noteon(0, tone.midi, DEFAULT_MIDI_VELOCITY) - - @event_handler(events.NOTEOFF) - def noteoff(self, evt) : - tone = evt.tone - self.synth.noteoff(0, tone.midi) + @event_handler(events.KEYUP) + def handleKeyUp(self, event) : + self.synth.noteoff(0, self.currentColumn.tone.midi) + self.displayNext() + \ No newline at end of file