mirror of
https://github.com/onyx-and-iris/xair-api-python.git
synced 2024-11-22 04:40:58 +00:00
fix mute_group toggle for config class.
use mute_group.on in xair-obs example patch bump
This commit is contained in:
parent
b8e7254850
commit
a4e9e430f9
@ -3,11 +3,10 @@ import xair_api
|
||||
|
||||
|
||||
class Observer:
|
||||
def __init__(self, cl, mixer):
|
||||
self._cl = cl
|
||||
def __init__(self, mixer):
|
||||
self._mixer = mixer
|
||||
self._cl = obs.EventClient()
|
||||
self._cl.callback.register(self.on_current_program_scene_changed)
|
||||
print(f"Registered events: {self._cl.callback.get()}")
|
||||
|
||||
def on_current_program_scene_changed(self, data):
|
||||
scene = data.scene_name
|
||||
@ -23,15 +22,13 @@ class Observer:
|
||||
print("Settings strip 02 color")
|
||||
self._mixer.strip[1].config.color = 8
|
||||
case "LIVE":
|
||||
self._mixer.dca[0].on = True
|
||||
print(f"DCA 1 is {self._mixer.dca[0].on}")
|
||||
self._mixer.config.mute_group[0].on = False
|
||||
print(f"Mute Group 1 is {self._mixer.config.mute_group[0].on}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
cl = obs.EventClient()
|
||||
|
||||
with xair_api.connect("MR18", ip="mixer.local") as mixer:
|
||||
Observer(cl, mixer)
|
||||
Observer(mixer)
|
||||
|
||||
while cmd := input("<Enter> to exit\n"):
|
||||
if not cmd:
|
||||
|
@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "xair-api"
|
||||
version = "1.1.0"
|
||||
version = "1.1.1"
|
||||
description = "Remote control Behringer X-Air | Midas MR mixers through OSC"
|
||||
authors = ["onyx-and-iris <code@onyxandiris.online>"]
|
||||
license = "MIT"
|
||||
|
@ -35,11 +35,15 @@ class Config(IConfig):
|
||||
Returns a Config class of a kind.
|
||||
"""
|
||||
LINKS_cls = _make_links_mixins[remote.kind.id_]
|
||||
MUTEGROUP_cls = type(f"MuteGroup", (Config.MuteGroup, cls), {})
|
||||
MONITOR_cls = type(f"ConfigMonitor", (Config.Monitor, cls), {})
|
||||
CONFIG_cls = type(
|
||||
f"Config{remote.kind}",
|
||||
(cls, LINKS_cls),
|
||||
{"monitor": MONITOR_cls(remote)},
|
||||
{
|
||||
"mute_group": tuple(MUTEGROUP_cls(remote, i) for i in range(4)),
|
||||
"monitor": MONITOR_cls(remote),
|
||||
},
|
||||
)
|
||||
return CONFIG_cls(remote)
|
||||
|
||||
@ -67,15 +71,25 @@ class Config(IConfig):
|
||||
raise XAirRemoteError("amixlock is a bool parameter")
|
||||
self.setter("amixlock", 1 if val else 0)
|
||||
|
||||
@property
|
||||
def mute_group(self) -> bool:
|
||||
return self.getter("mute")[0] == 1
|
||||
class MuteGroup:
|
||||
def __init__(self, remote, i):
|
||||
super(Config.MuteGroup, self).__init__(remote)
|
||||
self.i = i + 1
|
||||
|
||||
@mute_group.setter
|
||||
def mute_group(self, val: bool):
|
||||
if not isinstance(val, bool):
|
||||
raise XAirRemoteError("mute_group is a bool parameter")
|
||||
self.setter("mute", 1 if val else 0)
|
||||
@property
|
||||
def address(self) -> str:
|
||||
root = super(Config.MuteGroup, self).address
|
||||
return f"{root}/mute"
|
||||
|
||||
@property
|
||||
def on(self) -> bool:
|
||||
return self.getter(f"{self.i}")[0] == 1
|
||||
|
||||
@on.setter
|
||||
def on(self, val: bool):
|
||||
if not isinstance(val, bool):
|
||||
raise XAirRemoteError("on is a boolean parameter")
|
||||
self.setter(f"{self.i}", 1 if val else 0)
|
||||
|
||||
class Monitor:
|
||||
@property
|
||||
|
Loading…
Reference in New Issue
Block a user