Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/common/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
86 changes: 55 additions & 31 deletions src/plugs/special/manual_mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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,
Expand All @@ -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
Expand Down Expand Up @@ -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

Expand Down