2022-03-04 14:22:29 +00:00
|
|
|
from .errors import VMCMDErrors
|
2022-03-18 07:42:25 +00:00
|
|
|
from time import sleep
|
2022-03-04 14:22:29 +00:00
|
|
|
|
|
|
|
def strip_output_prop(param):
|
|
|
|
""" A strip output prop. """
|
|
|
|
def fget(self):
|
2022-03-18 07:42:25 +00:00
|
|
|
return not int.from_bytes(self.public_packet.stripstate[self.index], 'little') & getattr(self._modes, f'_bus{param.lower()}') == 0
|
2022-03-04 14:22:29 +00:00
|
|
|
def fset(self, val):
|
|
|
|
if not isinstance(val, bool) and val not in (0, 1):
|
|
|
|
raise VMCMDErrors(f'{param} is a boolean parameter')
|
|
|
|
self.setter(param, 1 if val else 0)
|
|
|
|
return property(fget, fset)
|
2022-03-17 14:08:49 +00:00
|
|
|
|
|
|
|
def bus_mode_prop(param):
|
|
|
|
""" A strip output prop. """
|
|
|
|
def fget(self):
|
2022-03-18 07:42:25 +00:00
|
|
|
data = self.public_packet
|
|
|
|
modes = {
|
|
|
|
'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),
|
|
|
|
'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),
|
|
|
|
'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),
|
|
|
|
'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),
|
|
|
|
'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),
|
|
|
|
'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),
|
|
|
|
}
|
|
|
|
vals = tuple(
|
|
|
|
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',
|
2022-03-17 14:08:49 +00:00
|
|
|
'UpMix41', 'UpMix61', 'CenterOnly', 'LFEOnly', 'RearOnly']
|
2022-03-18 07:42:25 +00:00
|
|
|
)
|
|
|
|
return vals == modes[param.lower()]
|
2022-03-17 14:08:49 +00:00
|
|
|
def fset(self, val):
|
|
|
|
if not isinstance(val, bool) and val not in (0, 1):
|
2022-03-18 07:42:25 +00:00
|
|
|
raise VMCMDErrors(f'mode.{param} is a boolean parameter')
|
|
|
|
self.setter(f'mode.{param}', 1 if val else 0)
|
2022-03-17 14:08:49 +00:00
|
|
|
return property(fget, fset)
|
|
|
|
|