def mouse_func(self, button, state, x, y): self.button = button == GLUT_LEFT_BUTTON and state == GLUT_DOWN if 630 < x < 710 and self.button: if 360 < y < 370: setsong(self.midi, bar=-1) elif 390 < y < 400: setsong(self.midi, action='pause') self.pause = not self.pause elif 420 < y < 430: setsong(self.midi, bar=+1) return elif x >= 608: return channel = x // 38 info = channelinfo(self.midi, channel) if info['used']: if self.button: if 6 < y < 18: self.muted[channel] = not self.muted[channel] self.change_mute_state(channel) elif 20 < y < 32: self.change_solo_state(channel) else: self.selection = channel
def keyboard_func(self, key, x, y): if key == b'\x1b': setsong(self.midi, action='exit') sys.exit(0) elif key == b'\t': if self.selection is not None: self.selection = (self.selection + 1) % 16 else: self.selection = 0 info = channelinfo(self.midi, self.selection) while not info['used']: self.selection = (self.selection + 1) % 16 info = channelinfo(self.midi, self.selection) elif key == b' ': setsong(self.midi, action='pause') self.pause = not self.pause elif key in b'1234567890!@#$%^': channel = b'1234567890!@#$%^'.index(key) self.muted[channel] = not self.muted[channel] self.change_mute_state(channel) elif key == b'a': for channel in range(16): self.muted[channel] = self.solo[channel] = False self.change_mute_state(channel) elif key == b'd': self.muted[9] = not self.muted[9] self.change_mute_state(9) elif key == b'D': self.change_solo_state(9) elif key in MUTE_ON_OFF: for channel in range(16): info = channelinfo(self.midi, channel) if channel != 9 and info['family'] in MUTE_ON_OFF[key]: self.muted[channel] = not self.muted[channel] self.change_mute_state(channel) elif key in SOLO_ON: for channel in range(16): info = channelinfo(self.midi, channel) if channel != 9 and info['family'] in SOLO_ON[key]: self.muted[channel] = False else: self.muted[channel] = True self.solo[channel] = False self.change_mute_state(channel) elif key == b'<': setsong(self.midi, shift=-1) elif key == b'>': setsong(self.midi, shift=+1) elif key == b'-': setsong(self.midi, bpm=-1) elif key == b'+': setsong(self.midi, bpm=+1)