def change_solo_state(self, channel): self.solo[channel] = not self.solo[channel] if self.solo[channel]: setchannel(self.midi, channel, solo=self.solo[channel]) for ch in range(16): self.muted[ch] = True if ch != channel else False self.solo[ch] = True if ch == channel else False else: for ch in range(16): self.muted[ch] = False setchannel(self.midi, ch, muted=False)
def change_instrument(self, value): if self.selection: setchannel(self.midi, self.selection, instrument=value) return 0
def motion_func(self, x, y): if x >= 608: return channel = x // 38 if self.button: if 34 <= y < 34 + 5 * 58: y -= 34 value = 63.5 + atan2(x % 38 - 19, 17 - y % 58) / pi * 127 / 1.5 value = int(min(max(value, 0), 127)) knob = y // 58 if knob == 0: setchannel(self.midi, channel, sense=value) elif knob == 1: setchannel(self.midi, channel, delay=value) elif knob == 2: setchannel(self.midi, channel, chorus=value) elif knob == 3: setchannel(self.midi, channel, reverb=value) elif knob == 4: setchannel(self.midi, channel, pan=value) elif 358 < y < 430: value = min(max((425 - y) * 2, 0), 127) setchannel(self.midi, channel, level=value)
def change_mute_state(self, channel): setchannel(self.midi, channel, muted=self.muted[channel])