minor changes

minor changes
This commit is contained in:
onyx-and-iris 2022-06-18 11:12:33 +01:00
parent 482c197f70
commit 0f8615715c
3 changed files with 14 additions and 16 deletions

View File

@ -11,9 +11,6 @@ class TOMLStrBuilder:
def __init__(self, kind): def __init__(self, kind):
self.kind = kind self.kind = kind
self.phys_in, self.virt_in = kind.ins
self.phys_out, self.virt_out = kind.outs
self.higher = itertools.chain( self.higher = itertools.chain(
[f"strip-{i}" for i in range(kind.num_strip)], [f"strip-{i}" for i in range(kind.num_strip)],
[f"bus-{i}" for i in range(kind.num_bus)], [f"bus-{i}" for i in range(kind.num_bus)],
@ -27,8 +24,8 @@ class TOMLStrBuilder:
"solo = false", "solo = false",
"gain = 0.0", "gain = 0.0",
] ]
+ [f"A{i} = false" for i in range(1, self.phys_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.virt_out + 1)] + [f"B{i} = false" for i in range(1, self.kind.virt_out + 1)]
) )
self.phys_strip_params = self.virt_strip_params + [ self.phys_strip_params = self.virt_strip_params + [
"comp = 0.0", "comp = 0.0",
@ -61,7 +58,7 @@ class TOMLStrBuilder:
case "strip": case "strip":
toml_str += ("\n").join( toml_str += ("\n").join(
self.phys_strip_params self.phys_strip_params
if int(index) < self.phys_in if int(index) < self.kind.phys_in
else self.virt_strip_params else self.virt_strip_params
) )
case "bus": case "bus":

View File

@ -18,10 +18,10 @@ class Recorder(IRemote):
Returns a Recorder class of a kind. Returns a Recorder class of a kind.
""" """
ChannelMixin = _channel_mixins[remote.kind.name] CHANNELOUTMIXIN_cls = _make_channelout_mixins[remote.kind.name]
REC_cls = type( REC_cls = type(
f"Recorder{remote.kind}", f"Recorder{remote.kind}",
(cls, ChannelMixin), (cls, CHANNELOUTMIXIN_cls),
{ {
**{ **{
param: action_prop(param) param: action_prop(param)
@ -60,17 +60,18 @@ class Recorder(IRemote):
loop = property(fset=set_loop) loop = property(fset=set_loop)
def _make_channel_mixin(kind): def _make_channelout_mixin(kind):
"""Creates a channel out property mixin""" """Creates a channel out property mixin"""
num_A, num_B = kind.outs
return type( 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"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, num_B + 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
}

View File

@ -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 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 Returns a physical or virtual strip subclass
""" """
STRIP_cls = PhysicalStrip if is_phys_strip else VirtualStrip 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) _kls = (STRIP_cls, CHANNELOUTMIXIN_cls)
if remote.kind.name == "potato": if remote.kind.name == "potato":