Mercurial > code > home > repos > light9
changeset 2327:bbd79e655114
don't let ports get deleted
author | drewp@bigasterisk.com |
---|---|
date | Thu, 01 Jun 2023 18:32:03 -0700 |
parents | e9caffe926df |
children | d050b8efda9d |
files | light9/midifade/midifade.py |
diffstat | 1 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/light9/midifade/midifade.py Thu Jun 01 18:30:25 2023 -0700 +++ b/light9/midifade/midifade.py Thu Jun 01 18:32:03 2023 -0700 @@ -87,7 +87,7 @@ await asyncio.sleep(1 / MAX_SEND_RATE) asyncio.create_task(reader()) - + openPorts = [] for inputName in mido.get_input_names(): if inputName.startswith('Keystation'): dev = "keystation" @@ -98,7 +98,11 @@ else: continue log.info(f'listening on input {inputName} {dev=}') - port = mido.open_input(inputName, callback=lambda message: onMessageMidoThread(dev, message)) + openPorts.append( + mido.open_input(# + inputName,# + callback=lambda message, dev=dev: onMessageMidoThread(dev, message)) + ) while True: await asyncio.sleep(1)