num_strip_levels, num_bus_levesl added to KindMaps

This commit is contained in:
onyx-and-iris 2023-07-20 11:10:05 +01:00
parent 68177c3c6c
commit f996fc0d9c
3 changed files with 24 additions and 22 deletions

View File

@ -32,29 +32,37 @@ class KindMapClass(metaclass=SingletonType):
insert: int insert: int
@property @property
def phys_in(self): def phys_in(self) -> int:
return self.ins[0] return self.ins[0]
@property @property
def virt_in(self): def virt_in(self) -> int:
return self.ins[-1] return self.ins[-1]
@property @property
def phys_out(self): def phys_out(self) -> int:
return self.outs[0] return self.outs[0]
@property @property
def virt_out(self): def virt_out(self) -> int:
return self.outs[-1] return self.outs[-1]
@property @property
def num_strip(self): def num_strip(self) -> int:
return sum(self.ins) return sum(self.ins)
@property @property
def num_bus(self): def num_bus(self) -> int:
return sum(self.outs) return sum(self.outs)
@property
def num_strip_levels(self) -> int:
return 2 * self.phys_in + 8 * self.virt_in
@property
def num_bus_levels(self) -> int:
return 8 * (self.phys_out + self.virt_out)
def __str__(self) -> str: def __str__(self) -> str:
return self.name.capitalize() return self.name.capitalize()

View File

@ -1,4 +1,3 @@
import copy
import ctypes as ct import ctypes as ct
import logging import logging
import time import time
@ -244,12 +243,9 @@ class Remote(CBindings):
return ( return (
tuple( tuple(
self.get_level(self.strip_mode, i) self.get_level(self.strip_mode, i)
for i in range(2 * self.kind.phys_in + 8 * self.kind.virt_in) for i in range(self.kind.num_strip_levels)
),
tuple(
self.get_level(3, i)
for i in range(8 * (self.kind.phys_out + self.kind.virt_out))
), ),
tuple(self.get_level(3, i) for i in range(self.kind.num_bus_levels)),
) )
def get_midi_message(self): def get_midi_message(self):
@ -325,16 +321,16 @@ class Remote(CBindings):
self.apply(config) self.apply(config)
self.logger.info(f"Profile '{name}' applied!") self.logger.info(f"Profile '{name}' applied!")
def logout(self) -> NoReturn:
"""Wait for dirty parameters to clear, then logout of the API"""
time.sleep(0.1)
self.call(self.vm_logout)
self.logger.info(f"{type(self).__name__}: Successfully logged out of {self}")
def end_thread(self): def end_thread(self):
self.logger.debug("events thread shutdown started") self.logger.debug("events thread shutdown started")
self.running = False self.running = False
def logout(self) -> NoReturn:
"""Logout of the API"""
time.sleep(0.1)
self.call(self.vm_logout)
self.logger.info(f"{type(self).__name__}: Successfully logged out of {self}")
def __exit__(self, exc_type, exc_value, exc_traceback) -> NoReturn: def __exit__(self, exc_type, exc_value, exc_traceback) -> NoReturn:
"""teardown procedures""" """teardown procedures"""
self.end_thread() self.end_thread()

View File

@ -36,10 +36,8 @@ class Updater(threading.Thread):
super().__init__(name="updater", daemon=True) super().__init__(name="updater", daemon=True)
self._remote = remote self._remote = remote
self.queue = queue self.queue = queue
self._remote._strip_comp = [False] * ( self._remote._strip_comp = [False] * (self._remote.kind.num_strip_levels)
2 * self._remote.kind.phys_in + 8 * self._remote.kind.virt_in self._remote._bus_comp = [False] * (self._remote.kind.num_bus_levels)
)
self._remote._bus_comp = [False] * (self._remote.kind.num_bus * 8)
( (
self._remote.cache["strip_level"], self._remote.cache["strip_level"],
self._remote.cache["bus_level"], self._remote.cache["bus_level"],