diff --git a/voicemeeterlib/bus.py b/voicemeeterlib/bus.py index 672921b..5148ba0 100644 --- a/voicemeeterlib/bus.py +++ b/voicemeeterlib/bus.py @@ -4,8 +4,8 @@ from enum import IntEnum from math import log from typing import Union +from . import kinds from .iremote import IRemote -from .kinds import kinds_all from .meta import bus_mode_prop, device_prop, float_prop BusModes = IntEnum( @@ -248,7 +248,7 @@ def make_bus_level_map(kind): return tuple((i, i + 8) for i in range(0, (kind.phys_out + kind.virt_out) * 8, 8)) -_make_bus_level_maps = {kind.name: make_bus_level_map(kind) for kind in kinds_all} +_make_bus_level_maps = {kind.name: make_bus_level_map(kind) for kind in kinds.all} def _make_bus_mode_mixin(): diff --git a/voicemeeterlib/kinds.py b/voicemeeterlib/kinds.py index baf1c75..8d6c7c0 100644 --- a/voicemeeterlib/kinds.py +++ b/voicemeeterlib/kinds.py @@ -22,7 +22,7 @@ class SingletonType(type): return cls._instances[cls] -@dataclass +@dataclass(frozen=True) class KindMapClass(metaclass=SingletonType): name: str ins: tuple @@ -68,9 +68,8 @@ class KindMapClass(metaclass=SingletonType): return self.name.capitalize() -@dataclass +@dataclass(frozen=True) class BasicMap(KindMapClass): - name: str ins: tuple = (2, 1) outs: tuple = (1, 1) vban: tuple = (4, 4, 1, 1) @@ -79,9 +78,8 @@ class BasicMap(KindMapClass): composite: int = 0 -@dataclass +@dataclass(frozen=True) class BananaMap(KindMapClass): - name: str ins: tuple = (3, 2) outs: tuple = (3, 2) vban: tuple = (8, 8, 1, 1) @@ -90,9 +88,8 @@ class BananaMap(KindMapClass): composite: int = 8 -@dataclass +@dataclass(frozen=True) class PotatoMap(KindMapClass): - name: str ins: tuple = (5, 3) outs: tuple = (5, 3) vban: tuple = (8, 8, 1, 1) @@ -123,4 +120,4 @@ def request_kind_map(kind_id): return KIND_obj -kinds_all = list(request_kind_map(kind_id.name.lower()) for kind_id in KindId) +all = kinds_all = [request_kind_map(kind_id.name.lower()) for kind_id in KindId] diff --git a/voicemeeterlib/misc.py b/voicemeeterlib/misc.py index 9584d1a..4f0f520 100644 --- a/voicemeeterlib/misc.py +++ b/voicemeeterlib/misc.py @@ -1,7 +1,7 @@ from typing import Optional +from . import kinds from .iremote import IRemote -from .kinds import kinds_all class FX(IRemote): @@ -133,7 +133,7 @@ def _make_asio_mixin(remote, kind): def _make_asio_mixins(remote): - return {kind.name: _make_asio_mixin(remote, kind) for kind in kinds_all} + return {kind.name: _make_asio_mixin(remote, kind) for kind in kinds.all} class Composite(IRemote): diff --git a/voicemeeterlib/recorder.py b/voicemeeterlib/recorder.py index 512df56..c37901f 100644 --- a/voicemeeterlib/recorder.py +++ b/voicemeeterlib/recorder.py @@ -1,8 +1,8 @@ import re +from . import kinds from .error import VMError from .iremote import IRemote -from .kinds import kinds_all from .meta import action_fn, bool_prop @@ -222,7 +222,7 @@ def _make_armchannel_mixin(remote, kind): def _make_armchannel_mixins(remote): - return {kind.name: _make_armchannel_mixin(remote, kind) for kind in kinds_all} + return {kind.name: _make_armchannel_mixin(remote, kind) for kind in kinds.all} def _make_channelout_mixin(kind): @@ -238,5 +238,5 @@ def _make_channelout_mixin(kind): _make_channelout_mixins = { - kind.name: _make_channelout_mixin(kind) for kind in kinds_all + kind.name: _make_channelout_mixin(kind) for kind in kinds.all } diff --git a/voicemeeterlib/remote.py b/voicemeeterlib/remote.py index 6c36c4e..5c63897 100644 --- a/voicemeeterlib/remote.py +++ b/voicemeeterlib/remote.py @@ -288,7 +288,10 @@ class Remote(CBindings): target = getattr(self, kls) case [ "vban", - "in" | "instream" | "out" | "outstream" as direction, + "in" + | "instream" + | "out" + | "outstream" as direction, index, ] if index.isnumeric(): target = getattr( diff --git a/voicemeeterlib/strip.py b/voicemeeterlib/strip.py index 7ae8645..0897d69 100644 --- a/voicemeeterlib/strip.py +++ b/voicemeeterlib/strip.py @@ -3,8 +3,8 @@ from abc import abstractmethod from math import log from typing import Union +from . import kinds from .iremote import IRemote -from .kinds import kinds_all from .meta import bool_prop, device_prop, float_prop @@ -467,7 +467,7 @@ def make_strip_level_map(kind): return phys_map + virt_map -_make_strip_level_maps = {kind.name: make_strip_level_map(kind) for kind in kinds_all} +_make_strip_level_maps = {kind.name: make_strip_level_map(kind) for kind in kinds.all} class GainLayer(IRemote): @@ -514,7 +514,7 @@ def _make_channelout_mixin(kind): _make_channelout_mixins = { - kind.name: _make_channelout_mixin(kind) for kind in kinds_all + kind.name: _make_channelout_mixin(kind) for kind in kinds.all } @@ -569,7 +569,7 @@ def _make_effects_mixin(kind, is_phys): def _make_effects_mixins(is_phys): - return {kind.name: _make_effects_mixin(kind, is_phys) for kind in kinds_all} + return {kind.name: _make_effects_mixin(kind, is_phys) for kind in kinds.all} def strip_factory(is_phys_strip, remote, i) -> Union[PhysicalStrip, VirtualStrip]: diff --git a/voicemeeterlib/vban.py b/voicemeeterlib/vban.py index f3dece2..7c27a61 100644 --- a/voicemeeterlib/vban.py +++ b/voicemeeterlib/vban.py @@ -1,7 +1,7 @@ from abc import abstractmethod +from . import kinds from .iremote import IRemote -from .kinds import kinds_all class VbanStream(IRemote): @@ -194,7 +194,7 @@ def _make_stream_pair(remote, kind): def _make_stream_pairs(remote): - return {kind.name: _make_stream_pair(remote, kind) for kind in kinds_all} + return {kind.name: _make_stream_pair(remote, kind) for kind in kinds.all} class Vban: