mirror of
https://github.com/onyx-and-iris/vban-cmd-python.git
synced 2026-03-12 12:59:13 +00:00
Compare commits
No commits in common. "28cbef5ef617d75465d8933d2a86bf048464db4b" and "55b3125e106ea2ee9feb2cb228ea9d9cd68e94a0" have entirely different histories.
28cbef5ef6
...
55b3125e10
@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "vban-cmd"
|
name = "vban-cmd"
|
||||||
version = "2.9.4"
|
version = "2.9.2"
|
||||||
description = "Python interface for the VBAN RT Packet Service (Sendtext)"
|
description = "Python interface for the VBAN RT Packet Service (Sendtext)"
|
||||||
authors = [{ name = "Onyx and Iris", email = "code@onyxandiris.online" }]
|
authors = [{ name = "Onyx and Iris", email = "code@onyxandiris.online" }]
|
||||||
license = { text = "MIT" }
|
license = { text = "MIT" }
|
||||||
|
|||||||
@ -11,7 +11,7 @@ from vban_cmd.kinds import request_kind_map as kindmap
|
|||||||
KIND_ID = os.environ.get('KIND', 'potato')
|
KIND_ID = os.environ.get('KIND', 'potato')
|
||||||
|
|
||||||
opts = {
|
opts = {
|
||||||
'host': os.getenv('VBANCMD_HOST', 'localhost'),
|
'ip': os.getenv('VBANCMD_IP', 'localhost'),
|
||||||
'streamname': os.getenv('VBANCMD_STREAMNAME', 'Command1'),
|
'streamname': os.getenv('VBANCMD_STREAMNAME', 'Command1'),
|
||||||
'port': int(os.getenv('VBANCMD_PORT', 6980)),
|
'port': int(os.getenv('VBANCMD_PORT', 6980)),
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,82 @@
|
|||||||
import abc
|
import abc
|
||||||
import logging
|
import logging
|
||||||
|
from dataclasses import dataclass
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class Modes:
|
||||||
|
"""Channel Modes"""
|
||||||
|
|
||||||
|
_mute: hex = 0x00000001
|
||||||
|
_solo: hex = 0x00000002
|
||||||
|
_mono: hex = 0x00000004
|
||||||
|
_mc: hex = 0x00000008
|
||||||
|
|
||||||
|
_amix: hex = 0x00000010
|
||||||
|
_repeat: hex = 0x00000020
|
||||||
|
_bmix: hex = 0x00000030
|
||||||
|
_composite: hex = 0x00000040
|
||||||
|
_tvmix: hex = 0x00000050
|
||||||
|
_upmix21: hex = 0x00000060
|
||||||
|
_upmix41: hex = 0x00000070
|
||||||
|
_upmix61: hex = 0x00000080
|
||||||
|
_centeronly: hex = 0x00000090
|
||||||
|
_lfeonly: hex = 0x000000A0
|
||||||
|
_rearonly: hex = 0x000000B0
|
||||||
|
|
||||||
|
_mask: hex = 0x000000F0
|
||||||
|
|
||||||
|
_on: hex = 0x00000100 # eq.on
|
||||||
|
_cross: hex = 0x00000200
|
||||||
|
_ab: hex = 0x00000800 # eq.ab
|
||||||
|
|
||||||
|
_busa: hex = 0x00001000
|
||||||
|
_busa1: hex = 0x00001000
|
||||||
|
_busa2: hex = 0x00002000
|
||||||
|
_busa3: hex = 0x00004000
|
||||||
|
_busa4: hex = 0x00008000
|
||||||
|
_busa5: hex = 0x00080000
|
||||||
|
|
||||||
|
_busb: hex = 0x00010000
|
||||||
|
_busb1: hex = 0x00010000
|
||||||
|
_busb2: hex = 0x00020000
|
||||||
|
_busb3: hex = 0x00040000
|
||||||
|
|
||||||
|
_pan0: hex = 0x00000000
|
||||||
|
_pancolor: hex = 0x00100000
|
||||||
|
_panmod: hex = 0x00200000
|
||||||
|
_panmask: hex = 0x00F00000
|
||||||
|
|
||||||
|
_postfx_r: hex = 0x01000000
|
||||||
|
_postfx_d: hex = 0x02000000
|
||||||
|
_postfx1: hex = 0x04000000
|
||||||
|
_postfx2: hex = 0x08000000
|
||||||
|
|
||||||
|
_sel: hex = 0x10000000
|
||||||
|
_monitor: hex = 0x20000000
|
||||||
|
|
||||||
|
@property
|
||||||
|
def modevals(self):
|
||||||
|
return (
|
||||||
|
val
|
||||||
|
for val in [
|
||||||
|
self._amix,
|
||||||
|
self._repeat,
|
||||||
|
self._bmix,
|
||||||
|
self._composite,
|
||||||
|
self._tvmix,
|
||||||
|
self._upmix21,
|
||||||
|
self._upmix41,
|
||||||
|
self._upmix61,
|
||||||
|
self._centeronly,
|
||||||
|
self._lfeonly,
|
||||||
|
self._rearonly,
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class IRemote(abc.ABC):
|
class IRemote(abc.ABC):
|
||||||
"""
|
"""
|
||||||
Common interface between base class and extended (higher) classes
|
Common interface between base class and extended (higher) classes
|
||||||
@ -15,6 +88,7 @@ class IRemote(abc.ABC):
|
|||||||
self._remote = remote
|
self._remote = remote
|
||||||
self.index = index
|
self.index = index
|
||||||
self.logger = logger.getChild(self.__class__.__name__)
|
self.logger = logger.getChild(self.__class__.__name__)
|
||||||
|
self._modes = Modes()
|
||||||
|
|
||||||
def getter(self, param):
|
def getter(self, param):
|
||||||
cmd = self._cmd(param)
|
cmd = self._cmd(param)
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
from .enums import NBS, BusModes
|
from .enums import NBS, BusModes
|
||||||
from .packet.enums import ChannelModes
|
|
||||||
from .util import cache_bool, cache_float, cache_int, cache_string
|
from .util import cache_bool, cache_float, cache_int, cache_string
|
||||||
|
|
||||||
|
|
||||||
@ -28,7 +27,7 @@ def channel_bool_prop(param):
|
|||||||
elif param.lower() == 'mc':
|
elif param.lower() == 'mc':
|
||||||
return channel_state.mc
|
return channel_state.mc
|
||||||
else:
|
else:
|
||||||
return channel_state.get_mode(getattr(ChannelModes, param.upper()).value)
|
return channel_state.get_mode(getattr(self._modes, f'_{param.lower()}'))
|
||||||
|
|
||||||
def fset(self, val):
|
def fset(self, val):
|
||||||
self.setter(param, 1 if val else 0)
|
self.setter(param, 1 if val else 0)
|
||||||
@ -56,9 +55,7 @@ def channel_int_prop(param):
|
|||||||
bit_9 = (channel_state._state >> 9) & 1
|
bit_9 = (channel_state._state >> 9) & 1
|
||||||
return (bit_9 << 1) | bit_2
|
return (bit_9 << 1) | bit_2
|
||||||
else:
|
else:
|
||||||
return channel_state.get_mode_int(
|
return channel_state.get_mode_int(getattr(self._modes, f'_{param.lower()}'))
|
||||||
getattr(ChannelModes, param.upper()).value
|
|
||||||
)
|
|
||||||
|
|
||||||
def fset(self, val):
|
def fset(self, val):
|
||||||
self.setter(param, val)
|
self.setter(param, val)
|
||||||
@ -92,7 +89,7 @@ def strip_output_prop(param):
|
|||||||
|
|
||||||
strip_state = self.public_packets[NBS.zero].states.strip[self.index]
|
strip_state = self.public_packets[NBS.zero].states.strip[self.index]
|
||||||
|
|
||||||
return strip_state.get_mode(getattr(ChannelModes, f'BUS{param.upper()}').value)
|
return strip_state.get_mode(getattr(self._modes, f'_bus{param.lower()}'))
|
||||||
|
|
||||||
def fset(self, val):
|
def fset(self, val):
|
||||||
self.setter(param, 1 if val else 0)
|
self.setter(param, 1 if val else 0)
|
||||||
|
|||||||
@ -1,53 +0,0 @@
|
|||||||
from enum import Flag
|
|
||||||
|
|
||||||
|
|
||||||
class ChannelModes(Flag):
|
|
||||||
"""Channel Modes - Bit flags that can be combined"""
|
|
||||||
|
|
||||||
MUTE = 0x00000001
|
|
||||||
SOLO = 0x00000002
|
|
||||||
MONO = 0x00000004
|
|
||||||
MC = 0x00000008
|
|
||||||
|
|
||||||
AMIX = 0x00000010
|
|
||||||
REPEAT = 0x00000020
|
|
||||||
BMIX = 0x00000030
|
|
||||||
COMPOSITE = 0x00000040
|
|
||||||
TVMIX = 0x00000050
|
|
||||||
UPMIX21 = 0x00000060
|
|
||||||
UPMIX41 = 0x00000070
|
|
||||||
UPMIX61 = 0x00000080
|
|
||||||
CENTERONLY = 0x00000090
|
|
||||||
LFEONLY = 0x000000A0
|
|
||||||
REARONLY = 0x000000B0
|
|
||||||
|
|
||||||
MASK = 0x000000F0
|
|
||||||
|
|
||||||
ON = 0x00000100 # eq.on
|
|
||||||
CROSS = 0x00000200
|
|
||||||
AB = 0x00000800 # eq.ab
|
|
||||||
|
|
||||||
BUSA = 0x00001000
|
|
||||||
BUSA1 = 0x00001000
|
|
||||||
BUSA2 = 0x00002000
|
|
||||||
BUSA3 = 0x00004000
|
|
||||||
BUSA4 = 0x00008000
|
|
||||||
BUSA5 = 0x00080000
|
|
||||||
|
|
||||||
BUSB = 0x00010000
|
|
||||||
BUSB1 = 0x00010000
|
|
||||||
BUSB2 = 0x00020000
|
|
||||||
BUSB3 = 0x00040000
|
|
||||||
|
|
||||||
PAN0 = 0x00000000
|
|
||||||
PANCOLOR = 0x00100000
|
|
||||||
PANMOD = 0x00200000
|
|
||||||
PANMASK = 0x00F00000
|
|
||||||
|
|
||||||
POSTFX_R = 0x01000000
|
|
||||||
POSTFX_D = 0x02000000
|
|
||||||
POSTFX1 = 0x04000000
|
|
||||||
POSTFX2 = 0x08000000
|
|
||||||
|
|
||||||
SEL = 0x10000000
|
|
||||||
MONITOR = 0x20000000
|
|
||||||
@ -5,7 +5,6 @@ from vban_cmd.enums import NBS
|
|||||||
from vban_cmd.kinds import KindMapClass
|
from vban_cmd.kinds import KindMapClass
|
||||||
from vban_cmd.util import comp
|
from vban_cmd.util import comp
|
||||||
|
|
||||||
from .enums import ChannelModes
|
|
||||||
from .headers import VbanPacket
|
from .headers import VbanPacket
|
||||||
|
|
||||||
|
|
||||||
@ -32,57 +31,57 @@ class ChannelState:
|
|||||||
# Common boolean modes
|
# Common boolean modes
|
||||||
@property
|
@property
|
||||||
def mute(self) -> bool:
|
def mute(self) -> bool:
|
||||||
return (self._state & ChannelModes.MUTE.value) != 0
|
return (self._state & 0x00000001) != 0
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def solo(self) -> bool:
|
def solo(self) -> bool:
|
||||||
return (self._state & ChannelModes.SOLO.value) != 0
|
return (self._state & 0x00000002) != 0
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def mono(self) -> bool:
|
def mono(self) -> bool:
|
||||||
return (self._state & ChannelModes.MONO.value) != 0
|
return (self._state & 0x00000004) != 0
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def mc(self) -> bool:
|
def mc(self) -> bool:
|
||||||
return (self._state & ChannelModes.MC.value) != 0
|
return (self._state & 0x00000008) != 0
|
||||||
|
|
||||||
# EQ modes
|
# EQ modes
|
||||||
@property
|
@property
|
||||||
def eq_on(self) -> bool:
|
def eq_on(self) -> bool:
|
||||||
return (self._state & ChannelModes.ON.value) != 0
|
return (self._state & 0x00000100) != 0
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def eq_ab(self) -> bool:
|
def eq_ab(self) -> bool:
|
||||||
return (self._state & ChannelModes.AB.value) != 0
|
return (self._state & 0x00000800) != 0
|
||||||
|
|
||||||
# Bus assignments (strip to bus routing)
|
# Bus assignments (strip to bus routing)
|
||||||
@property
|
@property
|
||||||
def busa1(self) -> bool:
|
def busa1(self) -> bool:
|
||||||
return (self._state & ChannelModes.BUSA1.value) != 0
|
return (self._state & 0x00001000) != 0
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def busa2(self) -> bool:
|
def busa2(self) -> bool:
|
||||||
return (self._state & ChannelModes.BUSA2.value) != 0
|
return (self._state & 0x00002000) != 0
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def busa3(self) -> bool:
|
def busa3(self) -> bool:
|
||||||
return (self._state & ChannelModes.BUSA3.value) != 0
|
return (self._state & 0x00004000) != 0
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def busa4(self) -> bool:
|
def busa4(self) -> bool:
|
||||||
return (self._state & ChannelModes.BUSA4.value) != 0
|
return (self._state & 0x00008000) != 0
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def busb1(self) -> bool:
|
def busb1(self) -> bool:
|
||||||
return (self._state & ChannelModes.BUSB1.value) != 0
|
return (self._state & 0x00010000) != 0
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def busb2(self) -> bool:
|
def busb2(self) -> bool:
|
||||||
return (self._state & ChannelModes.BUSB2.value) != 0
|
return (self._state & 0x00020000) != 0
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def busb3(self) -> bool:
|
def busb3(self) -> bool:
|
||||||
return (self._state & ChannelModes.BUSB3.value) != 0
|
return (self._state & 0x00040000) != 0
|
||||||
|
|
||||||
|
|
||||||
class States(NamedTuple):
|
class States(NamedTuple):
|
||||||
|
|||||||
@ -312,6 +312,7 @@ class VbanCmd(abc.ABC):
|
|||||||
|
|
||||||
for key, di in data.items():
|
for key, di in data.items():
|
||||||
target(key).apply(di)
|
target(key).apply(di)
|
||||||
|
time.sleep(self.DELAY)
|
||||||
|
|
||||||
def apply_config(self, name):
|
def apply_config(self, name):
|
||||||
"""applies a config from memory"""
|
"""applies a config from memory"""
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user