mirror of
https://github.com/onyx-and-iris/vban-cmd-python.git
synced 2025-01-30 23:00:51 +00:00
add modevals to Modes class.
add modevals to Modes class.
This commit is contained in:
parent
6aeef19d38
commit
919c967023
@ -54,6 +54,14 @@ class Modes:
|
|||||||
_sel: hex=0x10000000
|
_sel: hex=0x10000000
|
||||||
_monitor: hex=0x20000000
|
_monitor: hex=0x20000000
|
||||||
|
|
||||||
|
@property
|
||||||
|
def modevals(self):
|
||||||
|
return (val for val in [
|
||||||
|
self._normal, self._amix, self._repeat, self._bmix, self._composite,
|
||||||
|
self._tvmix, self._upmix21, self._upmix41, self._upmix61, self._centeronly,
|
||||||
|
self._lfeonly, self._rearonly,
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
class Channel(abc.ABC):
|
class Channel(abc.ABC):
|
||||||
""" Base class for InputStrip and OutputBus. """
|
""" Base class for InputStrip and OutputBus. """
|
||||||
|
@ -16,28 +16,23 @@ def bus_mode_prop(param):
|
|||||||
def fget(self):
|
def fget(self):
|
||||||
data = self.public_packet
|
data = self.public_packet
|
||||||
modes = {
|
modes = {
|
||||||
'normal': (False,False,False,False,False,False,False,False,False,False,False,False),
|
'normal': (False, False, False, False, False, False, False, False, False, False, False, False),
|
||||||
'amix': (False,True,True,False,False,True,False,True,False,True,False,True),
|
'amix': (False, True, False, True, False, True, False, True, False, True, False, True),
|
||||||
'bmix': (False,True,True,True,False,True,True,True,False,True,True,True),
|
'repeat': (False, False, True, True, False, False, True, True, False, False, True, True),
|
||||||
'repeat': (False,False,True,True,False,False,True,True,False,False,True,True),
|
'bmix': (False, True, True, True, False, True, True, True, False, True, True, True),
|
||||||
'composite': (False,False,False,False,True,True,True,True,False,False,False,False),
|
'composite': (False, False, False, False, True, True, True, True, False, False, False, False),
|
||||||
'tvmix': (False,True,True,False,True,True,True,True,False,True,False,True),
|
'tvmix': (False, True, False, True, True, True, True, True, False, True, False, True),
|
||||||
'upmix21': (False,False,True,True,True,True,True,True,False,False,True,True),
|
'upmix21': (False, False, True, True, True, True, True, True, False, False, True, True),
|
||||||
'upmix41': (False,True,True,True,True,True,True,True,False,True,True,True),
|
'upmix41': (False, True, True, True, True, True, True, True, False, True, True, True),
|
||||||
'upmix61': (False,False,False,False,False,False,False,False,True,True,True,True),
|
'upmix61': (False, False, False, False, False, False, False, False, True, True, True, True),
|
||||||
'centeronly': (False,True,True,False,False,True,False,True,True,True,True,True),
|
'centeronly': (False, True, False, True, False, True, False, True, True, True, True, True),
|
||||||
'lfeonly': (False,False,True,True,False,False,True,True,True,True,True,True),
|
'lfeonly': (False, False, True, True, False, False, True, True, True, True, True, True),
|
||||||
'rearonly': (False,True,True,True,False,True,True,True,True,True,True,True),
|
'rearonly': (False, True, True, True, False, True, True, True, True, True, True, True),
|
||||||
}
|
}
|
||||||
vals = tuple(
|
vals = tuple(not int.from_bytes(data.busstate[self.index], 'little') & val == 0 for val in self._modes.modevals)
|
||||||
not int.from_bytes(data.busstate[self.index], 'little') & getattr(self._modes, f'_{param.lower()}') == 0
|
|
||||||
for param in ['normal', 'Amix', 'Bmix', 'Repeat', 'Composite', 'TVMix', 'UpMix21',
|
|
||||||
'UpMix41', 'UpMix61', 'CenterOnly', 'LFEOnly', 'RearOnly']
|
|
||||||
)
|
|
||||||
return vals == modes[param.lower()]
|
return vals == modes[param.lower()]
|
||||||
def fset(self, val):
|
def fset(self, val):
|
||||||
if not isinstance(val, bool) and val not in (0, 1):
|
if not isinstance(val, bool) and val not in (0, 1):
|
||||||
raise VMCMDErrors(f'mode.{param} is a boolean parameter')
|
raise VMCMDErrors(f'mode.{param} is a boolean parameter')
|
||||||
self.setter(f'mode.{param}', 1 if val else 0)
|
self.setter(f'mode.{param}', 1 if val else 0)
|
||||||
return property(fget, fset)
|
return property(fget, fset)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user