diff --git a/mixer.py b/mixer.py index 29966b2..aca7804 100755 --- a/mixer.py +++ b/mixer.py @@ -12,11 +12,11 @@ class Mixer: def __init__(self, ip, port): self.sock = socket.create_connection((ip, port)) - A_H_ID = [0x00, 0x00, 0x1A] + ALLEN_HEATH_ID = [0x00, 0x00, 0x1A] QU_MIXER = [0x50, 0x11] MAJOR_MINOR = [0x01, 0x00] ALL_CALL_MIDI_CHANNEL = [0x7F] - SYSEX_HEADER = A_H_ID + QU_MIXER + MAJOR_MINOR + SYSEX_HEADER = ALLEN_HEATH_ID + QU_MIXER + MAJOR_MINOR SYSEX_ALL_CALL = SYSEX_HEADER + ALL_CALL_MIDI_CHANNEL def recv(self): @@ -117,7 +117,7 @@ class Mixer: msg_bytes = bytes(a.bytes() + b.bytes() + c.bytes() + d.bytes()) - print (' '.join(f"{b:02X}" for b in msg_bytes)) + print(' '.join(f"{b:02X}" for b in msg_bytes)) self.sock.sendall(msg_bytes) def shutdown(self): @@ -161,29 +161,30 @@ def main(): if args.command: print(f"Command: {args.command}") - if args.command == 'get_name_from_qu': - mixer = Mixer(args.ip, MIXER_PORT) - mixer.get_name_from_qu(0) + match args.command: + case 'get_name_from_qu': + mixer = Mixer(args.ip, MIXER_PORT) + mixer.get_name_from_qu(0) - if args.command == 'get_system_state': - mixer = Mixer(args.ip, MIXER_PORT) - mixer.get_system_state() + case 'get_system_state': + mixer = Mixer(args.ip, MIXER_PORT) + mixer.get_system_state() - if args.command == 'shutdown': - mixer = Mixer(args.ip, MIXER_PORT) - mixer.shutdown() + case 'shutdown': + mixer = Mixer(args.ip, MIXER_PORT) + mixer.shutdown() - if args.command == 'set_default_layer': - mixer = Mixer(args.ip, MIXER_PORT) - # mixer.set_layer() + case 'set_default_layer': + mixer = Mixer(args.ip, MIXER_PORT) + mixer.scene_recall(0) - if args.command == 'watch': - mixer = Mixer(args.ip, MIXER_PORT) - mixer.watch() + case 'watch': + mixer = Mixer(args.ip, MIXER_PORT) + mixer.watch() - if args.command == 'scene_recall': - mixer = Mixer(args.ip, MIXER_PORT) - mixer.scene_recall(0) + case 'scene_recall': + mixer = Mixer(args.ip, MIXER_PORT) + mixer.scene_recall(0) if __name__ == '__main__': main()