diff --git a/voicemeeterlib/bus.py b/voicemeeterlib/bus.py index fb702c0..0da0004 100644 --- a/voicemeeterlib/bus.py +++ b/voicemeeterlib/bus.py @@ -95,13 +95,12 @@ class BusEQ(IRemote): Returns a BusEQ class. """ - kls = (cls,) BusEQ_cls = type( 'BusEQ', - kls, + (cls,), { 'channel': tuple( - BusEQCh.make(remote, i, j) for j in range(remote.kind.channels) + BusEQCh.make(remote, i, j) for j in range(remote.kind.bus_channels) ) }, ) @@ -136,10 +135,9 @@ class BusEQCh(IRemote): Returns a BusEQCh class. """ - kls = (cls,) BusEQCh_cls = type( 'BusEQCh', - kls, + (cls,), { 'cell': tuple( BusEQChCell(remote, i, j, k) for k in range(remote.kind.cells) diff --git a/voicemeeterlib/kinds.py b/voicemeeterlib/kinds.py index ab73065..86887f5 100644 --- a/voicemeeterlib/kinds.py +++ b/voicemeeterlib/kinds.py @@ -31,7 +31,8 @@ class KindMapClass(metaclass=SingletonType): asio: tuple insert: int composite: int - channels: int + strip_channels: int + bus_channels: int cells: int @property @@ -78,7 +79,8 @@ class BasicMap(KindMapClass): asio: tuple = (0, 0) insert: int = 0 composite: int = 0 - channels: int = 0 + strip_channels: int = 0 + bus_channels: int = 0 cells: int = 0 @@ -90,7 +92,8 @@ class BananaMap(KindMapClass): asio: tuple = (6, 8) insert: int = 22 composite: int = 8 - channels: int = 8 + strip_channels: int = 0 + bus_channels: int = 8 cells: int = 6 @@ -102,7 +105,8 @@ class PotatoMap(KindMapClass): asio: tuple = (10, 8) insert: int = 34 composite: int = 8 - channels: int = 8 + strip_channels: int = 2 + bus_channels: int = 8 cells: int = 6 diff --git a/voicemeeterlib/strip.py b/voicemeeterlib/strip.py index 2929792..a5021cd 100644 --- a/voicemeeterlib/strip.py +++ b/voicemeeterlib/strip.py @@ -96,7 +96,7 @@ class PhysicalStrip(Strip): 'comp': StripComp(remote, i), 'gate': StripGate(remote, i), 'denoiser': StripDenoiser(remote, i), - 'eq': StripEQ(remote, i), + 'eq': StripEQ.make(remote, i), 'device': StripDevice.make(remote, i), }, ) @@ -268,6 +268,25 @@ class StripDenoiser(IRemote): class StripEQ(IRemote): + @classmethod + def make(cls, remote, i): + """ + Factory method for Strip EQ. + + Returns a StripEQ class. + """ + STRIPEQ_cls = type( + 'StripEQ', + (cls,), + { + 'channel': tuple( + StripEQCh.make(remote, i, j) + for j in range(remote.kind.strip_channels) + ) + }, + ) + return STRIPEQ_cls(remote, i) + @property def identifier(self) -> str: return f'Strip[{self.index}].eq' @@ -289,6 +308,85 @@ class StripEQ(IRemote): self.setter('ab', 1 if val else 0) +class StripEQCh(IRemote): + @classmethod + def make(cls, remote, i, j): + """ + Factory method for Strip EQ channel. + + Returns a StripEQCh class. + """ + StripEQCh_cls = type( + 'StripEQCh', + (cls,), + { + 'cell': tuple( + StripEQChCell(remote, i, j, k) for k in range(remote.kind.cells) + ) + }, + ) + return StripEQCh_cls(remote, i, j) + + def __init__(self, remote, i, j): + super().__init__(remote, i) + self.channel_index = j + + @property + def identifier(self) -> str: + return f'Strip[{self.index}].eq.channel[{self.channel_index}]' + + +class StripEQChCell(IRemote): + def __init__(self, remote, i, j, k): + super().__init__(remote, i) + self.channel_index = j + self.cell_index = k + + @property + def identifier(self) -> str: + return f'Strip[{self.index}].eq.channel[{self.channel_index}].cell[{self.cell_index}]' + + @property + def on(self) -> bool: + return self.getter('on') == 1 + + @on.setter + def on(self, val: bool): + self.setter('on', 1 if val else 0) + + @property + def type(self) -> int: + return int(self.getter('type')) + + @type.setter + def type(self, val: int): + self.setter('type', val) + + @property + def f(self) -> float: + return round(self.getter('f'), 1) + + @f.setter + def f(self, val: float): + self.setter('f', val) + + @property + def gain(self) -> float: + return round(self.getter('gain'), 1) + + @gain.setter + def gain(self, val: float): + self.setter('gain', val) + + @property + def q(self) -> float: + return round(self.getter('q'), 1) + + @q.setter + def q(self, val: float): + self.setter('q', val) + + class StripDevice(IRemote): @classmethod def make(cls, remote, i):