diff --git a/voicemeeterlib/config.py b/voicemeeterlib/config.py index 678c288..f27c746 100644 --- a/voicemeeterlib/config.py +++ b/voicemeeterlib/config.py @@ -11,9 +11,6 @@ class TOMLStrBuilder: def __init__(self, kind): self.kind = kind - self.phys_in, self.virt_in = kind.ins - self.phys_out, self.virt_out = kind.outs - self.higher = itertools.chain( [f"strip-{i}" for i in range(kind.num_strip)], [f"bus-{i}" for i in range(kind.num_bus)], @@ -27,8 +24,8 @@ class TOMLStrBuilder: "solo = false", "gain = 0.0", ] - + [f"A{i} = false" for i in range(1, self.phys_out + 1)] - + [f"B{i} = false" for i in range(1, self.virt_out + 1)] + + [f"A{i} = false" for i in range(1, self.kind.phys_out + 1)] + + [f"B{i} = false" for i in range(1, self.kind.virt_out + 1)] ) self.phys_strip_params = self.virt_strip_params + [ "comp = 0.0", @@ -61,7 +58,7 @@ class TOMLStrBuilder: case "strip": toml_str += ("\n").join( self.phys_strip_params - if int(index) < self.phys_in + if int(index) < self.kind.phys_in else self.virt_strip_params ) case "bus": diff --git a/voicemeeterlib/recorder.py b/voicemeeterlib/recorder.py index 3d0dcff..61651f3 100644 --- a/voicemeeterlib/recorder.py +++ b/voicemeeterlib/recorder.py @@ -18,10 +18,10 @@ class Recorder(IRemote): Returns a Recorder class of a kind. """ - ChannelMixin = _channel_mixins[remote.kind.name] + CHANNELOUTMIXIN_cls = _make_channelout_mixins[remote.kind.name] REC_cls = type( f"Recorder{remote.kind}", - (cls, ChannelMixin), + (cls, CHANNELOUTMIXIN_cls), { **{ param: action_prop(param) @@ -60,17 +60,18 @@ class Recorder(IRemote): loop = property(fset=set_loop) -def _make_channel_mixin(kind): +def _make_channelout_mixin(kind): """Creates a channel out property mixin""" - num_A, num_B = kind.outs return type( - f"ChannelMixin{kind.name}", + f"ChannelOutMixin{kind}", (), { - **{f"A{i}": bool_prop(f"A{i}") for i in range(1, num_A + 1)}, - **{f"B{i}": bool_prop(f"B{i}") for i in range(1, num_B + 1)}, + **{f"A{i}": bool_prop(f"A{i}") for i in range(1, kind.phys_out + 1)}, + **{f"B{i}": bool_prop(f"B{i}") for i in range(1, kind.virt_out + 1)}, }, ) -_channel_mixins = {kind.name: _make_channel_mixin(kind) for kind in kinds_all} +_make_channelout_mixins = { + kind.name: _make_channelout_mixin(kind) for kind in kinds_all +} diff --git a/voicemeeterlib/strip.py b/voicemeeterlib/strip.py index 8ac723c..5dbadac 100644 --- a/voicemeeterlib/strip.py +++ b/voicemeeterlib/strip.py @@ -282,7 +282,7 @@ def _make_channelout_mixin(kind): ) -__make_channelout_mixins = { +_make_channelout_mixins = { kind.name: _make_channelout_mixin(kind) for kind in kinds_all } @@ -296,7 +296,7 @@ def strip_factory(is_phys_strip, remote, i) -> Union[PhysicalStrip, VirtualStrip Returns a physical or virtual strip subclass """ STRIP_cls = PhysicalStrip if is_phys_strip else VirtualStrip - CHANNELOUTMIXIN_cls = __make_channelout_mixins[remote.kind.name] + CHANNELOUTMIXIN_cls = _make_channelout_mixins[remote.kind.name] _kls = (STRIP_cls, CHANNELOUTMIXIN_cls) if remote.kind.name == "potato":