make mido parser a class var
This commit is contained in:
parent
3e123bc751
commit
0f3ab79bdb
1 changed files with 4 additions and 5 deletions
9
mixer.py
9
mixer.py
|
@ -11,6 +11,7 @@ class Mixer:
|
|||
def __init__(self, ip):
|
||||
self.MIXER_PORT = 51325
|
||||
self.sock = socket.create_connection((ip, self.MIXER_PORT))
|
||||
self.mido_parser = mido.Parser()
|
||||
|
||||
ALLEN_HEATH_ID = [0x00, 0x00, 0x1A]
|
||||
QU_MIXER = [0x50, 0x11]
|
||||
|
@ -28,18 +29,16 @@ class Mixer:
|
|||
GET_METER_DATA_RESPONSE = 0x13
|
||||
|
||||
def recv_sys_ex(self, response_msg_filter: SysExMessageId = None):
|
||||
p = mido.Parser()
|
||||
|
||||
while True:
|
||||
data = self.sock.recv(1024)
|
||||
|
||||
if not data:
|
||||
break
|
||||
|
||||
p.feed(data)
|
||||
self.mido_parser.feed(data)
|
||||
|
||||
if p.pending():
|
||||
msg = p.get_message()
|
||||
if self.mido_parser.pending():
|
||||
msg = self.mido_parser.get_message()
|
||||
|
||||
print(vars(msg))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue