mirror of
https://github.com/onyx-and-iris/vban-cmd-python.git
synced 2024-11-15 17:10:46 +00:00
changes to level/gain properties in VbanRtPacket
level getters in strip, bus fetch from public packet if not in cache
This commit is contained in:
parent
1169435104
commit
db96872965
@ -32,17 +32,12 @@ class Bus(IRemote):
|
|||||||
def gain(self) -> float:
|
def gain(self) -> float:
|
||||||
def fget():
|
def fget():
|
||||||
val = self.public_packet.busgain[self.index]
|
val = self.public_packet.busgain[self.index]
|
||||||
if val < 10000:
|
if 0 <= val <= 1200:
|
||||||
return -val
|
return val * 0.01
|
||||||
elif val == ((1 << 16) - 1):
|
return (((1 << 16) - 1) - val) * -0.01
|
||||||
return 0
|
|
||||||
else:
|
|
||||||
return ((1 << 16) - 1) - val
|
|
||||||
|
|
||||||
val = self.getter("gain")
|
val = self.getter("gain")
|
||||||
if val is None:
|
return round(val if val else fget(), 1)
|
||||||
val = fget() * 0.01
|
|
||||||
return round(val, 1)
|
|
||||||
|
|
||||||
@gain.setter
|
@gain.setter
|
||||||
def gain(self, val: float):
|
def gain(self, val: float):
|
||||||
@ -79,10 +74,17 @@ class BusLevel(IRemote):
|
|||||||
def getter(self):
|
def getter(self):
|
||||||
"""Returns a tuple of level values for the channel."""
|
"""Returns a tuple of level values for the channel."""
|
||||||
|
|
||||||
|
if self._remote.running and self._remote.event.ldirty:
|
||||||
return tuple(
|
return tuple(
|
||||||
round(-i * 0.01, 1)
|
round(i * -0.01, 1)
|
||||||
for i in self._remote.cache["bus_level"][self.range[0] : self.range[-1]]
|
for i in self._remote.cache["bus_level"][self.range[0] : self.range[-1]]
|
||||||
)
|
)
|
||||||
|
return tuple(
|
||||||
|
round(i * -0.01, 1)
|
||||||
|
for i in self._remote._get_levels(self.public_packet)[1][
|
||||||
|
self.range[0] : self.range[-1]
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def identifier(self) -> str:
|
def identifier(self) -> str:
|
||||||
|
@ -80,9 +80,7 @@ class VbanRtPacket:
|
|||||||
def inputlevels(self) -> Generator[float, None, None]:
|
def inputlevels(self) -> Generator[float, None, None]:
|
||||||
"""returns the entire level array across all inputs"""
|
"""returns the entire level array across all inputs"""
|
||||||
for i in range(0, 68, 2):
|
for i in range(0, 68, 2):
|
||||||
val = ((1 << 16) - 1) - int.from_bytes(
|
val = int.from_bytes(self._inputLeveldB100[i : i + 2], "little")
|
||||||
self._inputLeveldB100[i : i + 2], "little"
|
|
||||||
)
|
|
||||||
if val != ((1 << 16) - 1):
|
if val != ((1 << 16) - 1):
|
||||||
yield val
|
yield val
|
||||||
|
|
||||||
@ -90,9 +88,7 @@ class VbanRtPacket:
|
|||||||
def outputlevels(self) -> Generator[float, None, None]:
|
def outputlevels(self) -> Generator[float, None, None]:
|
||||||
"""returns the entire level array across all outputs"""
|
"""returns the entire level array across all outputs"""
|
||||||
for i in range(0, 128, 2):
|
for i in range(0, 128, 2):
|
||||||
val = ((1 << 16) - 1) - int.from_bytes(
|
val = int.from_bytes(self._outputLeveldB100[i : i + 2], "little")
|
||||||
self._outputLeveldB100[i : i + 2], "little"
|
|
||||||
)
|
|
||||||
if val != ((1 << 16) - 1):
|
if val != ((1 << 16) - 1):
|
||||||
yield val
|
yield val
|
||||||
|
|
||||||
@ -114,64 +110,56 @@ class VbanRtPacket:
|
|||||||
@property
|
@property
|
||||||
def stripgainlayer1(self) -> tuple:
|
def stripgainlayer1(self) -> tuple:
|
||||||
return tuple(
|
return tuple(
|
||||||
((1 << 16) - 1)
|
int.from_bytes(self._stripGaindB100Layer1[i : i + 2], "little")
|
||||||
- int.from_bytes(self._stripGaindB100Layer1[i : i + 2], "little")
|
|
||||||
for i in range(0, 16, 2)
|
for i in range(0, 16, 2)
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def stripgainlayer2(self) -> tuple:
|
def stripgainlayer2(self) -> tuple:
|
||||||
return tuple(
|
return tuple(
|
||||||
((1 << 16) - 1)
|
int.from_bytes(self._stripGaindB100Layer2[i : i + 2], "little")
|
||||||
- int.from_bytes(self._stripGaindB100Layer2[i : i + 2], "little")
|
|
||||||
for i in range(0, 16, 2)
|
for i in range(0, 16, 2)
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def stripgainlayer3(self) -> tuple:
|
def stripgainlayer3(self) -> tuple:
|
||||||
return tuple(
|
return tuple(
|
||||||
((1 << 16) - 1)
|
int.from_bytes(self._stripGaindB100Layer3[i : i + 2], "little")
|
||||||
- int.from_bytes(self._stripGaindB100Layer3[i : i + 2], "little")
|
|
||||||
for i in range(0, 16, 2)
|
for i in range(0, 16, 2)
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def stripgainlayer4(self) -> tuple:
|
def stripgainlayer4(self) -> tuple:
|
||||||
return tuple(
|
return tuple(
|
||||||
((1 << 16) - 1)
|
int.from_bytes(self._stripGaindB100Layer4[i : i + 2], "little")
|
||||||
- int.from_bytes(self._stripGaindB100Layer4[i : i + 2], "little")
|
|
||||||
for i in range(0, 16, 2)
|
for i in range(0, 16, 2)
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def stripgainlayer5(self) -> tuple:
|
def stripgainlayer5(self) -> tuple:
|
||||||
return tuple(
|
return tuple(
|
||||||
((1 << 16) - 1)
|
int.from_bytes(self._stripGaindB100Layer5[i : i + 2], "little")
|
||||||
- int.from_bytes(self._stripGaindB100Layer5[i : i + 2], "little")
|
|
||||||
for i in range(0, 16, 2)
|
for i in range(0, 16, 2)
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def stripgainlayer6(self) -> tuple:
|
def stripgainlayer6(self) -> tuple:
|
||||||
return tuple(
|
return tuple(
|
||||||
((1 << 16) - 1)
|
int.from_bytes(self._stripGaindB100Layer6[i : i + 2], "little")
|
||||||
- int.from_bytes(self._stripGaindB100Layer6[i : i + 2], "little")
|
|
||||||
for i in range(0, 16, 2)
|
for i in range(0, 16, 2)
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def stripgainlayer7(self) -> tuple:
|
def stripgainlayer7(self) -> tuple:
|
||||||
return tuple(
|
return tuple(
|
||||||
((1 << 16) - 1)
|
int.from_bytes(self._stripGaindB100Layer7[i : i + 2], "little")
|
||||||
- int.from_bytes(self._stripGaindB100Layer7[i : i + 2], "little")
|
|
||||||
for i in range(0, 16, 2)
|
for i in range(0, 16, 2)
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def stripgainlayer8(self) -> tuple:
|
def stripgainlayer8(self) -> tuple:
|
||||||
return tuple(
|
return tuple(
|
||||||
((1 << 16) - 1)
|
int.from_bytes(self._stripGaindB100Layer8[i : i + 2], "little")
|
||||||
- int.from_bytes(self._stripGaindB100Layer8[i : i + 2], "little")
|
|
||||||
for i in range(0, 16, 2)
|
for i in range(0, 16, 2)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -179,7 +167,7 @@ class VbanRtPacket:
|
|||||||
def busgain(self) -> tuple:
|
def busgain(self) -> tuple:
|
||||||
"""returns tuple of bus gains"""
|
"""returns tuple of bus gains"""
|
||||||
return tuple(
|
return tuple(
|
||||||
((1 << 16) - 1) - int.from_bytes(self._busGaindB100[i : i + 2], "little")
|
int.from_bytes(self._busGaindB100[i : i + 2], "little")
|
||||||
for i in range(0, 16, 2)
|
for i in range(0, 16, 2)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -103,9 +103,20 @@ class StripLevel(IRemote):
|
|||||||
self.range = self.level_map[self.index]
|
self.range = self.level_map[self.index]
|
||||||
|
|
||||||
def getter(self):
|
def getter(self):
|
||||||
|
"""Returns a tuple of level values for the channel."""
|
||||||
|
|
||||||
|
if self._remote.running and self._remote.event.ldirty:
|
||||||
return tuple(
|
return tuple(
|
||||||
round(-i * 0.01, 1)
|
round(i * -0.01, 1)
|
||||||
for i in self._remote.cache["strip_level"][self.range[0] : self.range[-1]]
|
for i in self._remote.cache["strip_level"][
|
||||||
|
self.range[0] : self.range[-1]
|
||||||
|
]
|
||||||
|
)
|
||||||
|
return tuple(
|
||||||
|
round(i * -0.01, 1)
|
||||||
|
for i in self._remote._get_levels(self.public_packet)[0][
|
||||||
|
self.range[0] : self.range[-1]
|
||||||
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -149,17 +160,12 @@ class GainLayer(IRemote):
|
|||||||
def gain(self) -> float:
|
def gain(self) -> float:
|
||||||
def fget():
|
def fget():
|
||||||
val = getattr(self.public_packet, f"stripgainlayer{self._i+1}")[self.index]
|
val = getattr(self.public_packet, f"stripgainlayer{self._i+1}")[self.index]
|
||||||
if val < 10000:
|
if 0 <= val <= 1200:
|
||||||
return -val
|
return val * 0.01
|
||||||
elif val == ((1 << 16) - 1):
|
return (((1 << 16) - 1) - val) * -0.01
|
||||||
return 0
|
|
||||||
else:
|
|
||||||
return ((1 << 16) - 1) - val
|
|
||||||
|
|
||||||
val = self.getter(f"GainLayer[{self._i}]")
|
val = self.getter(f"GainLayer[{self._i}]")
|
||||||
if val is None:
|
return round(val if val else fget(), 1)
|
||||||
val = fget() * 0.01
|
|
||||||
return round(val, 1)
|
|
||||||
|
|
||||||
@gain.setter
|
@gain.setter
|
||||||
def gain(self, val: float):
|
def gain(self, val: float):
|
||||||
|
Loading…
Reference in New Issue
Block a user