def note_play(self, channel, note, duration, svel, evel): self._logger.debug( "Note %d (%-3s) PLAY on channel %d with duration %.2f (velocity %d ~ %d)", note, midi.get_note_name(note), channel, duration, svel, evel) if channel in IGNORE_PLAY_CHANNELS: return
def note_up(self, channel, note, velocity): self._logger.debug( "Note %d (%-3s) UP on channel %d with velocity %d", note, midi.get_note_name(note), channel, velocity) if channel in IGNORE_PLAY_CHANNELS: return self.chordus.note_up(channel, note, velocity)
def note_down(self, channel, note, velocity): self._logger.debug( "Note %d (%-3s) DOWN on channel %d with velocity %d", note, midi.get_note_name(note), channel, velocity) self._handle_mapping(self.note_mapping.get((channel, note), None), velocity) if channel in IGNORE_PLAY_CHANNELS: return self.chordus.note_down(channel, note, velocity)
def _note_play_up(self, channel, note, velocity, duration, down_data, assignment_enabled): self._logger.debug( "NotePlayer %d (%-3s) UP on channel %d after %.3f with velocity %d (down data: %s)", note, midi.get_note_name(note), channel, duration, velocity, down_data) if self.controller.get_feedback_enabled(): self.controller.midi.send_note_up(channel, note, velocity) for f in down_data['faces']: if self.controller.assignment_enabled: self.controller.scene.set_face_mapping( f, (channel, note, duration, down_data['svel'], velocity)) f.highlight(0., force=True)
def _note_play_down(self, channel, note, velocity, assignment_enabled): self._logger.debug( "NotePlayer %d (%-3s) DOWN on channel %d with velocity %d", note, midi.get_note_name(note), channel, velocity) if assignment_enabled: faces = self.controller.scene.get_next_faces_and_rotate() else: faces = self.controller.scene.get_next_faces() if self.controller.get_feedback_enabled(): self.controller.midi.send_note_down(channel, note, velocity) for f in faces: f.set_wire_color( self.controller.scene.color_palette.get_wire_color_for_note( note)) f.set_face_colors(*self.controller.scene.color_palette. get_face_colors_for_note(note)) f.highlight(math.inf) return {'faces': faces, 'svel': velocity}
def update(self, dt): mappings = [self.hud.scene.get_face_mapping(face[0]) for face in reversed(self.hud.scene.face_queue)] self.names = ["%d·%s" % (mapping[0] + 1, midi.get_note_name(mapping[1]).replace('♯', '#')) if mapping is not None else "·" for mapping in mappings]