mirror of
https://github.com/onyx-and-iris/vban-cmd-python.git
synced 2025-01-18 18:40:47 +00:00
changes to param cache
changes to param cache allow set bus mode true or false (setting false resets to mode normal)
This commit is contained in:
parent
2bc9fa9d57
commit
dd24fc1816
@ -43,7 +43,6 @@ class OutputBus(Channel):
|
|||||||
val = self.getter("label")
|
val = self.getter("label")
|
||||||
if val is None:
|
if val is None:
|
||||||
val = self.public_packet.buslabels[self.index]
|
val = self.public_packet.buslabels[self.index]
|
||||||
self._remote.cache[f"{self.identifier}.label"] = [val, False]
|
|
||||||
return val
|
return val
|
||||||
|
|
||||||
@label.setter
|
@label.setter
|
||||||
@ -66,7 +65,6 @@ class OutputBus(Channel):
|
|||||||
val = self.getter("gain")
|
val = self.getter("gain")
|
||||||
if val is None:
|
if val is None:
|
||||||
val = round((fget() * 0.01), 1)
|
val = round((fget() * 0.01), 1)
|
||||||
self._remote.cache[f"{self.identifier}.gain"] = [val, False]
|
|
||||||
return round(val, 1)
|
return round(val, 1)
|
||||||
|
|
||||||
@gain.setter
|
@gain.setter
|
||||||
|
@ -86,12 +86,8 @@ class Channel(abc.ABC):
|
|||||||
|
|
||||||
def getter(self, param):
|
def getter(self, param):
|
||||||
cmd = f"{self.identifier}.{param}"
|
cmd = f"{self.identifier}.{param}"
|
||||||
if cmd in self._remote.cache and self._remote.cache[cmd][1]:
|
if cmd in self._remote.cache:
|
||||||
for _ in range(2):
|
return self._remote.cache.pop(f"{self.identifier}.{param}")
|
||||||
if self._remote.pdirty:
|
|
||||||
val = self._remote.cache.pop(f"{self.identifier}.{param}")[0]
|
|
||||||
return val
|
|
||||||
sleep(0.001)
|
|
||||||
|
|
||||||
def setter(self, param, val):
|
def setter(self, param, val):
|
||||||
"""Sends a string request RT packet."""
|
"""Sends a string request RT packet."""
|
||||||
|
@ -13,7 +13,6 @@ def strip_bool_prop(param):
|
|||||||
& getattr(self._modes, f"_{param}")
|
& getattr(self._modes, f"_{param}")
|
||||||
== 0
|
== 0
|
||||||
)
|
)
|
||||||
self._remote.cache[f"{self.identifier}.{param}"] = [val, False]
|
|
||||||
return val
|
return val
|
||||||
return val == 1
|
return val == 1
|
||||||
|
|
||||||
@ -36,7 +35,6 @@ def bus_bool_prop(param):
|
|||||||
& getattr(self._modes, f'_{param.replace(".", "_").lower()}')
|
& getattr(self._modes, f'_{param.replace(".", "_").lower()}')
|
||||||
== 0
|
== 0
|
||||||
)
|
)
|
||||||
self._remote.cache[f"{self.identifier}.{param}"] = [val, False]
|
|
||||||
return val
|
return val
|
||||||
return val == 1
|
return val == 1
|
||||||
|
|
||||||
@ -59,7 +57,6 @@ def strip_output_prop(param):
|
|||||||
& getattr(self._modes, f"_bus{param.lower()}")
|
& getattr(self._modes, f"_bus{param.lower()}")
|
||||||
== 0
|
== 0
|
||||||
)
|
)
|
||||||
self._remote.cache[f"{self.identifier}.{param}"] = [val, False]
|
|
||||||
return val
|
return val
|
||||||
return val == 1
|
return val == 1
|
||||||
|
|
||||||
@ -78,7 +75,7 @@ def bus_mode_prop(param):
|
|||||||
val = self.getter(f"mode.{param}")
|
val = self.getter(f"mode.{param}")
|
||||||
if val is None:
|
if val is None:
|
||||||
if param == "normal":
|
if param == "normal":
|
||||||
return not any(
|
return any(
|
||||||
not int.from_bytes(
|
not int.from_bytes(
|
||||||
self.public_packet.busstate[self.index], "little"
|
self.public_packet.busstate[self.index], "little"
|
||||||
)
|
)
|
||||||
@ -94,14 +91,13 @@ def bus_mode_prop(param):
|
|||||||
& getattr(self._modes, f"_{param}")
|
& getattr(self._modes, f"_{param}")
|
||||||
== 0
|
== 0
|
||||||
)
|
)
|
||||||
self._remote.cache[f"{self.identifier}.mode.{param}"] = [val, False]
|
|
||||||
return val
|
return val
|
||||||
return val == 1
|
return val == 1
|
||||||
|
|
||||||
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)
|
self.setter(f"mode.{param}", 1 if val else 0)
|
||||||
|
|
||||||
return property(fget, fset)
|
return property(fget, fset)
|
||||||
|
|
||||||
|
@ -49,7 +49,6 @@ class InputStrip(Channel):
|
|||||||
val = self.getter("label")
|
val = self.getter("label")
|
||||||
if val is None:
|
if val is None:
|
||||||
val = self.public_packet.striplabels[self.index]
|
val = self.public_packet.striplabels[self.index]
|
||||||
self._remote.cache[f"{self.identifier}.label"] = [val, False]
|
|
||||||
return val
|
return val
|
||||||
|
|
||||||
@label.setter
|
@label.setter
|
||||||
@ -63,7 +62,6 @@ class InputStrip(Channel):
|
|||||||
val = self.getter("gain")
|
val = self.getter("gain")
|
||||||
if val is None:
|
if val is None:
|
||||||
val = self.gainlayer[0].gain
|
val = self.gainlayer[0].gain
|
||||||
self._remote.cache[f"{self.identifier}.gain"] = [val, False]
|
|
||||||
return round(val, 1)
|
return round(val, 1)
|
||||||
|
|
||||||
@gain.setter
|
@gain.setter
|
||||||
@ -107,7 +105,6 @@ class VirtualInputStrip(InputStrip):
|
|||||||
& getattr(self._modes, f"_mutec")
|
& getattr(self._modes, f"_mutec")
|
||||||
== 0
|
== 0
|
||||||
)
|
)
|
||||||
self._remote.cache[f"{self.identifier}.mc"] = [val, False]
|
|
||||||
return val
|
return val
|
||||||
return val == 1
|
return val == 1
|
||||||
|
|
||||||
@ -175,7 +172,6 @@ class GainLayer(InputStrip):
|
|||||||
val = self.getter(f"GainLayer[{self._i}]")
|
val = self.getter(f"GainLayer[{self._i}]")
|
||||||
if val is None:
|
if val is None:
|
||||||
val = round((fget() * 0.01), 1)
|
val = round((fget() * 0.01), 1)
|
||||||
self._remote.cache[f"{self.identifier}.GainLayer[{self._i}]"] = [val, False]
|
|
||||||
return val
|
return val
|
||||||
return round(val, 1)
|
return round(val, 1)
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ class VbanCmd(abc.ABC):
|
|||||||
)
|
)
|
||||||
count = int.from_bytes(self._text_header.framecounter, "little") + 1
|
count = int.from_bytes(self._text_header.framecounter, "little") + 1
|
||||||
self._text_header.framecounter = count.to_bytes(4, "little")
|
self._text_header.framecounter = count.to_bytes(4, "little")
|
||||||
self.cache[f"{id_}.{param}"] = [val, True]
|
self.cache[f"{id_}.{param}"] = val
|
||||||
if self._sync:
|
if self._sync:
|
||||||
sleep(self._delay)
|
sleep(self._delay)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user