diff --git a/src/common/consts.py b/src/common/consts.py index f1de21ad..b8be008e 100644 --- a/src/common/consts.py +++ b/src/common/consts.py @@ -11,13 +11,13 @@ """ # Version info -VERSION = (1, 2, 2) +VERSION = (1, 2, 3) # Sub versions VERSION_MAJOR = VERSION[0] VERSION_MINOR = VERSION[1] VERSION_REVISION = VERSION[2] -VERSION_SUFFIX = "" +VERSION_SUFFIX = "beta-1" # Minimum API version required to run script MIN_API_VERSION = 19 diff --git a/src/plugs/special/manual_mapper.py b/src/plugs/special/manual_mapper.py index 2d857803..45b95dc8 100644 --- a/src/plugs/special/manual_mapper.py +++ b/src/plugs/special/manual_mapper.py @@ -13,10 +13,13 @@ This code is licensed under the GPL v3 license. Refer to the LICENSE file for more details. """ + from typing import Optional import device import general import midi +from common.logger import verbosity +from common.logger.logger import log from common.types import Color from common.extension_manager import ExtensionManager from control_surfaces import ( @@ -52,32 +55,44 @@ class ManualMapper(SpecialPlugin): def __init__(self, shadow: DeviceShadow) -> None: shadow.setMinimal(True) self._faders_start = 0 - self._knobs_start = len(shadow.bindMatches( - # https://github.com/python/mypy/issues/4717 is the bane of my - # existence - GenericFader, # type: ignore - self.eFaders, - self.tFaders, - allow_substitution=False, - one_type=False, - args_generator=..., - )) - self._encoders_start = len(shadow.bindMatches( - Encoder, - self.eEncoders, - self.tEncoders, - allow_substitution=False, - one_type=False, - args_generator=..., - )) + self._knobs_start - self._mods_start = len(shadow.bindMatches( - GenericKnob, # type: ignore - self.eKnobs, - self.tKnobs, - allow_substitution=False, - one_type=False, - args_generator=..., - )) + self._encoders_start + self._knobs_start = len( + shadow.bindMatches( + # https://github.com/python/mypy/issues/4717 is the bane of my + # existence + GenericFader, # type: ignore + self.eFaders, + self.tFaders, + allow_substitution=False, + one_type=False, + args_generator=..., + ) + ) + self._encoders_start = ( + len( + shadow.bindMatches( + Encoder, + self.eEncoders, + self.tEncoders, + allow_substitution=False, + one_type=False, + args_generator=..., + ) + ) + + self._knobs_start + ) + self._mods_start = ( + len( + shadow.bindMatches( + GenericKnob, # type: ignore + self.eKnobs, + self.tKnobs, + allow_substitution=False, + one_type=False, + args_generator=..., + ) + ) + + self._encoders_start + ) shadow.bindMatches( ModXY, self.eMods, @@ -88,7 +103,7 @@ def __init__(self, shadow: DeviceShadow) -> None: super().__init__(shadow, []) @classmethod - def create(cls, shadow: DeviceShadow) -> 'SpecialPlugin': + def create(cls, shadow: DeviceShadow) -> "SpecialPlugin": return cls(shadow) @classmethod @@ -167,10 +182,19 @@ def tickEvent(cls, control: ControlShadow, c_index: int): event_id = cls.calcEventId(channel, cc) # If that event ID isn't invalid if event_id is not None: - control.connected = True - control.annotation = device.getLinkedParamName(event_id) - control.color = Color.ENABLED - control.value = device.getLinkedValue(event_id) + try: + control.connected = True + control.annotation = device.getLinkedParamName(event_id) + control.color = Color.ENABLED + control.value = device.getLinkedValue(event_id) + except RuntimeError as e: + log( + "plugs.special.manual_mapper", + "error when ticking linked param", + verbosity.ERROR, + f"Event ID was {event_id}, exception was {e}", + ) + control.connected = False else: control.connected = False