From dd24fc1816dfbae90fc77035632900d958f4e0ac Mon Sep 17 00:00:00 2001 From: onyx-and-iris <75868496+onyx-and-iris@users.noreply.github.com> Date: Tue, 26 Apr 2022 21:03:02 +0100 Subject: [PATCH] changes to param cache changes to param cache allow set bus mode true or false (setting false resets to mode normal) --- vbancmd/bus.py | 2 -- vbancmd/channel.py | 8 ++------ vbancmd/meta.py | 8 ++------ vbancmd/strip.py | 4 ---- vbancmd/vbancmd.py | 2 +- 5 files changed, 5 insertions(+), 19 deletions(-) diff --git a/vbancmd/bus.py b/vbancmd/bus.py index ba275d4..f7e10d3 100644 --- a/vbancmd/bus.py +++ b/vbancmd/bus.py @@ -43,7 +43,6 @@ class OutputBus(Channel): val = self.getter("label") if val is None: val = self.public_packet.buslabels[self.index] - self._remote.cache[f"{self.identifier}.label"] = [val, False] return val @label.setter @@ -66,7 +65,6 @@ class OutputBus(Channel): val = self.getter("gain") if val is None: val = round((fget() * 0.01), 1) - self._remote.cache[f"{self.identifier}.gain"] = [val, False] return round(val, 1) @gain.setter diff --git a/vbancmd/channel.py b/vbancmd/channel.py index f6a2003..ac8fa21 100644 --- a/vbancmd/channel.py +++ b/vbancmd/channel.py @@ -86,12 +86,8 @@ class Channel(abc.ABC): def getter(self, param): cmd = f"{self.identifier}.{param}" - if cmd in self._remote.cache and self._remote.cache[cmd][1]: - for _ in range(2): - if self._remote.pdirty: - val = self._remote.cache.pop(f"{self.identifier}.{param}")[0] - return val - sleep(0.001) + if cmd in self._remote.cache: + return self._remote.cache.pop(f"{self.identifier}.{param}") def setter(self, param, val): """Sends a string request RT packet.""" diff --git a/vbancmd/meta.py b/vbancmd/meta.py index 569d9db..e8a3bef 100644 --- a/vbancmd/meta.py +++ b/vbancmd/meta.py @@ -13,7 +13,6 @@ def strip_bool_prop(param): & getattr(self._modes, f"_{param}") == 0 ) - self._remote.cache[f"{self.identifier}.{param}"] = [val, False] return val return val == 1 @@ -36,7 +35,6 @@ def bus_bool_prop(param): & getattr(self._modes, f'_{param.replace(".", "_").lower()}') == 0 ) - self._remote.cache[f"{self.identifier}.{param}"] = [val, False] return val return val == 1 @@ -59,7 +57,6 @@ def strip_output_prop(param): & getattr(self._modes, f"_bus{param.lower()}") == 0 ) - self._remote.cache[f"{self.identifier}.{param}"] = [val, False] return val return val == 1 @@ -78,7 +75,7 @@ def bus_mode_prop(param): val = self.getter(f"mode.{param}") if val is None: if param == "normal": - return not any( + return any( not int.from_bytes( self.public_packet.busstate[self.index], "little" ) @@ -94,14 +91,13 @@ def bus_mode_prop(param): & getattr(self._modes, f"_{param}") == 0 ) - self._remote.cache[f"{self.identifier}.mode.{param}"] = [val, False] return val return val == 1 def fset(self, val): if not isinstance(val, bool) and val not in (0, 1): 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) diff --git a/vbancmd/strip.py b/vbancmd/strip.py index 6000ed8..4eeae67 100644 --- a/vbancmd/strip.py +++ b/vbancmd/strip.py @@ -49,7 +49,6 @@ class InputStrip(Channel): val = self.getter("label") if val is None: val = self.public_packet.striplabels[self.index] - self._remote.cache[f"{self.identifier}.label"] = [val, False] return val @label.setter @@ -63,7 +62,6 @@ class InputStrip(Channel): val = self.getter("gain") if val is None: val = self.gainlayer[0].gain - self._remote.cache[f"{self.identifier}.gain"] = [val, False] return round(val, 1) @gain.setter @@ -107,7 +105,6 @@ class VirtualInputStrip(InputStrip): & getattr(self._modes, f"_mutec") == 0 ) - self._remote.cache[f"{self.identifier}.mc"] = [val, False] return val return val == 1 @@ -175,7 +172,6 @@ class GainLayer(InputStrip): val = self.getter(f"GainLayer[{self._i}]") if val is None: val = round((fget() * 0.01), 1) - self._remote.cache[f"{self.identifier}.GainLayer[{self._i}]"] = [val, False] return val return round(val, 1) diff --git a/vbancmd/vbancmd.py b/vbancmd/vbancmd.py index 6bf4da4..0ff1924 100644 --- a/vbancmd/vbancmd.py +++ b/vbancmd/vbancmd.py @@ -200,7 +200,7 @@ class VbanCmd(abc.ABC): ) count = int.from_bytes(self._text_header.framecounter, "little") + 1 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: sleep(self._delay)