Compare commits

...

3 commits

Author SHA1 Message Date
1c5ca4fdfd implement set_default_mixer command 2025-09-18 21:34:16 +02:00
04413f58e1 use match / case syntax 2025-09-18 21:26:21 +02:00
77ef79433c A_H -> ALLEN_HEATH 2025-09-18 21:20:48 +02:00

View file

@ -12,11 +12,11 @@ class Mixer:
def __init__(self, ip, port): def __init__(self, ip, port):
self.sock = socket.create_connection((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] QU_MIXER = [0x50, 0x11]
MAJOR_MINOR = [0x01, 0x00] MAJOR_MINOR = [0x01, 0x00]
ALL_CALL_MIDI_CHANNEL = [0x7F] 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 SYSEX_ALL_CALL = SYSEX_HEADER + ALL_CALL_MIDI_CHANNEL
def recv(self): def recv(self):
@ -117,7 +117,7 @@ class Mixer:
msg_bytes = bytes(a.bytes() + b.bytes() + c.bytes() + d.bytes()) 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) self.sock.sendall(msg_bytes)
def shutdown(self): def shutdown(self):
@ -161,29 +161,30 @@ def main():
if args.command: if args.command:
print(f"Command: {args.command}") print(f"Command: {args.command}")
if args.command == 'get_name_from_qu': match args.command:
mixer = Mixer(args.ip, MIXER_PORT) case 'get_name_from_qu':
mixer.get_name_from_qu(0) mixer = Mixer(args.ip, MIXER_PORT)
mixer.get_name_from_qu(0)
if args.command == 'get_system_state': case 'get_system_state':
mixer = Mixer(args.ip, MIXER_PORT) mixer = Mixer(args.ip, MIXER_PORT)
mixer.get_system_state() mixer.get_system_state()
if args.command == 'shutdown': case 'shutdown':
mixer = Mixer(args.ip, MIXER_PORT) mixer = Mixer(args.ip, MIXER_PORT)
mixer.shutdown() mixer.shutdown()
if args.command == 'set_default_layer': case 'set_default_layer':
mixer = Mixer(args.ip, MIXER_PORT) mixer = Mixer(args.ip, MIXER_PORT)
# mixer.set_layer() mixer.scene_recall(0)
if args.command == 'watch': case 'watch':
mixer = Mixer(args.ip, MIXER_PORT) mixer = Mixer(args.ip, MIXER_PORT)
mixer.watch() mixer.watch()
if args.command == 'scene_recall': case 'scene_recall':
mixer = Mixer(args.ip, MIXER_PORT) mixer = Mixer(args.ip, MIXER_PORT)
mixer.scene_recall(0) mixer.scene_recall(0)
if __name__ == '__main__': if __name__ == '__main__':
main() main()