Close MIDI ports properly in the pad editor.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3992744a1d
commit
82e75e69de
1 file changed
+5
-3
+5
-3
@@ -103,8 +103,9 @@ class Link:
|
|||||||
self.midiout.open_port(index)
|
self.midiout.open_port(index)
|
||||||
|
|
||||||
def close(self) -> None:
|
def close(self) -> None:
|
||||||
self.midiout.close_port()
|
for port in (self.midiout, self.midiin):
|
||||||
self.midiin.close_port()
|
port.close_port()
|
||||||
|
port.delete()
|
||||||
|
|
||||||
def read(self, address: int, size: int, memory: int = MEM_PRESET) -> bytes:
|
def read(self, address: int, size: int, memory: int = MEM_PRESET) -> bytes:
|
||||||
reply = transact(self.midiout, self.midiin, read_request(address, size, memory), expect=CMD_READ)
|
reply = transact(self.midiout, self.midiin, read_request(address, size, memory), expect=CMD_READ)
|
||||||
@@ -145,7 +146,7 @@ def _port_names(kind: str) -> list[str]:
|
|||||||
try:
|
try:
|
||||||
return list(probe.get_ports())
|
return list(probe.get_ports())
|
||||||
finally:
|
finally:
|
||||||
del probe
|
probe.delete()
|
||||||
|
|
||||||
|
|
||||||
def read_port_names() -> list[str]:
|
def read_port_names() -> list[str]:
|
||||||
@@ -309,6 +310,7 @@ def _listen_cc(rtmidi, port_name: str, listen: float) -> list[tuple[int, int, in
|
|||||||
found.append((data[0] & 0x0F, data[1], data[2]))
|
found.append((data[0] & 0x0F, data[1], data[2]))
|
||||||
finally:
|
finally:
|
||||||
midiin.close_port()
|
midiin.close_port()
|
||||||
|
midiin.delete()
|
||||||
return found
|
return found
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user