X-Git-Url: https://scm.cri.ensmp.fr/git/minwii.git/blobdiff_plain/3c10e656308bd0f29d8ac4d15f7f95f29aec1697..9845b232ab53ef98733306299e1a52afbabb4e70:/src/minwii/widgets/playingscreen.py diff --git a/src/minwii/widgets/playingscreen.py b/src/minwii/widgets/playingscreen.py index 66c4776..9c1ebfb 100755 --- a/src/minwii/widgets/playingscreen.py +++ b/src/minwii/widgets/playingscreen.py @@ -163,22 +163,26 @@ class PlayingScreen(PlayingScreenBase) : def __init__(self, synth) : distinctNotes = [] + self.currentColumn = None for midi in self.scale : tone = Tone(midi) distinctNotes.append(tone) super(PlayingScreen, self).__init__(synth, distinctNotes) - @event_handler(events.NOTEON) - def noteon(self, evt) : - tone = evt.tone - self.synth.noteon(0, tone.midi, 96) - - @event_handler(events.NOTEOFF) - def noteoff(self, evt) : - tone = evt.tone - self.synth.noteoff(0, tone.midi) + @event_handler(events.COLDOWN) + def noteon(self, event) : + col = event.column + col.update(True) + self.currentColumn = col + self.playnote(col, event.pos) + @event_handler(events.COLUP) + def noteoff(self, event) : + if self.currentColumn : + self.currentColumn.update(False) + self.synth.noteoff(0, self.currentColumn.tone.midi) + class SongPlayingScreen(PlayingScreenBase) : @@ -229,7 +233,7 @@ class SongPlayingScreen(PlayingScreenBase) : def handleEasyColumnOver(self, event) : col = event.column if col.state and \ - any(event.mouseEvent.buttons) and \ + self.cursor.pressed and \ not self.currentNotePlayed : self.playnote(col, event.pos) SongPlayingScreen.setNoteTimeout( @@ -242,7 +246,7 @@ class SongPlayingScreen(PlayingScreenBase) : def handleNormalColumnOver(self, event) : col = event.column if col.state and \ - any(event.mouseEvent.buttons) and \ + self.cursor.pressed and \ not self.currentNotePlayed : self.playnote(col, event.pos) self.currentNotePlayed = True